|
@@ -4,9 +4,20 @@ const archiver = require('archiver')
|
|
|
|
|
|
// 获取当前命令行上下文路径
|
|
|
const currentDirectory = process.cwd();
|
|
|
-const distZipPath = path.join(currentDirectory, '/zip/client.zip');
|
|
|
+
|
|
|
+const distJoinPath = path.join(currentDirectory, '/zip/');
|
|
|
+if(!fs.existsSync(distJoinPath)) {
|
|
|
+ fs.mkdir(distJoinPath, (err)=>{
|
|
|
+ if(err){
|
|
|
+ console.log('zip文件夹创建失败')
|
|
|
+ }else{
|
|
|
+ console.log('zip文件夹创建成功')
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
// 创建文件输出流
|
|
|
+const distZipPath = path.join(currentDirectory, '/zip/client.zip');
|
|
|
let output = fs.createWriteStream(distZipPath)
|
|
|
let archive = archiver('zip', {
|
|
|
zlib: { level: 9 } // 设置压缩级别
|