Skip to content

Commit bc73411

Browse files
committed
fix
1 parent 3e84cfb commit bc73411

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed
+28-30
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
1-
// import { URL } from "url";
2-
// import { readFileSync, writeFileSync } from "fs";
1+
import { URL } from "url";
2+
import { readFileSync, writeFileSync } from "fs";
33

4-
// const versionFilePath = new URL(
5-
// "../../common/version/version.go",
6-
// import.meta.url
7-
// ).pathname;
4+
const versionFilePath = new URL(
5+
"../../params/version.go",
6+
import.meta.url
7+
).pathname;
88

9-
// const versionFileContent = readFileSync(versionFilePath, { encoding: "utf-8" });
9+
const versionFileContent = readFileSync(versionFilePath, { encoding: "utf-8" });
1010

11-
// const currentVersion = versionFileContent.match(
12-
// /var tag = "(?<version>v(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+))"/
13-
// );
11+
const currentVersionPatch = versionFileContent.match(
12+
/VersionPatch = (?<patch>\d+)/
13+
).groups.patch;
1414

15-
// try {
16-
// parseInt(currentVersion.groups.major);
17-
// parseInt(currentVersion.groups.minor);
18-
// parseInt(currentVersion.groups.patch);
19-
// } catch (err) {
20-
// console.error(new Error("Failed to parse version in version.go file"));
21-
// throw err;
22-
// }
15+
try {
16+
parseInt(currentVersionPatch);
17+
} catch (err) {
18+
console.error(new Error("Failed to parse version in version.go file"));
19+
throw err;
20+
}
2321

24-
// // prettier-ignore
25-
// const newVersion = `v${currentVersion.groups.major}.${currentVersion.groups.minor}.${parseInt(currentVersion.groups.patch) + 1}`;
22+
// prettier-ignore
23+
const newVersionPatch = `${parseInt(currentVersionPatch) + 1}`;
2624

27-
// console.log(
28-
// `Bump version from ${currentVersion.groups.version} to ${newVersion}`
29-
// );
25+
console.log(
26+
`Bump version from ${currentVersionPatch} to ${newVersionPatch}`
27+
);
3028

31-
// writeFileSync(
32-
// versionFilePath,
33-
// versionFileContent.replace(
34-
// `var tag = "${currentVersion.groups.version}"`,
35-
// `var tag = "${newVersion}"`
36-
// )
37-
// );
29+
writeFileSync(
30+
versionFilePath,
31+
versionFileContent.replace(
32+
`VersionPatch = ${currentVersionPatch}`,
33+
`VersionPatch = ${newVersionPatch}`
34+
)
35+
);

0 commit comments

Comments
 (0)