Skip to content

Commit 6d86adc

Browse files
committed
fix(build): make version-bump portable and bump the lock file too
Two problems, both found by trying to run it. `sed -i "s/..."` is GNU-only. BSD sed, which is what macOS ships, reads the next argument as the backup suffix, so it consumed the expression and then treated the filename as the script: sed: 1: "indexer/chart/Chart.yaml": unescaped newline inside substitute pattern `sed -i.bak ... && rm -f ...bak` works on both, so the target now runs anywhere rather than only on Linux. It also never touched package-lock.json, so the lock file kept the previous version while package.json moved on — 2.12.3 against 2.13.0 after this bump, and drifting a little further every release. `npm ci` tolerates it, because it only validates dependency resolution and not the root package's own version, which is why nothing has complained so far. Now bumped alongside package.json, both the top-level version and packages[""].version, in the same jq style the target already used. Behaviour is otherwise unchanged, and deliberately still local only: it creates a branch and a commit and never pushes.
1 parent b81efc3 commit 6d86adc

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# usage: > type=patch make version-bump
44
# usage: > type=minor make version-bump
55
# usage: > type=major make version-bump
6+
#
7+
# Local only: this creates a branch and a commit, and never pushes. Review the
8+
# result, then push and open a PR yourself.
69
version-bump:
710
set -e; \
811
if [ "$(type)" = "patch" ] || [ "$(type)" = "minor" ] || [ "$(type)" = "major" ]; then \
@@ -13,9 +16,10 @@ version-bump:
1316
branch_name="$$default_branch-bump-version-to-$$new_version"; \
1417
git checkout -b $$branch_name; \
1518
jq ".version = \"$$new_version\"" package.json > temp.json && mv temp.json package.json; \
16-
sed -i "s/^appVersion: .*/appVersion: '$$new_version'/" indexer/chart/Chart.yaml; \
17-
sed -i "s/^appVersion: .*/appVersion: '$$new_version'/" processor-chart/Chart.yaml; \
18-
git add processor-chart/Chart.yaml indexer/chart/Chart.yaml package.json ; \
19+
jq ".version = \"$$new_version\" | .packages[\"\"].version = \"$$new_version\"" package-lock.json > temp.json && mv temp.json package-lock.json; \
20+
sed -i.bak "s/^appVersion: .*/appVersion: '$$new_version'/" indexer/chart/Chart.yaml && rm -f indexer/chart/Chart.yaml.bak; \
21+
sed -i.bak "s/^appVersion: .*/appVersion: '$$new_version'/" processor-chart/Chart.yaml && rm -f processor-chart/Chart.yaml.bak; \
22+
git add processor-chart/Chart.yaml indexer/chart/Chart.yaml package.json package-lock.json ; \
1923
git commit -m "Bump version to $$new_version"; \
2024
else \
2125
echo "Invalid version type. Please use patch, minor, or major."; \

0 commit comments

Comments
 (0)