Skip to content

Commit

Permalink
fix(ci): simplify publish a bit and use prepack instead of postinstall
Browse files Browse the repository at this point in the history
  • Loading branch information
bericp1 committed Apr 5, 2019
1 parent 0e23280 commit 39a5d42
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ re-usable library on npm.
- Jest for unit testing
- Precommit linting
- Precommit formatting via [Prettier](https://prettier.io)
- Prepublish TypeScript build for distribution on npm
- Prepare script for TypeScript build for distribution on npm
- Prepack build command for TypeScript build to allow installation direct from GitHub
- Ready-to-use GitHub Actions workflow for releasing on push to `master`

## Using this Template
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"release": "yarn run semantic-release",
"release-ci": "echo 'unsafe-perm = true' > ./.npmrc && yarn run semantic-release && rm -rf ./.npmrc",
"commit": "git-cz",
"postinstall": "yarn run build && echo 'Postinstall build command is replaced with prepublishOnly during semantic-release publish prep.'"
"prepack": "yarn --ignore-scripts && yarn run build && echo 'Prepack dev build command is removed during semantic-release publish prep.'"
},
"repository": "https://bitbucket.org/Carimus/carimus-node-ts-package-template",
"author": "Carimus",
Expand Down
7 changes: 5 additions & 2 deletions scripts/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

set -e

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

# Pretty up the package.json so it's still consistent with the codebase's code style
prettier --write package.json

# Run the build to get ./dist output
yarn run build

0 comments on commit 39a5d42

Please sign in to comment.