Skip to content

Commit 8a9a18c

Browse files
committed
fixing zip build script
1 parent 42ff53b commit 8a9a18c

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

postPrepare.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
const zip = require('bestzip');
22
const package = require('./package.json');
3+
const fs = require('fs');
34

45
console.log('Zipping started:');
6+
const newPath = `./nt-dashboard_v${package.version}.zip`;
57

6-
zip({
7-
source: 'build/*',
8-
destination: `nt-dashboard_v${package.version}.zip`,
9-
})
10-
.then(function () {
11-
console.log('Zipped up!');
8+
try {
9+
fs.unlinkSync(newPath);
10+
zip({
11+
source: './build/*',
12+
destination: newPath,
1213
})
13-
.catch(function (err) {
14-
console.error(err.stack);
15-
process.exit(1);
16-
});
14+
.then(function () {
15+
console.log('Zipped up!');
16+
})
17+
.catch(function (err) {
18+
console.error(err.stack);
19+
process.exit(1);
20+
});
21+
} catch (e) {
22+
console.error(e.stack);
23+
}

0 commit comments

Comments
 (0)