From 53a0ebe6a6c2e39b309a357aae60881a1d63d7ce Mon Sep 17 00:00:00 2001 From: "954270063@qq.com" <954270063@qq.com> Date: Sun, 30 May 2021 23:19:40 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9=20dist.zip=20?= =?UTF-8?q?=E8=A7=A3=E5=8E=8B=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .husky/pre-commit | 2 ++ package.json | 2 +- scripts/{dist.zip.js => zip.js} | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) rename scripts/{dist.zip.js => zip.js} (91%) diff --git a/.husky/pre-commit b/.husky/pre-commit index ce498b1..8f55523 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,6 +1,8 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" +# pkgName=$(cat ../package.json .name | sed 's/\"//g') + yarn build:zip git add dist.zip yarn lint-staged diff --git a/package.json b/package.json index 8a86c3b..d1cda7d 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "scripts": { "build": "rollup --config", - "build:zip": "yarn build && node scripts/dist.zip.js", + "build:zip": "yarn build && node scripts/zip.js", "test": "jest --passWithNoTests", "lint": "eslint", "format": "prettier --check --write '{src,__tests__}/**/*.{js,ts,tsx}'", diff --git a/scripts/dist.zip.js b/scripts/zip.js similarity index 91% rename from scripts/dist.zip.js rename to scripts/zip.js index bc36381..181cfe1 100644 --- a/scripts/dist.zip.js +++ b/scripts/zip.js @@ -4,6 +4,8 @@ const rimraf = require('rimraf'); const archiver = require('archiver'); const chalk = require('chalk'); +const pkg = require('../package.json'); + const zip = archiver('zip'); const distPath = path.resolve(__dirname, '..', 'dist'); const distZipName = 'dist.zip'; @@ -26,6 +28,6 @@ rimraf(distZipPath, () => { console.log(chalk.green(`created ${distZipName} in ${ss}s`)); }); zip.pipe(outputStream); - zip.directory(distPath, false); + zip.directory(distPath, pkg.name); zip.finalize(); });