Skip to content

Commit c34f5d0

Browse files
committed
build: fix build error
1 parent e02822f commit c34f5d0

File tree

4 files changed

+154
-128
lines changed

4 files changed

+154
-128
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"dist"
1313
],
1414
"scripts": {
15-
"build": "node scripts/build.js",
15+
"build": "node scripts/build.mjs",
1616
"clean": "rm -rf dist coverage temp .nyc_output .tmp",
1717
"lint": "prettier --check --write --parser typescript \"{src,test}/**/*.ts\"",
1818
"lint:fail": "prettier --check --parser typescript \"{src,test}/**/*.ts\"",
@@ -25,7 +25,7 @@
2525
"docs:build": "vuepress build docs",
2626
"docs:deploy": "bash ./docs/deploy.sh",
2727
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
28-
"release": "node scripts/release.js"
28+
"release": "node --experimental-json-modules scripts/release.mjs"
2929
},
3030
"repository": {
3131
"type": "git",
@@ -63,6 +63,7 @@
6363
"core-js": "^3.19.1",
6464
"enquirer": "^2.3.6",
6565
"execa": "^6.0.0",
66+
"fs-extra": "^10.0.0",
6667
"jest": "^27.3.1",
6768
"prettier": "^2.4.1",
6869
"rollup": "^2.60.0",

scripts/build.js renamed to scripts/build.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const fs = require('fs-extra')
2-
const chalk = require('chalk')
3-
const execa = require('execa')
4-
const { gzipSync } = require('zlib')
5-
const { compress } = require('brotli')
1+
import fs from 'fs-extra'
2+
import chalk from 'chalk'
3+
import { execa } from 'execa'
4+
import { gzipSync } from 'zlib'
5+
import { compress } from 'brotli'
66

77
const files = [
88
'dist/vuex-orm.esm-browser.js',

scripts/release.js renamed to scripts/release.mjs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
const fs = require('fs')
2-
const path = require('path')
3-
const chalk = require('chalk')
4-
const semver = require('semver')
5-
const { prompt } = require('enquirer')
6-
const execa = require('execa')
7-
const currentVersion = require('../package.json').version
1+
import fs from 'fs'
2+
import path from 'path'
3+
import chalk from 'chalk'
4+
import semver from 'semver'
5+
import enquirer from 'enquirer'
6+
import { execa } from 'execa'
7+
import pkg from '../package.json'
8+
9+
const currentVersion = pkg.version
810

911
const versionIncrements = [
1012
'patch',
@@ -25,15 +27,15 @@ const step = (msg) => console.log(chalk.cyan(msg))
2527
async function main() {
2628
let targetVersion
2729

28-
const { release } = await prompt({
30+
const { release } = await enquirer.prompt({
2931
type: 'select',
3032
name: 'release',
3133
message: 'Select release type',
3234
choices: versionIncrements.map(i => `${i} (${inc(i)})`).concat(['custom'])
3335
})
3436

3537
if (release === 'custom') {
36-
targetVersion = (await prompt({
38+
targetVersion = (await enquirer.prompt({
3739
type: 'input',
3840
name: 'version',
3941
message: 'Input custom version',
@@ -47,14 +49,14 @@ async function main() {
4749
throw new Error(`Invalid target version: ${targetVersion}`)
4850
}
4951

50-
const { tag } = await prompt({
52+
const { tag } = await enquirer.prompt({
5153
type: 'select',
5254
name: 'tag',
5355
message: 'Select tag type',
5456
choices: tags
5557
})
5658

57-
const { yes: tagOk } = await prompt({
59+
const { yes: tagOk } = await enquirer.prompt({
5860
type: 'confirm',
5961
name: 'yes',
6062
message: `Releasing v${targetVersion}. Confirm?`
@@ -82,7 +84,7 @@ async function main() {
8284
step('\nGenerating the changelog...')
8385
await run('yarn', ['changelog'])
8486

85-
const { yes: changelogOk } = await prompt({
87+
const { yes: changelogOk } = await enquirer.prompt({
8688
type: 'confirm',
8789
name: 'yes',
8890
message: `Changelog generated. Does it look good?`

0 commit comments

Comments
 (0)