From 08c5a03f5b89b808f2df9e2d1b5773a13b9086a3 Mon Sep 17 00:00:00 2001 From: Mofei Zhu <13761509829@163.com> Date: Tue, 30 Sep 2025 10:38:51 +0300 Subject: [PATCH 1/4] update --- .husky/pre-commit | 2 ++ .husky/setup-hooks.js | 9 +++++---- manifest.json | 2 +- scripts/build-helpers.cjs | 16 ++++++++++++---- test/version-consistency.test.ts | 15 +++++++++++++++ 5 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 test/version-consistency.test.ts diff --git a/.husky/pre-commit b/.husky/pre-commit index 754fb2e..147235c 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,2 +1,4 @@ #!/usr/bin/env sh +npm run sync-manifest-version +git add manifest.json npx lint-staged \ No newline at end of file diff --git a/.husky/setup-hooks.js b/.husky/setup-hooks.js index 9b46ed1..8021623 100644 --- a/.husky/setup-hooks.js +++ b/.husky/setup-hooks.js @@ -1,7 +1,6 @@ -/*global console*/ -import { writeFileSync, mkdirSync, chmodSync, constants } from 'fs'; -import { execSync } from 'child_process'; -import { platform } from 'os'; +import { writeFileSync, mkdirSync, chmodSync, constants } from 'node:fs'; +import { execSync } from 'node:child_process'; +import { platform } from 'node:os'; mkdirSync('.husky', { recursive: true }); @@ -10,6 +9,8 @@ execSync('git config core.hooksPath .husky'); writeFileSync( '.husky/pre-commit', `#!/usr/bin/env sh +npm run sync-manifest-version +git add manifest.json npx lint-staged` ); diff --git a/manifest.json b/manifest.json index 974a4f0..57bfa66 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "dxt_version": "0.1", "name": "@mapbox/mcp-devkit-server", "display_name": "Mapbox MCP DevKit Server", - "version": "0.4.0", + "version": "0.4.1", "description": "Mapbox MCP devkit server", "author": { "name": "Mapbox, Inc." diff --git a/scripts/build-helpers.cjs b/scripts/build-helpers.cjs index 4a9ed07..f75219f 100644 --- a/scripts/build-helpers.cjs +++ b/scripts/build-helpers.cjs @@ -37,11 +37,19 @@ function generateVersion() { function syncManifestVersion() { const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')); const manifestJson = JSON.parse(fs.readFileSync('manifest.json', 'utf8')); - - manifestJson.version = packageJson.version; - + + const packageVersion = packageJson.version; + const manifestVersion = manifestJson.version; + + if (packageVersion === manifestVersion) { + console.log(`✓ Versions already in sync: ${packageVersion}`); + return; + } + + manifestJson.version = packageVersion; + fs.writeFileSync('manifest.json', JSON.stringify(manifestJson, null, 2) + '\n'); - console.log(`Synced version ${packageJson.version} from package.json to manifest.json`); + console.log(`✓ Updated manifest.json version: ${manifestVersion} → ${packageVersion}`); } // Copy JSON files to dist diff --git a/test/version-consistency.test.ts b/test/version-consistency.test.ts new file mode 100644 index 0000000..8b95bd3 --- /dev/null +++ b/test/version-consistency.test.ts @@ -0,0 +1,15 @@ +import { describe, it, expect } from 'vitest'; +import { readFileSync } from 'node:fs'; +import { join } from 'node:path'; + +describe('Version Consistency', () => { + it('should have matching versions in package.json and manifest.json', () => { + const packageJsonPath = join(process.cwd(), 'package.json'); + const manifestJsonPath = join(process.cwd(), 'manifest.json'); + + const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')); + const manifestJson = JSON.parse(readFileSync(manifestJsonPath, 'utf-8')); + + expect(manifestJson.version).toBe(packageJson.version); + }); +}); From fc5636c93c9274bea321e54e404d267853a7e2b1 Mon Sep 17 00:00:00 2001 From: Mofei Zhu <13761509829@163.com> Date: Tue, 30 Sep 2025 10:39:21 +0300 Subject: [PATCH 2/4] 0.4.2 --- manifest.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index 57bfa66..1484513 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "dxt_version": "0.1", "name": "@mapbox/mcp-devkit-server", "display_name": "Mapbox MCP DevKit Server", - "version": "0.4.1", + "version": "0.4.2", "description": "Mapbox MCP devkit server", "author": { "name": "Mapbox, Inc." diff --git a/package-lock.json b/package-lock.json index 6a5b346..c0901e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mapbox/mcp-devkit-server", - "version": "0.4.1", + "version": "0.4.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mapbox/mcp-devkit-server", - "version": "0.4.1", + "version": "0.4.2", "license": "MIT", "dependencies": { "@modelcontextprotocol/sdk": "^1.17.5", diff --git a/package.json b/package.json index b6b5e0d..8f1d945 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mapbox/mcp-devkit-server", - "version": "0.4.1", + "version": "0.4.2", "description": "Mapbox MCP devkit server", "main": "./dist/commonjs/index.js", "module": "./dist/esm/index.js", From 7f3e8ca08669078bde9e968746e3f71889109850 Mon Sep 17 00:00:00 2001 From: Mofei Zhu <13761509829@163.com> Date: Tue, 30 Sep 2025 10:45:21 +0300 Subject: [PATCH 3/4] update --- .husky/setup-hooks.js | 2 +- CLAUDE.md | 2 +- package.json | 4 ++-- scripts/build-helpers.cjs | 21 ------------------ scripts/sync-manifest-version.cjs | 36 +++++++++++++++++++++++++++++++ 5 files changed, 40 insertions(+), 25 deletions(-) create mode 100644 scripts/sync-manifest-version.cjs diff --git a/.husky/setup-hooks.js b/.husky/setup-hooks.js index 8021623..d7096e4 100644 --- a/.husky/setup-hooks.js +++ b/.husky/setup-hooks.js @@ -9,7 +9,7 @@ execSync('git config core.hooksPath .husky'); writeFileSync( '.husky/pre-commit', `#!/usr/bin/env sh -npm run sync-manifest-version +npm run sync-manifest git add manifest.json npx lint-staged` ); diff --git a/CLAUDE.md b/CLAUDE.md index 7fba22f..05cd93e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -14,7 +14,7 @@ This file provides Claude and developers with essential context, commands, and s - `npm run format:fix` — Auto-format code - `npx plop create-tool` — Generate a new tool scaffold - `npx @modelcontextprotocol/inspector node dist/esm/index.js` — Inspect the MCP server -- `npx @anthropic-ai/dxt pack` — Create a DXT package for distribution +- `npm run sync-manifest` — Sync version from package.json to manifest.json - `docker build -t mapbox-mcp-devkit .` — Build Docker image - `docker run mapbox/mcp-devkit-server ...` — Run server in Docker diff --git a/package.json b/package.json index 8f1d945..152d525 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,9 @@ "format:fix": "prettier --write \"./src/**/*.{ts,tsx,js,json,md}\" \"./test/**/*.{ts,tsx,js,json,md}\"", "prepare": "husky && node .husky/setup-hooks.js", "test": "vitest", - "build": "npm run prepare && npm run sync-manifest-version && tshy && npm run generate-version && node scripts/build-helpers.cjs copy-json && node scripts/add-shebang.cjs", + "build": "npm run prepare && npm run sync-manifest && tshy && npm run generate-version && node scripts/build-helpers.cjs copy-json && node scripts/add-shebang.cjs", "generate-version": "node scripts/build-helpers.cjs generate-version", - "sync-manifest-version": "node scripts/build-helpers.cjs sync-manifest-version", + "sync-manifest": "node scripts/sync-manifest-version.cjs", "dev": "tsc -p tsconfig.json --watch", "dev:inspect": "npm run build && npx @modelcontextprotocol/inspector -e MAPBOX_ACCESS_TOKEN=\"$MAPBOX_ACCESS_PRIVATE_TOKEN\" node dist/esm/index.js" }, diff --git a/scripts/build-helpers.cjs b/scripts/build-helpers.cjs index f75219f..33b012f 100644 --- a/scripts/build-helpers.cjs +++ b/scripts/build-helpers.cjs @@ -33,24 +33,6 @@ function generateVersion() { console.log('Generated version.json:', versionInfo); } -// Sync version from package.json to manifest.json -function syncManifestVersion() { - const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')); - const manifestJson = JSON.parse(fs.readFileSync('manifest.json', 'utf8')); - - const packageVersion = packageJson.version; - const manifestVersion = manifestJson.version; - - if (packageVersion === manifestVersion) { - console.log(`✓ Versions already in sync: ${packageVersion}`); - return; - } - - manifestJson.version = packageVersion; - - fs.writeFileSync('manifest.json', JSON.stringify(manifestJson, null, 2) + '\n'); - console.log(`✓ Updated manifest.json version: ${manifestVersion} → ${packageVersion}`); -} // Copy JSON files to dist function copyJsonFiles() { @@ -85,9 +67,6 @@ switch (command) { case 'generate-version': generateVersion(); break; - case 'sync-manifest-version': - syncManifestVersion(); - break; case 'copy-json': copyJsonFiles(); break; diff --git a/scripts/sync-manifest-version.cjs b/scripts/sync-manifest-version.cjs new file mode 100644 index 0000000..931cb9a --- /dev/null +++ b/scripts/sync-manifest-version.cjs @@ -0,0 +1,36 @@ +// Sync manifest.json version with package.json +const fs = require('node:fs'); +const path = require('node:path'); + +function syncManifestVersion() { + const packageJsonPath = path.join(process.cwd(), 'package.json'); + const manifestJsonPath = path.join(process.cwd(), 'manifest.json'); + + // Read package.json + const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')); + const packageVersion = packageJson.version; + + // Read manifest.json + const manifestJson = JSON.parse(fs.readFileSync(manifestJsonPath, 'utf-8')); + const manifestVersion = manifestJson.version; + + // Check if versions are already in sync + if (manifestVersion === packageVersion) { + console.log(`✓ Versions already in sync: ${packageVersion}`); + return; + } + + // Update manifest.json version + manifestJson.version = packageVersion; + fs.writeFileSync( + manifestJsonPath, + JSON.stringify(manifestJson, null, 2) + '\n', + 'utf-8' + ); + + console.log( + `✓ Updated manifest.json version: ${manifestVersion} → ${packageVersion}` + ); +} + +syncManifestVersion(); \ No newline at end of file From a3512b236f0b6ce5b7129f332aa46dbaf3112a19 Mon Sep 17 00:00:00 2001 From: Mofei Zhu <13761509829@163.com> Date: Tue, 30 Sep 2025 10:46:24 +0300 Subject: [PATCH 4/4] update --- .husky/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 147235c..15ec148 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh -npm run sync-manifest-version +npm run sync-manifest git add manifest.json npx lint-staged \ No newline at end of file