aaronsb_obsidian-mcp-plugin/sync-version.mjs
Aaron Bockelie 1e366dfe56 fix: Resolve version display issues in Obsidian (v0.3.2)
- Fix version.ts to use build-time injection instead of runtime package.json reading
- Update sync-version.mjs to also sync version.ts file
- Eliminate "Could not read version from package.json" warnings
- Plugin now correctly displays v0.3.2 instead of fallback v0.2.0

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 13:11:40 -05:00

29 lines
No EOL
888 B
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');
// 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} from package.json to manifest.json and version.ts`);
} catch (error) {
console.error('❌ Failed to sync version:', error.message);
process.exit(1);
}