Skip to content

Commit 8376544

Browse files
committed
add version bump script and release workflow
- Add `bun run bump [major|minor|patch]` to increment version - Updates both package.json and manifest.json - Add `bun run release` for one-command bump + package - Bump to v1.0.1 for Chrome Web Store reupload
1 parent c4e368d commit 8376544

3 files changed

Lines changed: 62 additions & 6 deletions

File tree

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "threadmark",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"module": "index.ts",
55
"type": "module",
66
"license": "MIT",
@@ -12,7 +12,9 @@
1212
"scripts": {
1313
"build": "bun run scripts/build.ts",
1414
"dev": "bun run scripts/build.ts --watch",
15+
"bump": "bun run scripts/bump.ts",
1516
"package": "bun run scripts/build.ts && bun run scripts/package.ts",
17+
"release": "bun run scripts/bump.ts patch && bun run package",
1618
"check": "biome check .",
1719
"fix": "biome check --write .",
1820
"typecheck": "tsc --noEmit"

scripts/bump.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { readFile, writeFile } from "node:fs/promises";
2+
3+
const args = process.argv.slice(2);
4+
const validTypes = ["major", "minor", "patch"] as const;
5+
type BumpType = (typeof validTypes)[number];
6+
7+
const bumpType = (args[0] as BumpType) || "patch";
8+
9+
if (!validTypes.includes(bumpType)) {
10+
console.error(`Usage: bun run bump [major|minor|patch]`);
11+
console.error(` major: 1.0.0 -> 2.0.0`);
12+
console.error(` minor: 1.0.0 -> 1.1.0`);
13+
console.error(` patch: 1.0.0 -> 1.0.1 (default)`);
14+
process.exit(1);
15+
}
16+
17+
function bumpVersion(version: string, type: BumpType): string {
18+
const [major, minor, patch] = version.split(".").map(Number);
19+
20+
switch (type) {
21+
case "major":
22+
return `${major + 1}.0.0`;
23+
case "minor":
24+
return `${major}.${minor + 1}.0`;
25+
case "patch":
26+
return `${major}.${minor}.${patch + 1}`;
27+
}
28+
}
29+
30+
// Read and update package.json
31+
const pkgPath = "package.json";
32+
const pkg = JSON.parse(await readFile(pkgPath, "utf-8"));
33+
const oldVersion = pkg.version;
34+
const newVersion = bumpVersion(oldVersion, bumpType);
35+
pkg.version = newVersion;
36+
await writeFile(pkgPath, `${JSON.stringify(pkg, null, "\t")}\n`);
37+
38+
// Read and update manifest.json
39+
const manifestPath = "src/manifest.json";
40+
const manifest = JSON.parse(await readFile(manifestPath, "utf-8"));
41+
manifest.version = newVersion;
42+
await writeFile(manifestPath, `${JSON.stringify(manifest, null, "\t")}\n`);
43+
44+
console.log(`Bumped version: ${oldVersion} -> ${newVersion}`);

src/manifest.json

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
{
22
"manifest_version": 3,
33
"name": "Threadmark",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"description": "Bookmark, highlight, and organize specific text snippets within ChatGPT conversations. Never lose a golden answer again.",
6-
"permissions": ["activeTab", "sidePanel", "storage"],
7-
"host_permissions": ["*://*.chatgpt.com/*"],
6+
"permissions": [
7+
"activeTab",
8+
"sidePanel",
9+
"storage"
10+
],
11+
"host_permissions": [
12+
"*://*.chatgpt.com/*"
13+
],
814
"background": {
915
"service_worker": "background.js"
1016
},
@@ -19,8 +25,12 @@
1925
},
2026
"content_scripts": [
2127
{
22-
"matches": ["*://*.chatgpt.com/*"],
23-
"js": ["features/capture/content.js"]
28+
"matches": [
29+
"*://*.chatgpt.com/*"
30+
],
31+
"js": [
32+
"features/capture/content.js"
33+
]
2434
}
2535
]
2636
}

0 commit comments

Comments
 (0)