From a14220b19113ac69df5dd7a02613e7305d419df8 Mon Sep 17 00:00:00 2001 From: Kyzgor Date: Sun, 8 Mar 2026 23:57:08 +0000 Subject: [PATCH] fix(ci): replace sed version bump with npm version to prevent script corruption The CI workflow used `sed -i "s/\"version\": \".*\"/.../"` to bump the version in package.json before publishing. This greedy regex matched every `"version": "..."` pattern in the file, including the `version` script in the `scripts` block, corrupting it from `"standard-version"` to the release version string. Replace sed with `npm version --no-git-tag-version --allow-same-version` which safely modifies only the top-level `version` field. Also restore the corrupted `version` script to its original value. Fixes #89 --- .github/workflows/node_sdk_publish.yaml | 4 +--- package.json | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/node_sdk_publish.yaml b/.github/workflows/node_sdk_publish.yaml index 7f03e5f..c95e3e1 100644 --- a/.github/workflows/node_sdk_publish.yaml +++ b/.github/workflows/node_sdk_publish.yaml @@ -82,9 +82,7 @@ jobs: -H 'Authorization: Bearer ${{ secrets.PROJECT_API_KEY }}' - name: Bump version at package.json - run: | - sed -i "s/\"version\": \".*\"/\"version\": \"${{ github.event.release.tag_name }}\"/" package.json - cat package.json + run: npm version "${{ github.event.release.tag_name }}" --no-git-tag-version --allow-same-version --ignore-scripts - name: Publish package to NPM run: | diff --git a/package.json b/package.json index c8efff7..c285f68 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "cov:check": "nyc report && nyc check-coverage --lines 100 --functions 100 --branches 100", "docs": "typedoc", "docs:watch": "typedoc --watch", - "version": "2.5.2", + "version": "standard-version", "reset-hard": "git clean -dfx && git reset --hard && yarn", "prepare": "npm run build && husky install", "prepare-release": "run-s reset-hard test cov:check doc:html version doc:publish",