add-shebang.jsā¢806 B
#!/usr/bin/env node
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Add shebang to the main build file
const buildFile = path.join(__dirname, 'build', 'index.js');
if (fs.existsSync(buildFile)) {
  const content = fs.readFileSync(buildFile, 'utf8');
  
  // Only add shebang if it doesn't already exist
  if (!content.startsWith('#!/usr/bin/env node')) {
    const newContent = '#!/usr/bin/env node\n' + content;
    fs.writeFileSync(buildFile, newContent);
    console.log('Added shebang to build/index.js');
  } else {
    console.log('Shebang already exists in build/index.js');
  }
} else {
  console.error('Build file not found:', buildFile);
  process.exit(1);
}