Skip to content

Commit ac4b6a9

Browse files
committed
Chore: Remove prepare script before publishing package
* `set-script` works from npm v7 and we are on node v14 and npm v6 * we are removing prepare script with husky install because it is a lifecycle script that is runned before publish * we are publishing from ./dist directory where are no deps installed
1 parent 658c99f commit ac4b6a9

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

.github/workflows/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
run: yarn install --frozen-lockfile
2222

2323
- name: Disable husky commit hooks
24-
run: npm set-script prepare ""
24+
run: yarn remove-prepare
2525

2626
- name: Build
2727
run: yarn build

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
"version": "yarn changelog && yarn replace-version && git status && git add CHANGELOG.md README.md package.json ./dist && git status",
5454
"postversion": "echo 'Check and push: `git push --set-upstream origin main && git push --tags`'",
5555
"release": "yarn version --`./bin/ci/semver.sh`",
56-
"replace-version": "node scripts/readme-replace-version.js"
56+
"replace-version": "node scripts/readme-replace-version.js",
57+
"remove-prepare": "node scripts/remove-prepare.js"
5758
},
5859
"dependencies": {
5960
"@lmc-eu/spirit-design-tokens": "^0.4.0",

scripts/remove-prepare.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
fs = require('fs');
2+
const packageJson = require('../package.json');
3+
4+
delete packageJson.scripts.prepare;
5+
6+
fs.writeFile('package.json', JSON.stringify(packageJson, null, 2), (error) => {
7+
if (error) {
8+
return console.log(err);
9+
}
10+
});

0 commit comments

Comments
 (0)