zyd-server-build2 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +6 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -35,7 +35,7 @@ function build ({ src, dst, ignoreDir = [], ignoreFile = [], copyright = "", noB
|
|
|
35
35
|
writable = fs.createWriteStream(_dst);
|
|
36
36
|
readable.pipe(writable);
|
|
37
37
|
} else {
|
|
38
|
-
exec(`npx babel ${_src} --out-file ${_dst}`, (err, stdout, stderr) => {
|
|
38
|
+
exec(`npx babel ${_src} --out-file ${_dst}`, async (err, stdout, stderr) => {
|
|
39
39
|
if (err) {
|
|
40
40
|
console.error(`执行Babel命令时出错: ${err}`)
|
|
41
41
|
return
|
|
@@ -44,8 +44,8 @@ function build ({ src, dst, ignoreDir = [], ignoreFile = [], copyright = "", noB
|
|
|
44
44
|
// 输出Babel命令的标准输出和标准错误
|
|
45
45
|
// console.log(`标准输出:${stdout}`);
|
|
46
46
|
// console.error(`标准错误:${stderr}`);
|
|
47
|
-
readable = fs.readFileSync(
|
|
48
|
-
const result = minify(readable, {
|
|
47
|
+
readable = await fs.readFileSync(_dst, 'utf-8')
|
|
48
|
+
const result = await minify(readable, {
|
|
49
49
|
parse: {
|
|
50
50
|
// parse options
|
|
51
51
|
},
|
|
@@ -93,9 +93,9 @@ function build ({ src, dst, ignoreDir = [], ignoreFile = [], copyright = "", noB
|
|
|
93
93
|
safari10: false,
|
|
94
94
|
toplevel: false
|
|
95
95
|
})
|
|
96
|
-
fs.writeFileSync(_dst, (copyright ? "/* " + copyright + " */" : "") + result.code)
|
|
97
|
-
console.log(_src, "\x1B[36m=>\x1B[0m", _dst, `\x1B[33m${bytesToSize(st.size)}\x1B[0m`, "\x1B[32mCode confused √\x1B[0m")
|
|
96
|
+
await fs.writeFileSync(_dst, (copyright ? "/* " + copyright + " */" : "") + result.code)
|
|
98
97
|
})
|
|
98
|
+
console.log(_src, "\x1B[36m=>\x1B[0m", _dst, `\x1B[33m${bytesToSize(st.size)}\x1B[0m`, "\x1B[32mCode confused √\x1B[0m")
|
|
99
99
|
count[1]++
|
|
100
100
|
}
|
|
101
101
|
} else {
|
|
@@ -242,4 +242,5 @@ module.exports = ({
|
|
|
242
242
|
│ build success √ │
|
|
243
243
|
└─────────────────┘
|
|
244
244
|
\x1B[0m\x1B[0m`)
|
|
245
|
+
console.log('Please wait...')
|
|
245
246
|
}
|