Skip to content

Commit 7be6a7d

Browse files
committed
move version script to javascript
1 parent 67003be commit 7be6a7d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"format": "biome format",
2323
"check": "biome check",
2424
"prepare": "husky",
25-
"version": "npm version $npm_package_version --workspaces --git-tag-version false --ignore-scripts && git add '**/package.json'",
25+
"version": "node scripts/versionAllPackages.mts",
2626
"publish": "npm run publish --workspaces"
2727
},
2828
"devDependencies": {

scripts/versionAllPackages.mts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Cross environment script to update all package.json versions in a monorepo
2+
// A port of the following bash script:
3+
// npm version $npm_package_version --workspaces --git-tag-version false --ignore-scripts && git add '**/package.json'
4+
5+
import { execSync } from 'node:child_process';
6+
7+
const packages = ['tanstack-query-builder', 'tanstack-query-builder-example-mocks'];
8+
9+
const version = process.env.npm_package_version;
10+
const cwd = process.cwd();
11+
12+
execSync(`npm version ${version} --workspaces --git-tag-version false --ignore-scripts`, { cwd });
13+
execSync(`npm update --save --workspaces ${packages.join(' ')}`, { cwd });
14+
execSync(`git add "**/package.json"`, { cwd });

0 commit comments

Comments
 (0)