Skip to content

build: 📦 update pre-publish script and logic #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ out
# Nuxt.js build / generate output
.nuxt
dist
assets

# Gatsby files
.cache/
Expand Down
9 changes: 3 additions & 6 deletions .release-it.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,14 @@
"commitMessage": "chore: release ${version}",
"requireCleanWorkingDir": false
},
"npm": {
"publishPath": "./dist/package",
"release": false
},
"npm": false,
"github": {
"release": true,
"assets": ["dist/*.tgz"]
"assets": ["assets/*.tgz"]
},
"hooks": {
"before:bump": "npm run build",
"after:bump": "npm run release:prepare-toc-in-readme && npm run build-and-pack && git add .",
"after:bump": "npm run release:prepare-toc-in-readme && npm run prepare-publish && git add .",
"after:release": "npm publish"
}
}
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
},
"scripts": {
"init": "npm run clean && npm i",
"build": "rm -rf ./dist && mkdir ./dist && cp -r ./lib/* ./dist",
"pack": "npm run clean:tgz && npm pack --pack-destination=./dist",
"build-and-pack": "npm run build && sh scripts/pack.sh",
"build": "npm run clean:dist && npm run clean:assets && mkdir ./dist && cp -r ./lib/* ./dist",
"pack": "npm run clean:tgz && npm run clean:assets && npm pack --pack-destination=./dist",
"prepare-publish": "npm run pack && sh scripts/prepublish.sh",
"lint": "npm-run-all \"lint:*\"",
"lint:js": "eslint .",
"lint:syncpack": "syncpack list-mismatches",
Expand All @@ -43,9 +43,10 @@
"commit": "cz",
"release": "dotenv release-it -- --ci -VV",
"release:prepare-toc-in-readme": "sh scripts/prepareTOCinReadme.sh",
"clean": "npm run clean:node-modules && npm run clean:dist",
"clean": "npm run clean:node-modules && npm run clean:dist && npm run clean:assets",
"clean:node-modules": "rm -rf node_modules",
"clean:dist": "rm -rf dist",
"clean:assets": "rm -rf assets",
"clean:tgz": "rm -rf dist/*.tgz",
"prepare": "husky"
},
Expand Down
4 changes: 0 additions & 4 deletions scripts/pack.sh

This file was deleted.

10 changes: 10 additions & 0 deletions scripts/prepublish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cd ./dist || exit
tar -xzf ./*.tgz

mkdir ../assets
mv ./*.tgz ../assets/

find . -mindepth 1 ! -path './package' ! -path './package/*' -exec rm -rf {} +
mv ./package/* ./
rm -rf ./package