-
Notifications
You must be signed in to change notification settings - Fork 17
release: adopt package.json semver as canonical version #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| labels: | ||
| - name: release:minor | ||
| color: "1d76db" | ||
| description: "Release should bump minor version" | ||
| - name: release:patch | ||
| color: "0e8a16" | ||
| description: "Release should bump patch version" | ||
| - name: release:none | ||
| color: "6e7781" | ||
| description: "Release should not cut a version" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #!/bin/bash | ||
| # Shared version helpers for Baudbot shell scripts. | ||
|
|
||
| bb_package_json_path() { | ||
| local root="${1:?repo root required}" | ||
| echo "$root/package.json" | ||
| } | ||
|
|
||
| bb_package_lock_json_path() { | ||
| local root="${1:?repo root required}" | ||
| echo "$root/package-lock.json" | ||
| } | ||
|
|
||
| bb_package_version() { | ||
| local root="${1:?repo root required}" | ||
| local package_json="" | ||
|
|
||
| package_json="$(bb_package_json_path "$root")" | ||
| [ -r "$package_json" ] || return 1 | ||
|
|
||
| json_get_string "$package_json" "version" | ||
| } | ||
|
Comment on lines
+14
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Prompt To Fix With AIThis is a comment left during a code review.
Path: bin/lib/version-common.sh
Line: 14-22
Comment:
**Undocumented dependency on `json_get_string` from `json-common.sh`**
`bb_package_version` calls `json_get_string`, which is defined in `bin/lib/json-common.sh` and not in this file. All current callers (`deploy.sh`, `update-release.sh`, `baudbot`, the test file) correctly source `json-common.sh` first, but there is no declaration of this requirement in `version-common.sh` itself. A sourcing guard or a comment at the top noting the prerequisite would prevent subtle breakage if this helper is ever sourced in a new context without the dependency.
How can I resolve this? If you propose a fix, please make it concise. |
||
|
|
||
| bb_package_version_or_unknown() { | ||
| local root="${1:?repo root required}" | ||
| bb_package_version "$root" 2>/dev/null || echo "unknown" | ||
| } | ||
|
|
||
| bb_release_tag_for_version() { | ||
| local version="${1:?version required}" | ||
| echo "v$version" | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"vunknown"written into metadata JSON when version is unavailableWhen neither the git repo nor an existing
$RELEASE_META_FILEprovides a version (e.g., a freshly checked-out archive with nopackage.json),RELEASE_VERSIONis set to"unknown". The subsequentbb_release_tag_for_version "unknown"call then writes"tag": "vunknown"intobaudbot-version.json. Tools or operators parsing the tag field for semver validity would receive an unexpected value. Guarding thebb_release_tag_for_versioncall to only run whenRELEASE_VERSIONis not"unknown"would be more consistent.Prompt To Fix With AI