Skip to content

Commit bf87a72

Browse files
committed
chore: update
1 parent 52f1d8c commit bf87a72

File tree

4 files changed

+46
-10
lines changed

4 files changed

+46
-10
lines changed

.pnpmfile.cjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
hooks: {
3+
readPackage: (pkg) => {
4+
if (pkg.name === 'zx') {
5+
// zx use "@types/node": ">=20" as optionalDependencies, which may bring some unexpected updates in other packages
6+
delete pkg.optionalDependencies['@types/node'];
7+
}
8+
return pkg;
9+
},
10+
},
11+
};

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"changeset": "changeset",
1414
"check-dependency-version": "check-dependency-version-consistency .",
1515
"check-spell": "pnpx cspell",
16-
"generate-release-pr": "npx zx scripts/generateReleasePr.mjs",
16+
"generate-release-pr": "zx scripts/generateReleasePr.mjs",
1717
"lint": "biome check . --diagnostic-level=warn && pnpm run check-spell",
1818
"prebundle": "nx run-many -t prebundle",
1919
"prepare": "pnpm run build && simple-git-hooks",
@@ -55,7 +55,8 @@
5555
"prettier-plugin-packagejson": "^2.5.3",
5656
"simple-git-hooks": "^2.11.1",
5757
"typescript": "^5.6.3",
58-
"vitest": "^2.1.2"
58+
"vitest": "^2.1.2",
59+
"zx": "^8.1.9"
5960
},
6061
"packageManager": "[email protected]",
6162
"engines": {

pnpm-lock.yaml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/generateReleasePr.mjs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22

33
import fs from 'node:fs/promises';
44
import path from 'node:path';
5+
import { parseArgs } from 'node:util';
56
import { $, chalk } from 'zx';
67

7-
// Exit when error
88
$.verbose = false;
99

10-
const args = process.argv.slice(2);
11-
const bumpTypeArgs = args.find((arg) => arg.startsWith('--type='));
12-
1310
async function getCurrentVersion() {
1411
const packageJsonPath = path.join(
1512
process.cwd(),
@@ -56,20 +53,33 @@ async function main() {
5653
const currentVersion = await getCurrentVersion();
5754
console.log(chalk.blue(`Current version: ${currentVersion}`));
5855

59-
// 2. Determine bump type
60-
const bumpType = bumpTypeArgs ? bumpTypeArgs.split('=')[1] : 'patch';
56+
// 2. Determine bump type and next release version
57+
const options = {
58+
type: {
59+
type: 'string',
60+
short: 't',
61+
default: 'patch',
62+
},
63+
};
64+
const args = process.argv.slice(3);
65+
const { values } = parseArgs({ args, options });
66+
67+
const bumpType = values.type;
6168

6269
if (!['major', 'minor', 'patch'].includes(bumpType)) {
6370
console.error('Invalid bump type. Please select major, minor, or patch.');
6471
process.exit(1);
6572
}
6673

74+
console.log(chalk.blue(`Bump type: ${bumpType}`));
75+
6776
const nextVersion = await getNextVersion(currentVersion, bumpType);
68-
const branchName = `release-v${nextVersion}`;
77+
console.log(chalk.blue(`Next version: ${nextVersion}`));
6978

79+
// 3. Create and switch to new branch
80+
const branchName = `release-v${nextVersion}`;
7081
console.log(chalk.blue(`Creating branch: ${branchName}`));
7182

72-
// 3. Create and switch to new branch
7383
await $`git checkout -b ${branchName}`;
7484

7585
// 4. Generate changeset file

0 commit comments

Comments
 (0)