Skip to content

Commit 39a5d42

Browse files
committed
fix(ci): simplify publish a bit and use prepack instead of postinstall
1 parent 0e23280 commit 39a5d42

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ re-usable library on npm.
88
- Jest for unit testing
99
- Precommit linting
1010
- Precommit formatting via [Prettier](https://prettier.io)
11-
- Prepublish TypeScript build for distribution on npm
11+
- Prepare script for TypeScript build for distribution on npm
12+
- Prepack build command for TypeScript build to allow installation direct from GitHub
1213
- Ready-to-use GitHub Actions workflow for releasing on push to `master`
1314

1415
## Using this Template

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"release": "yarn run semantic-release",
1616
"release-ci": "echo 'unsafe-perm = true' > ./.npmrc && yarn run semantic-release && rm -rf ./.npmrc",
1717
"commit": "git-cz",
18-
"postinstall": "yarn run build && echo 'Postinstall build command is replaced with prepublishOnly during semantic-release publish prep.'"
18+
"prepack": "yarn --ignore-scripts && yarn run build && echo 'Prepack dev build command is removed during semantic-release publish prep.'"
1919
},
2020
"repository": "https://bitbucket.org/Carimus/carimus-node-ts-package-template",
2121
"author": "Carimus",

scripts/prepare.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
set -e
44

5-
# Update the package.json to place the build command in prepublishOnly instead of in postinstall
6-
json -I -f package.json -e 'this.scripts.prepublishOnly = "yarn run build"; delete this.scripts.postinstall;'
5+
# Update the package.json to remove prepack command.
6+
json -I -f package.json -e 'delete this.scripts.prepack;'
77

88
# Pretty up the package.json so it's still consistent with the codebase's code style
99
prettier --write package.json
10+
11+
# Run the build to get ./dist output
12+
yarn run build

0 commit comments

Comments
 (0)