Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env sh
npm run sync-manifest
git add manifest.json
npx lint-staged
9 changes: 5 additions & 4 deletions .husky/setup-hooks.js
Original file line number Diff line number Diff line change
@@ -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 });

Expand All @@ -10,6 +9,8 @@ execSync('git config core.hooksPath .husky');
writeFileSync(
'.husky/pre-commit',
`#!/usr/bin/env sh
npm run sync-manifest
git add manifest.json
npx lint-staged`
);

Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.2",
"description": "Mapbox MCP devkit server",
"author": {
"name": "Mapbox, Inc."
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
},
Expand Down
13 changes: 0 additions & 13 deletions scripts/build-helpers.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +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'));

manifestJson.version = packageJson.version;

fs.writeFileSync('manifest.json', JSON.stringify(manifestJson, null, 2) + '\n');
console.log(`Synced version ${packageJson.version} from package.json to manifest.json`);
}

// Copy JSON files to dist
function copyJsonFiles() {
Expand Down Expand Up @@ -77,9 +67,6 @@ switch (command) {
case 'generate-version':
generateVersion();
break;
case 'sync-manifest-version':
syncManifestVersion();
break;
case 'copy-json':
copyJsonFiles();
break;
Expand Down
36 changes: 36 additions & 0 deletions scripts/sync-manifest-version.cjs
Original file line number Diff line number Diff line change
@@ -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();
15 changes: 15 additions & 0 deletions test/version-consistency.test.ts
Original file line number Diff line number Diff line change
@@ -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);
});
});
Loading