payload-cms-mcp
Version:
Payload CMS 3.0 MCP Server - A specialized Model Context Protocol server for Payload CMS
53 lines (44 loc) ⢠1.49 kB
JavaScript
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
// Get package.json
const packageJsonPath = path.join(__dirname, '..', 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
const version = packageJson.version;
console.log(`\nš Preparing release for version ${version}...\n`);
// Run tests
console.log('š Running tests...');
try {
execSync('npm test', { stdio: 'inherit' });
} catch (error) {
console.error('ā Tests failed. Aborting release.');
process.exit(1);
}
// Build (if needed)
// console.log('šØ Building package...');
// execSync('npm run build', { stdio: 'inherit' });
// Create git tag
console.log(`š Creating git tag v${version}...`);
try {
execSync(`git tag -a v${version} -m "Release v${version}"`, { stdio: 'inherit' });
} catch (error) {
console.log(`ā ļø Tag v${version} already exists or git error occurred.`);
}
// Push to git
console.log('š¤ Pushing to git...');
try {
execSync('git push --follow-tags', { stdio: 'inherit' });
} catch (error) {
console.error('ā Failed to push to git. Aborting release.');
process.exit(1);
}
// Publish to npm
console.log('š¦ Publishing to npm...');
try {
execSync('npm publish --access public', { stdio: 'inherit' });
} catch (error) {
console.error('ā Failed to publish to npm.');
process.exit(1);
}
console.log(`\nā
Successfully released version ${version}!\n`);