mirror of
https://github.com/aaronsb/obsidian-mcp-plugin.git
synced 2026-07-22 16:40:32 +00:00
- 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>
29 lines
No EOL
888 B
JavaScript
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);
|
|
} |