Skip to content

Commit e7a2720

Browse files
committed
feat: add version sync check between package.json and manifest.json
style: format json and typescript files
1 parent d734671 commit e7a2720

File tree

4 files changed

+140
-75
lines changed

4 files changed

+140
-75
lines changed

.husky/pre-commit

+5
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@ if ! bun run lint:staged; then
1818
exit 1
1919
fi
2020

21+
if ! bun run check-version-sync; then
22+
echo "Version sync check failed"
23+
exit 1
24+
fi
25+
2126
# TODO: config this for other extensions too

extensions/chrome/package.json

+78-74
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,80 @@
11
{
2-
"name": "thinking-claude",
3-
"version": "3.2.2",
4-
"description": "Chrome extension for letting Claude think like a real human",
5-
"type": "module",
6-
"scripts": {
7-
"watch": "webpack --config webpack/webpack.dev.js --watch",
8-
"build": "webpack --config webpack/webpack.prod.js",
9-
"start": "webpack serve --config webpack/webpack.dev.js",
10-
"test": "bun test",
11-
"test:watch": "bun test --watch",
12-
"lint": "eslint .",
13-
"lint:fix": "eslint . --fix",
14-
"lint:staged": "lint-staged",
15-
"lint:types": "tsc --noEmit",
16-
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,css,md}\"",
17-
"format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,json,css,md}\"",
18-
"fix": "bun run format && bun run lint:fix",
19-
"type-check": "tsc --noEmit"
20-
},
21-
"dependencies": {
22-
"@radix-ui/react-accordion": "^1.2.1",
23-
"@radix-ui/react-collapsible": "^1.1.1",
24-
"@radix-ui/react-icons": "^1.3.2",
25-
"@radix-ui/react-scroll-area": "^1.2.1",
26-
"@radix-ui/react-select": "^2.1.2",
27-
"@radix-ui/react-slot": "^1.1.0",
28-
"@radix-ui/react-tooltip": "^1.1.4",
29-
"class-variance-authority": "^0.7.0",
30-
"clsx": "^2.1.1",
31-
"lucide-react": "^0.460.0",
32-
"react": "^18.2.0",
33-
"react-dom": "^18.2.0",
34-
"tailwind-merge": "^1.14.0"
35-
},
36-
"devDependencies": {
37-
"@eslint/js": "^9.15.0",
38-
"@ianvs/prettier-plugin-sort-imports": "^3.7.2",
39-
"@types/chrome": "^0.0.246",
40-
"@types/node": "^20.8.2",
41-
"@types/react": "^18.2.24",
42-
"@types/react-dom": "^18.2.8",
43-
"@typescript-eslint/eslint-plugin": "^8.15.0",
44-
"@typescript-eslint/parser": "^8.15.0",
45-
"@vitest/runner": "^2.1.5",
46-
"autoprefixer": "^10.4.16",
47-
"copy-webpack-plugin": "^11.0.0",
48-
"css-loader": "^6.8.1",
49-
"eslint": "^9.15.0",
50-
"eslint-config-prettier": "^9.1.0",
51-
"eslint-plugin-react": "^7.37.2",
52-
"eslint-plugin-react-hooks": "^5.0.0",
53-
"husky": "^9.1.7",
54-
"identity-obj-proxy": "^3.0.0",
55-
"lint-staged": "^14.0.1",
56-
"markdownlint-cli2": "^0.15.0",
57-
"mini-css-extract-plugin": "^2.9.2",
58-
"postcss": "^8.4.31",
59-
"postcss-loader": "^7.3.3",
60-
"postcss-nesting": "^12.0.1",
61-
"style-loader": "^3.3.3",
62-
"tailwindcss": "^3.3.3",
63-
"tailwindcss-animate": "^1.0.7",
64-
"ts-loader": "^9.4.4",
65-
"typescript": "^5.2.2",
66-
"vitest": "^2.1.5",
67-
"webpack": "^5.88.2",
68-
"webpack-cli": "^5.1.4",
69-
"webpack-dev-server": "^4.15.1",
70-
"webpack-merge": "^5.9.0"
71-
},
72-
"lint-staged": {
73-
"*.{ts,tsx}": ["eslint --fix", "prettier --write"],
74-
"*.md": "markdownlint-cli2 --config .markdownlint-cli2.jsonc --fix"
75-
}
2+
"name": "thinking-claude",
3+
"version": "3.2.2",
4+
"description": "Chrome extension for letting Claude think like a real human",
5+
"type": "module",
6+
"scripts": {
7+
"watch": "webpack --config webpack/webpack.dev.js --watch",
8+
"build": "webpack --config webpack/webpack.prod.js",
9+
"start": "webpack serve --config webpack/webpack.dev.js",
10+
"test": "bun test",
11+
"test:watch": "bun test --watch",
12+
"lint": "eslint .",
13+
"lint:fix": "eslint . --fix",
14+
"lint:staged": "lint-staged",
15+
"lint:types": "tsc --noEmit",
16+
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,css,md}\"",
17+
"format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,json,css,md}\"",
18+
"fix": "bun run format && bun run lint:fix",
19+
"type-check": "tsc --noEmit",
20+
"check-version-sync": "bun ./scripts/check-version-sync.ts"
21+
},
22+
"dependencies": {
23+
"@radix-ui/react-accordion": "^1.2.1",
24+
"@radix-ui/react-collapsible": "^1.1.1",
25+
"@radix-ui/react-icons": "^1.3.2",
26+
"@radix-ui/react-scroll-area": "^1.2.1",
27+
"@radix-ui/react-select": "^2.1.2",
28+
"@radix-ui/react-slot": "^1.1.0",
29+
"@radix-ui/react-tooltip": "^1.1.4",
30+
"class-variance-authority": "^0.7.0",
31+
"clsx": "^2.1.1",
32+
"lucide-react": "^0.460.0",
33+
"react": "^18.2.0",
34+
"react-dom": "^18.2.0",
35+
"tailwind-merge": "^1.14.0"
36+
},
37+
"devDependencies": {
38+
"@eslint/js": "^9.15.0",
39+
"@ianvs/prettier-plugin-sort-imports": "^3.7.2",
40+
"@types/chrome": "^0.0.246",
41+
"@types/node": "^20.8.2",
42+
"@types/react": "^18.2.24",
43+
"@types/react-dom": "^18.2.8",
44+
"@typescript-eslint/eslint-plugin": "^8.15.0",
45+
"@typescript-eslint/parser": "^8.15.0",
46+
"@vitest/runner": "^2.1.5",
47+
"autoprefixer": "^10.4.16",
48+
"copy-webpack-plugin": "^11.0.0",
49+
"css-loader": "^6.8.1",
50+
"eslint": "^9.15.0",
51+
"eslint-config-prettier": "^9.1.0",
52+
"eslint-plugin-react": "^7.37.2",
53+
"eslint-plugin-react-hooks": "^5.0.0",
54+
"husky": "^9.1.7",
55+
"identity-obj-proxy": "^3.0.0",
56+
"lint-staged": "^14.0.1",
57+
"markdownlint-cli2": "^0.15.0",
58+
"mini-css-extract-plugin": "^2.9.2",
59+
"postcss": "^8.4.31",
60+
"postcss-loader": "^7.3.3",
61+
"postcss-nesting": "^12.0.1",
62+
"style-loader": "^3.3.3",
63+
"tailwindcss": "^3.3.3",
64+
"tailwindcss-animate": "^1.0.7",
65+
"ts-loader": "^9.4.4",
66+
"typescript": "^5.2.2",
67+
"vitest": "^2.1.5",
68+
"webpack": "^5.88.2",
69+
"webpack-cli": "^5.1.4",
70+
"webpack-dev-server": "^4.15.1",
71+
"webpack-merge": "^5.9.0"
72+
},
73+
"lint-staged": {
74+
"*.{ts,tsx}": [
75+
"eslint --fix",
76+
"prettier --write"
77+
],
78+
"*.md": "markdownlint-cli2 --config .markdownlint-cli2.jsonc --fix"
79+
}
7680
}

extensions/chrome/public/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "Thinking Claude",
4-
"version": "3.2.1",
4+
"version": "3.2.2",
55
"description": "Chrome extension for letting Claude think like a real human",
66
"background": {
77
"service_worker": "background.js"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env node
2+
import fs from "fs"
3+
import path from "path"
4+
import { fileURLToPath } from "url"
5+
6+
interface PackageJson {
7+
version: string
8+
[key: string]: unknown
9+
}
10+
11+
interface ManifestJson {
12+
manifest_version: number
13+
name: string
14+
version: string
15+
description: string
16+
[key: string]: unknown
17+
}
18+
19+
const __filename: string = fileURLToPath(import.meta.url)
20+
const __dirname: string = path.dirname(__filename)
21+
22+
const packageJsonPath: string = path.resolve(__dirname, "..", "package.json")
23+
const manifestJsonPath: string = path.resolve(
24+
__dirname,
25+
"..",
26+
"public",
27+
"manifest.json"
28+
)
29+
30+
try {
31+
const packageJson: PackageJson = JSON.parse(
32+
fs.readFileSync(packageJsonPath, "utf8")
33+
)
34+
const manifestJson: ManifestJson = JSON.parse(
35+
fs.readFileSync(manifestJsonPath, "utf8")
36+
)
37+
38+
if (packageJson.version !== manifestJson.version) {
39+
console.error("\x1b[31mError: Version mismatch!\x1b[0m")
40+
console.error(`package.json version: ${packageJson.version}`)
41+
console.error(`manifest.json version: ${manifestJson.version}`)
42+
console.error(
43+
"\nPlease update the version in public/manifest.json to match package.json"
44+
)
45+
process.exit(1)
46+
}
47+
48+
console.log("\x1b[32mVersions are in sync ✓\x1b[0m")
49+
process.exit(0)
50+
} catch (error: unknown) {
51+
console.error(
52+
"\x1b[31mError checking version sync:\x1b[0m",
53+
error instanceof Error ? error.message : error
54+
)
55+
process.exit(1)
56+
}

0 commit comments

Comments
 (0)