Skip to content

Commit

Permalink
feat: 产出物支持zip压缩
Browse files Browse the repository at this point in the history
  • Loading branch information
whizbz11 committed Sep 8, 2020
1 parent dd659e7 commit 3c102c8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const create = require('./create')
const compress = require('./compress')
const publish = require('./publish')
const login = require('./login')
const zip = require('./zip')
module.exports = {
init,
build,
Expand All @@ -15,5 +16,6 @@ module.exports = {
getRc,
publish,
compress,
login
login,
zip
}
14 changes: 14 additions & 0 deletions src/cli/zip.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const compressing = require('compressing');
const chalk = require('chalk');
const path = require('path');
const sourcePath = path.resolve('dist')
const targetPath = path.resolve('dist.zip')

compressing.zip.compressDir(sourcePath, targetPath)
.then((data) => {
console.log(chalk.yellow(`Tip: 文件压缩成功,已压缩至【${targetPath}】`));
})
.catch(err => {
console.log('Tip: build zip fail');
console.log(err)
});

0 comments on commit 3c102c8

Please sign in to comment.