Skip to content

Commit 4589b34

Browse files
authored
Merge pull request #90 from dipiash/release-it-1
build: 📦 update pre-publish script and logic
2 parents 4721b34 + 0b053ea commit 4589b34

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ out
9191
# Nuxt.js build / generate output
9292
.nuxt
9393
dist
94+
assets
9495

9596
# Gatsby files
9697
.cache/

.release-it.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,14 @@
5656
"commitMessage": "chore: release ${version}",
5757
"requireCleanWorkingDir": false
5858
},
59-
"npm": {
60-
"publishPath": "./dist/package",
61-
"release": false
62-
},
59+
"npm": false,
6360
"github": {
6461
"release": true,
65-
"assets": ["dist/*.tgz"]
62+
"assets": ["assets/*.tgz"]
6663
},
6764
"hooks": {
6865
"before:bump": "npm run build",
69-
"after:bump": "npm run release:prepare-toc-in-readme && npm run build-and-pack && git add .",
66+
"after:bump": "npm run release:prepare-toc-in-readme && npm run prepare-publish && git add .",
7067
"after:release": "npm publish"
7168
}
7269
}

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
},
3333
"scripts": {
3434
"init": "npm run clean && npm i",
35-
"build": "rm -rf ./dist && mkdir ./dist && cp -r ./lib/* ./dist",
36-
"pack": "npm run clean:tgz && npm pack --pack-destination=./dist",
37-
"build-and-pack": "npm run build && sh scripts/pack.sh",
35+
"build": "npm run clean:dist && npm run clean:assets && mkdir ./dist && cp -r ./lib/* ./dist",
36+
"pack": "npm run clean:tgz && npm run clean:assets && npm pack --pack-destination=./dist",
37+
"prepare-publish": "npm run pack && sh scripts/prepublish.sh",
3838
"lint": "npm-run-all \"lint:*\"",
3939
"lint:js": "eslint .",
4040
"lint:syncpack": "syncpack list-mismatches",
@@ -43,9 +43,10 @@
4343
"commit": "cz",
4444
"release": "dotenv release-it -- --ci -VV",
4545
"release:prepare-toc-in-readme": "sh scripts/prepareTOCinReadme.sh",
46-
"clean": "npm run clean:node-modules && npm run clean:dist",
46+
"clean": "npm run clean:node-modules && npm run clean:dist && npm run clean:assets",
4747
"clean:node-modules": "rm -rf node_modules",
4848
"clean:dist": "rm -rf dist",
49+
"clean:assets": "rm -rf assets",
4950
"clean:tgz": "rm -rf dist/*.tgz",
5051
"prepare": "husky"
5152
},

scripts/pack.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

scripts/prepublish.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
cd ./dist || exit
2+
tar -xzf ./*.tgz
3+
4+
mkdir ../assets
5+
mv ./*.tgz ../assets/
6+
7+
find . -mindepth 1 ! -path './package' ! -path './package/*' -exec rm -rf {} +
8+
mv ./package/* ./
9+
rm -rf ./package
10+

0 commit comments

Comments
 (0)