fix: dynamically increment prerelease versions in publish.sh#1932
Conversation
3b5481e to
e1aa47a
Compare
There was a problem hiding this comment.
Code Review
This pull request updates the prerelease versioning logic in scripts/publish.sh to check npm for existing prerelease versions in the target range and increment them if found, rather than always starting from the stable version. The reviewer noted that parsing the raw output of npm view with tail and grep is fragile and prone to errors due to output formatting variations, sorting assumptions, and a hardcoded regex. They suggested a more robust approach using Node.js and the semver package to parse the JSON output safely.
8ebf2f0 to
2a51ea7
Compare
02c8818 to
aa1e63c
Compare
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
aa1e63c to
1f125ce
Compare
1f125ce to
b9b7258
Compare
|
Running the script as if it were the builder locally using BUILD_ID=test ./scripts/publish.sh (and not using --no-dry-run) now shows the correct prerelease incrementing |
Description
Fixes an issue in
scripts/publish.shwhere prerelease publishing (e.g. running with--prerelease) would fail ifrc.0was already published on npm for that target version series, since it always bumped from the stable version. It now dynamically checks npm for any existing prerelease versions of the target version series, and performs aprereleaseincrement (e.g., torc.1) if one exists.Newly assumes the jq command exists to avoid silly node scripts (will need to test in prod or build a new container). Now handles gh not existing since it didn't in the past.
Release Notes
relnote: chore: improve release script