UNPKG

checklist-mcp-server

Version:

An MCP server for hierarchical checklist management with HTTP streamable transport support.

81 lines (65 loc) β€’ 2.53 kB
#!/usr/bin/env node const { execSync } = require('child_process'); const fs = require('fs'); const path = require('path'); console.log('πŸš€ Publishing Checklist MCP Server to npm...\n'); // Read package.json const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); console.log(`πŸ“¦ Package: ${pkg.name}@${pkg.version}`); console.log(`πŸ“ Description: ${pkg.description}\n`); // Pre-publish checks console.log('πŸ” Running pre-publish checks...'); try { // Check if logged in to npm console.log(' βœ“ Checking npm authentication...'); const whoami = execSync('npm whoami', { encoding: 'utf8' }).trim(); console.log(` Logged in as: ${whoami}`); // Build project console.log(' βœ“ Building project...'); execSync('npm run build', { stdio: 'inherit' }); // Run tests console.log(' βœ“ Running tests...'); execSync('npm test', { stdio: 'inherit' }); // Verify package console.log(' βœ“ Verifying package...'); execSync('npm run verify', { stdio: 'inherit' }); // Check what will be published console.log(' βœ“ Checking package contents...'); const packOutput = execSync('npm pack --dry-run', { encoding: 'utf8' }); console.log(' Files to be published:'); packOutput.split('\n').forEach(line => { if (line.trim() && !line.includes('npm notice')) { console.log(` ${line}`); } }); } catch (error) { console.error('❌ Pre-publish checks failed:', error.message); process.exit(1); } console.log('\nβœ… All pre-publish checks passed!'); // Ask for confirmation const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); rl.question('\nπŸ€” Do you want to publish now? (y/N): ', (answer) => { if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') { try { console.log('\nπŸ“€ Publishing to npm...'); execSync('npm publish', { stdio: 'inherit' }); console.log('\nπŸŽ‰ Successfully published to npm!'); console.log('\nπŸ“‹ Next steps:'); console.log(` β€’ Test installation: npx ${pkg.name}@latest`); console.log(` β€’ View on npm: https://www.npmjs.com/package/${pkg.name}`); console.log(` β€’ Update documentation if needed`); console.log(` β€’ Create GitHub release (if using GitHub)`); } catch (error) { console.error('❌ Publishing failed:', error.message); process.exit(1); } } else { console.log('\n⏸️ Publishing cancelled.'); } rl.close(); });