Use util.parseArgs in changelog-for-patch.js script (#17324)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-04-08 10:11:38 +08:00
1 parent f86012fa23
commit 1ec1e58b06
2 files changed
+11 -7

No files matched your search

+11 -6
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env node
import path from "node:path";
import minimist from "minimist";
import { parseArgs } from "node:util";
import semver from "semver";
import {
categories,
@@ -12,7 +12,7 @@ import {
replaceVersions,
} from "./utils/changelog.js";
const { previousVersion, newVersion } = parseArgv();
const { previousVersion, newVersion } = parseArguments();
const entries = changelogUnreleasedDirs.flatMap((dir) => {
const dirPath = path.join(changelogUnreleasedDirPath, dir.name);
@@ -34,10 +34,15 @@ console.log(
),
);
function parseArgv() {
const argv = minimist(process.argv.slice(2));
const previousVersion = argv["prev-version"];
const newVersion = argv["new-version"];
function parseArguments() {
const {
values: { "prev-version": previousVersion, "new-version": newVersion },
} = parseArgs({
options: {
"prev-version": { type: "string" },
"new-version": { type: "string" },
},
});
if (
!previousVersion ||
!newVersion ||