fix(build): add macOS compatibility for sed command (#378)

* fix(build): add macOS compatibility for sed command

Handle platform-specific sed syntax for both macOS and Linux when updating package.json version.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Update sed syntax comment for cross-platform compatibility

Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>

---------

Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: MadDogOwner <xiaoran@xrgzs.top>
This commit is contained in:
Jealous
2026-02-16 22:46:06 +08:00
committed by GitHub
parent be013b5efb
commit f62e6cf6e3

View File

@@ -123,7 +123,12 @@ fallback_git_tag() {
# Update package.json version
update_package_version() {
if [[ "$BUILD_TYPE" == "dev" ]]; then
# Handle both BSD and GNU sed syntax
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "s/\"version\": *\"[^\"]*\"/\"version\": \"${git_version_clean}\"/" package.json
else
sed -i "s/\"version\": *\"[^\"]*\"/\"version\": \"${git_version_clean}\"/" package.json
fi
log_success "Package.json version updated to ${git_version_clean}"
version_tag="v${git_version_clean}-${commit}"
log_build "Building DEV version ${version_tag}..."