commit-guard-cli
Version:
Commit validation, security audits, and dependency checks for Node.js projects. Enforces conventional commits with beautiful terminal output.
25 lines (20 loc) • 678 B
JavaScript
const { execSync } = require('child_process');
const path = require('path');
// Check if TypeScript files exist, if so, compile them
const srcPath = path.join(__dirname, '..', 'src');
const distPath = path.join(__dirname, '..', 'dist');
try {
require('fs').accessSync(distPath);
} catch {
// Dist doesn't exist, try to build
try {
console.log('Building TypeScript files...');
execSync('npm run build', { cwd: path.join(__dirname, '..'), stdio: 'inherit' });
} catch (error) {
console.error('Failed to build TypeScript files. Please run "npm run build" manually.');
process.exit(1);
}
}
// Run the CLI
require('../dist/cli.js');