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(); });