Skip to content

Commit

Permalink
fix: build typescript in prepublish scripts
Browse files Browse the repository at this point in the history
This fixes the problem that the cli gets built before semantic-releaser updates the version. Because of this the released `0.1.0` shows `0.0.1` when running `nodecg-io --version` because it was built with that version which copies the `package.json` into the `build` directory. Then semantic-release updates the version and the copied `package.json` isn't updated.

With this change we don't build the cli in a ci step anymore, but with the npm `prepublish` hook. That way semantic-release will bump the version and run `npm publish` which will then build the cli with the update version.
  • Loading branch information
hlxid committed May 8, 2021
1 parent fd2e0ed commit c34334c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ jobs:

- name: Install dependencies
run: npm ci
- name: Build
run: npm run build

- name: Release
env:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"format": "prettier --write \"./**/*.{ts,json,md,js}\"",
"format-pre-commit": "pretty-quick --staged --pattern '*/**/*.{ts,json,md,js}'",
"prepare": "husky install",
"semantic-release": "semantic-release"
"semantic-release": "semantic-release",
"prepublish": "npm run build"
},
"bin": {
"nodecg-io": "index.js"
Expand Down

0 comments on commit c34334c

Please sign in to comment.