checklist-mcp-server
Version:
An MCP server for hierarchical checklist management with HTTP streamable transport support.
81 lines (65 loc) β’ 2.53 kB
JavaScript
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();
});