aaronsb_obsidian-mcp-plugin/sync-version.mjs
Aaron Bockelie 97d346070f build: Sync mcpb/manifest.json version with package.json
Extends sync-version.mjs so a single source of truth (package.json
version) drives manifest.json, mcpb/manifest.json, and version.ts in
lockstep. Future releases bump one file; the MCPB stays current
automatically.

Refs ADR-102.
2026-05-15 11:28:58 -05:00

34 lines
No EOL
1.1 KiB
JavaScript

#!/usr/bin/env node
import { readFileSync, writeFileSync } from 'fs';
try {
// Read version from package.json
const packageJson = JSON.parse(readFileSync('package.json', 'utf-8'));
const version = packageJson.version;
// Read and update manifest.json
const manifest = JSON.parse(readFileSync('manifest.json', 'utf-8'));
manifest.version = version;
// Write updated manifest.json
writeFileSync('manifest.json', JSON.stringify(manifest, null, 2) + '\n');
// Read and update mcpb/manifest.json (MCPB bundle for Claude Desktop)
const mcpbManifest = JSON.parse(readFileSync('mcpb/manifest.json', 'utf-8'));
mcpbManifest.version = version;
writeFileSync('mcpb/manifest.json', JSON.stringify(mcpbManifest, null, 2) + '\n');
// Update version.ts
const versionTs = `// Version is injected at build time by sync-version.mjs
export function getVersion(): string {
return '${version}';
}
`;
writeFileSync('src/version.ts', versionTs);
console.log(`✅ Synced version ${version} to manifest.json, mcpb/manifest.json, and version.ts`);
} catch (error) {
console.error('❌ Failed to sync version:', error.message);
process.exit(1);
}