chore: 修改 dist.zip 解压目录

pull/28/head
954270063@qq.com 2021-05-30 23:19:40 +08:00
parent 3a1a3f804c
commit 53a0ebe6a6
3 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,8 @@
#!/bin/sh #!/bin/sh
. "$(dirname "$0")/_/husky.sh" . "$(dirname "$0")/_/husky.sh"
# pkgName=$(cat ../package.json .name | sed 's/\"//g')
yarn build:zip yarn build:zip
git add dist.zip git add dist.zip
yarn lint-staged yarn lint-staged

View File

@ -29,7 +29,7 @@
}, },
"scripts": { "scripts": {
"build": "rollup --config", "build": "rollup --config",
"build:zip": "yarn build && node scripts/dist.zip.js", "build:zip": "yarn build && node scripts/zip.js",
"test": "jest --passWithNoTests", "test": "jest --passWithNoTests",
"lint": "eslint", "lint": "eslint",
"format": "prettier --check --write '{src,__tests__}/**/*.{js,ts,tsx}'", "format": "prettier --check --write '{src,__tests__}/**/*.{js,ts,tsx}'",

View File

@ -4,6 +4,8 @@ const rimraf = require('rimraf');
const archiver = require('archiver'); const archiver = require('archiver');
const chalk = require('chalk'); const chalk = require('chalk');
const pkg = require('../package.json');
const zip = archiver('zip'); const zip = archiver('zip');
const distPath = path.resolve(__dirname, '..', 'dist'); const distPath = path.resolve(__dirname, '..', 'dist');
const distZipName = 'dist.zip'; const distZipName = 'dist.zip';
@ -26,6 +28,6 @@ rimraf(distZipPath, () => {
console.log(chalk.green(`created ${distZipName} in ${ss}s`)); console.log(chalk.green(`created ${distZipName} in ${ss}s`));
}); });
zip.pipe(outputStream); zip.pipe(outputStream);
zip.directory(distPath, false); zip.directory(distPath, pkg.name);
zip.finalize(); zip.finalize();
}); });