pipers-cli
Version:
Official CLI tool for Pipers - A GitHub alternative for seamless git operations without sharing data with any LLM Engine like OPenAI
41 lines (32 loc) • 1.12 kB
JavaScript
/**
* Pre-publish script to validate the package before publishing to npm
*/
const fs = require('fs');
const path = require('path');
function validatePackage() {
console.log('🔍 Validating package before publish...');
// Check if bin file exists and is executable
const binPath = path.join(__dirname, '..', 'bin', 'pipers.js');
if (!fs.existsSync(binPath)) {
console.error('❌ Binary file not found: bin/pipers.js');
process.exit(1);
}
// Check if package.json has required fields
const packageJson = require('../package.json');
const requiredFields = ['name', 'version', 'description', 'bin', 'repository'];
for (const field of requiredFields) {
if (!packageJson[field]) {
console.error(`❌ Missing required field in package.json: ${field}`);
process.exit(1);
}
}
// Check if README exists
const readmePath = path.join(__dirname, '..', 'README.md');
if (!fs.existsSync(readmePath)) {
console.error('❌ README.md not found');
process.exit(1);
}
console.log('✅ Package validation passed!');
}
validatePackage();