Skip to main content
Glama
update-version.js1.94 kB
#!/usr/bin/env node const { execSync } = require('child_process'); const fs = require('fs'); const path = require('path'); /** * Update version script - updates both package.json and src/version.ts * This script ensures version consistency across all files */ function log(message) { console.log(`[UPDATE-VERSION] ${message}`); } function error(message) { console.error(`[ERROR] ${message}`); process.exit(1); } function updateVersionFile(version) { const versionFilePath = path.join(__dirname, '..', 'src', 'version.ts'); const content = `export const VERSION = '${version}';\n`; fs.writeFileSync(versionFilePath, content); log(`Updated src/version.ts to version ${version}`); } function getPackageVersion() { const packagePath = path.join(__dirname, '..', 'package.json'); const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8')); return packageJson.version; } function main() { const versionType = process.argv[2]; if (!versionType || !['patch', 'minor', 'major'].includes(versionType)) { error('Usage: node update-version.js <patch|minor|major>'); } log(`Updating version with type: ${versionType}`); try { // Update package.json version execSync(`npm version ${versionType} --no-git-tag-version`, { stdio: 'inherit' }); // Get the new version const newVersion = getPackageVersion(); log(`Package.json updated to version ${newVersion}`); // Update src/version.ts updateVersionFile(newVersion); // Stage the changes execSync('git add package.json src/version.ts', { stdio: 'inherit' }); log(`✅ Version updated to ${newVersion} in both package.json and src/version.ts`); log('Files have been staged for commit'); } catch (err) { error(`Failed to update version: ${err.message}`); } } if (require.main === module) { main(); } module.exports = { updateVersionFile, getPackageVersion };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BoomLinkAi/image-worker-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server