diff --git a/manifest.json b/manifest.json index cf4fae8..b2781bf 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-mcp-plugin", "name": "Obsidian MCP Plugin", - "version": "0.3.1", + "version": "0.3.2", "minAppVersion": "0.15.0", "description": "Semantic MCP server plugin providing AI tools with direct Obsidian vault access via HTTP transport", "author": "Aaron Bockelie", diff --git a/package.json b/package.json index 1568d0e..dcaa4ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-mcp-plugin", - "version": "0.3.1", + "version": "0.3.2", "description": "Semantic MCP server plugin providing AI tools with direct Obsidian vault access via HTTP transport", "main": "main.js", "scripts": { diff --git a/src/version.ts b/src/version.ts index 2191a98..acdf103 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,26 +1,4 @@ -import { readFileSync } from 'fs'; -import { resolve } from 'path'; - -let cachedVersion: string | null = null; - +// Version is injected at build time by sync-version.mjs export function getVersion(): string { - if (cachedVersion) { - return cachedVersion; - } - - // Fallback version in case reading fails - let version = '0.2.0'; - - try { - // In an Obsidian plugin, we need to find package.json relative to the plugin directory - // This works whether we're in development (src/) or production (main.js) - const packageJsonPath = resolve(__dirname, '..', 'package.json'); - const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')); - version = packageJson.version; - cachedVersion = version; - } catch (error) { - console.warn('Could not read version from package.json, using fallback:', version); - } - - return version; -} \ No newline at end of file + return '0.3.2'; +} diff --git a/sync-version.mjs b/sync-version.mjs index 059d03a..6b06c92 100644 --- a/sync-version.mjs +++ b/sync-version.mjs @@ -14,7 +14,15 @@ try { // Write updated manifest.json writeFileSync('manifest.json', JSON.stringify(manifest, null, 2) + '\n'); - console.log(`✅ Synced version ${version} from package.json to manifest.json`); + // 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);