From 2bd6c7f24ac2fba9bf10e8a064c64e5a95fe84c1 Mon Sep 17 00:00:00 2001 From: penge Date: Sun, 29 Mar 2026 17:15:04 +0700 Subject: [PATCH 1/2] chore: add version bump script Adds npm run bump to update version in package.json, manifest.json, and package-lock.json from a single command. Signed-off-by: penge --- package.json | 3 ++- scripts/bump-version.ts | 27 +++++++++++++++++++++++++++ tsconfig.json | 3 ++- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 scripts/bump-version.ts diff --git a/package.json b/package.json index 81fc2dbf..2c61cc6c 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "test": "LOG_LEVEL=SILENT TZ=UTC jest --maxWorkers=4", "develop": "npm run __prepare-folder-develop && npm run __develop-core", "develop-watch": "npm run develop && chokidar \"src/**/*.(ts|tsx|json)\" \"public/**/*.(html|css)\" -c \"[[ {path} == src* ]] && npm run __develop-core;[[ {path} == public* ]] && copyup {path} dist\"", - "build": "npm run __prepare-folder && npm run __check-types && NODE_ENV=production node --import ./register.js ./build.ts" + "build": "npm run __prepare-folder && npm run __check-types && NODE_ENV=production node --import ./register.js ./build.ts", + "bump": "node --import ./register.js scripts/bump-version.ts" }, "devDependencies": { "@jest/types": "^29.6.3", diff --git a/scripts/bump-version.ts b/scripts/bump-version.ts new file mode 100644 index 00000000..30be1fd3 --- /dev/null +++ b/scripts/bump-version.ts @@ -0,0 +1,27 @@ +import fs from "fs"; +import { execSync } from "child_process"; + +const version = process.argv[2]; +if (!version || !/^\d+\.\d+\.\d+$/.test(version)) { + console.error("Usage: bump-version.ts "); + process.exit(1); +} + +const packageJson = JSON.parse(fs.readFileSync("package.json", "utf8")); +packageJson.version = version; +fs.writeFileSync("package.json", `${JSON.stringify(packageJson, null, 2)}\n`); + +const manifestJson = JSON.parse(fs.readFileSync("manifest.json", "utf8")); +manifestJson.version = version; +fs.writeFileSync("manifest.json", `${JSON.stringify(manifestJson, null, 2)}\n`); + +execSync("npm install", { stdio: "inherit" }); + +const lockfileVersion = JSON.parse(fs.readFileSync("package-lock.json", "utf8")).version; + +if (lockfileVersion !== version) { + console.error(`package-lock.json version is ${lockfileVersion}, expected ${version}`); + process.exit(1); +} + +console.log(`My Notes updated to ${version}`); diff --git a/tsconfig.json b/tsconfig.json index d8ac2008..2fd8f05b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,8 @@ "./jest.config.ts", "./jest.setup.ts", "./register.js", - "./build.ts" + "./build.ts", + "./scripts/**/*" ], "compilerOptions": { From a5262366eb26298213d2470b5bbc511ef6ce6aee Mon Sep 17 00:00:00 2001 From: penge Date: Sun, 29 Mar 2026 20:11:24 +0700 Subject: [PATCH 2/2] chore: add set-version script Adds npm run set-version to update version in package.json, manifest.json, and package-lock.json from a single command. Signed-off-by: penge --- package.json | 2 +- scripts/{bump-version.ts => set-version.ts} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename scripts/{bump-version.ts => set-version.ts} (93%) diff --git a/package.json b/package.json index 2c61cc6c..ef8b9a08 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "develop": "npm run __prepare-folder-develop && npm run __develop-core", "develop-watch": "npm run develop && chokidar \"src/**/*.(ts|tsx|json)\" \"public/**/*.(html|css)\" -c \"[[ {path} == src* ]] && npm run __develop-core;[[ {path} == public* ]] && copyup {path} dist\"", "build": "npm run __prepare-folder && npm run __check-types && NODE_ENV=production node --import ./register.js ./build.ts", - "bump": "node --import ./register.js scripts/bump-version.ts" + "set-version": "node --import ./register.js scripts/set-version.ts" }, "devDependencies": { "@jest/types": "^29.6.3", diff --git a/scripts/bump-version.ts b/scripts/set-version.ts similarity index 93% rename from scripts/bump-version.ts rename to scripts/set-version.ts index 30be1fd3..d608831e 100644 --- a/scripts/bump-version.ts +++ b/scripts/set-version.ts @@ -3,7 +3,7 @@ import { execSync } from "child_process"; const version = process.argv[2]; if (!version || !/^\d+\.\d+\.\d+$/.test(version)) { - console.error("Usage: bump-version.ts "); + console.error("Usage: set-version.ts "); process.exit(1); }