fix: replace npm pkg set with node script in set-local-version target (#19344)

## Summary

- Replaces `npm pkg set version=X` with a direct `node -e` script in the
`set-local-version` Nx target
- Fixes `CI Create App E2E minimal` workflow failures on fork PRs where
`npm pkg set` fails with `EJSONPARSE: Unexpected end of JSON input while
parsing empty string`

The `npm` command has unreliable `package.json` resolution in certain CI
checkout contexts (shallow clones of fork PR merge refs). Using `node`
directly to read/write the JSON file avoids this entirely.
This commit is contained in:
Charles Bochet 2026-04-05 20:56:37 +02:00 committed by GitHub
parent 265b2582ee
commit f25e040712
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -141,7 +141,7 @@
"cache": false, "cache": false,
"options": { "options": {
"cwd": "{projectRoot}", "cwd": "{projectRoot}",
"command": "npm pkg set version={args.releaseVersion}" "command": "node -e \"const fs=require('fs'),p=JSON.parse(fs.readFileSync('package.json','utf8'));p.version='{args.releaseVersion}';fs.writeFileSync('package.json',JSON.stringify(p,null,2)+'\\n');\""
} }
}, },
"storybook:build": { "storybook:build": {