bimba-cli 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +13 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -159,6 +159,19 @@ async function bundle() {
|
|
|
159
159
|
}
|
|
160
160
|
result = await Bun.build(buildOpts);
|
|
161
161
|
|
|
162
|
+
// For node target, add shebang to the output file
|
|
163
|
+
if (result.success && (buildTarget === 'node' || buildTarget === 'bun')) {
|
|
164
|
+
for (const output of result.outputs) {
|
|
165
|
+
const outPath = output.path;
|
|
166
|
+
const content = fs.readFileSync(outPath, 'utf8');
|
|
167
|
+
if (!content.startsWith('#!')) {
|
|
168
|
+
const shebang = buildTarget === 'bun' ? '#!/usr/bin/env bun' : '#!/usr/bin/env node';
|
|
169
|
+
fs.writeFileSync(outPath, shebang + '\n' + content);
|
|
170
|
+
fs.chmodSync(outPath, 0o755);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
162
175
|
if(stats.failed)
|
|
163
176
|
console.log(theme.start(theme.failure(" Failure ") + theme.filename(` Imba compiler failed to proceed ${stats.failed} file${stats.failed > 1 ? 's' : ''}`)));
|
|
164
177
|
else
|