Files
ccs/scripts/add-shebang.js
T
kaitranntt 77d026869e fix(tsconfig): remove duplicate compiler options
- Remove duplicate allowSyntheticDefaultImports (lines 16 & 42)
- Remove duplicate skipLibCheck (lines 18 & 46)
- Add TypeScript source files for npm package migration
- Verify build pipeline works (42/42 tests pass)
2025-11-26 19:24:40 -05:00

39 lines
950 B
JavaScript
Executable File

#!/usr/bin/env node
'use strict';
const fs = require('fs');
const path = require('path');
/**
* Add shebang to dist/ccs.js and make executable
* Run after: tsc
*/
function addShebang() {
const ccsPath = path.join(__dirname, '../dist/ccs.js');
if (!fs.existsSync(ccsPath)) {
console.error('[X] dist/ccs.js not found. Run tsc first.');
process.exit(1);
}
let content = fs.readFileSync(ccsPath, 'utf8');
// Add shebang if missing
if (!content.startsWith('#!/usr/bin/env node')) {
content = '#!/usr/bin/env node\n' + content;
fs.writeFileSync(ccsPath, content);
console.log('[OK] Shebang added to dist/ccs.js');
}
// Make executable (Unix-like systems)
if (process.platform !== 'win32') {
try {
fs.chmodSync(ccsPath, 0o755);
console.log('[OK] dist/ccs.js is now executable');
} catch (err) {
console.warn('[!] Could not chmod dist/ccs.js:', err.message);
}
}
}
addShebang();