Skip to content

Commit 746cc8d

Browse files
authored
chore: zip dist dir (#18)
* chore: zip dist dir * chore: ignore dist.zip
1 parent f13bbdf commit 746cc8d

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ jobs:
3030
run: npm run ci
3131

3232
- name: Semantic Release
33-
run: npm run build && npm run semantic-release
33+
run: npm run build && npm run build:zip && npm run semantic-release
3434
env:
3535
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
# production
1111
/dist
12+
dist.zip
1213

1314
# misc
1415
.DS_Store

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
"scripts": {
88
"dev": "umi dev",
99
"build": "umi build",
10+
"build:zip": "node ./scripts/zip.js",
11+
"ci": "npm run test",
1012
"postinstall": "umi generate tmp",
1113
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
12-
"ci": "npm run test",
1314
"test": "umi-test",
1415
"test:coverage": "umi-test --coverage",
1516
"semantic-release": "semantic-release"
@@ -48,7 +49,7 @@
4849
"@semantic-release/github",
4950
{
5051
"assets": {
51-
"path": "dist",
52+
"path": "dist.zip",
5253
"label": "Assets Distribution"
5354
},
5455
"addReleases": "bottom"
@@ -78,6 +79,7 @@
7879
"@umijs/preset-react": "1.x",
7980
"@umijs/test": "^3.5.20",
8081
"ahooks": "^3.1.3",
82+
"compressing": "^1.5.1",
8183
"dayjs": "^1.10.7",
8284
"egg-ci": "^1.19.0",
8385
"lint-staged": "^10.0.7",

scripts/zip.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const path = require('path');
2+
const compressing = require('compressing');
3+
4+
const source = path.resolve(__dirname, '../dist');
5+
const target = path.resolve(__dirname, '../dist.zip');
6+
7+
const run = async () => {
8+
try {
9+
await compressing.zip.compressDir(source, target);
10+
console.log('compressing:zip:done');
11+
} catch (error) {
12+
console.log(error);
13+
}
14+
};
15+
16+
run();

0 commit comments

Comments
 (0)