Skip to main content
Glama
bump-versions.ts1.55 kB
import fs from 'fs'; import path from 'path'; const version = process.env.VERSION; const startPath = process.env.START_PATH; const shouldIgnoreWorkspace = process.env.IGNORE_WORKSPACE; function updatePackageJsonVersion(filePath: string, version: string) { const content = fs.readFileSync(filePath, 'utf-8'); const json = JSON.parse(content); json.version = version; const updatedContent = JSON.stringify( json, function (key, value) { if (key === 'version' || (String(value).includes('workspace:^') && !shouldIgnoreWorkspace)) { return version; } return value; }, 2, ); fs.writeFileSync(filePath, updatedContent); } export function searchAndReplace(rootDir: string, version: string) { const entries = fs.readdirSync(rootDir, { withFileTypes: true }); for (const entry of entries) { const fullPath = path.join(rootDir, entry.name); if (fullPath.includes('node_modules')) continue; if (entry.isDirectory()) { searchAndReplace(fullPath, version); } else if (entry.isFile() && entry.name === 'package.json') { updatePackageJsonVersion(fullPath, version); } } } if (!version) { console.error('Please set the VERSION environment variable.'); process.exit(1); } if (!version.includes('alpha')) { console.error('Please set the VERSION environment variable to an alpha version.'); process.exit(1); } if (!startPath) { console.error('Please set the START_PATH environment variable.'); process.exit(1); } searchAndReplace(startPath, version);

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/danstarns/mcp-sandbox'

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