#!/usr/bin/env node
/**
* NPM Publish Verification Script
* Run this to check if everything is ready for publishing
*/
import { execSync } from 'child_process';
import { readFileSync } from 'fs';
console.log('๐ NPM Publish Verification\n');
// Check package.json
console.log('๐ฆ Package Information:');
try {
const pkg = JSON.parse(readFileSync('./package.json', 'utf8'));
console.log(` Name: ${pkg.name}`);
console.log(` Version: ${pkg.version}`);
console.log(` License: ${pkg.license}`);
console.log('');
} catch (error) {
console.error('โ Could not read package.json');
process.exit(1);
}
// Check npm login
console.log('๐ค NPM Authentication:');
try {
const user = execSync('npm whoami', { encoding: 'utf8' }).trim();
console.log(` โ
Logged in as: ${user}`);
} catch (error) {
console.log(' โ Not logged in to npm');
console.log(' Run: npm login');
}
console.log('');
// Check if package exists
console.log('๐ Package Registry Check:');
try {
execSync('npm view context-continue-mcp', { encoding: 'utf8' });
console.log(' โ ๏ธ Package already exists on npm');
} catch (error) {
if (error.message.includes('404')) {
console.log(' โ
Package name available');
} else {
console.log(' โ Registry check failed');
}
}
console.log('');
// Check build
console.log('๐จ Build Check:');
try {
console.log(' Building project...');
execSync('npm run build', { stdio: 'ignore' });
console.log(' โ
Build successful');
} catch (error) {
console.log(' โ Build failed');
console.log(' Run: npm run build');
}
console.log('');
// Test publish (dry run)
console.log('๐งช Publish Test (Dry Run):');
try {
const output = execSync('npm publish --dry-run', { encoding: 'utf8' });
console.log(' โ
Dry run successful');
console.log(' Ready to publish!');
} catch (error) {
console.log(' โ Dry run failed');
console.log(' Check the error above');
}
console.log('');
console.log('๐ Next Steps:');
console.log(' 1. Fix any issues shown above');
console.log(' 2. Ensure NPM_TOKEN is in GitHub Secrets');
console.log(' 3. Run "Simple NPM Publish" workflow with dry_run=true');
console.log(' 4. If successful, run again with dry_run=false');