Skip to content

Commit c87b793

Browse files
committed
refactor: remove shebang from bundle
1 parent 00d142f commit c87b793

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

src/cli/bundle.ts

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,10 @@ export async function bundle(
2929
script: string,
3030
options?: Deno.EmitOptions,
3131
): Promise<string> {
32-
const [shebang, bundledScript] = await Promise.all([
33-
getShebang(script),
34-
preBundle(
35-
script,
36-
options,
37-
).then((tmpFile) => bundleFile(tmpFile, { check: false })),
38-
]);
39-
40-
return shebang
41-
.replace("#!/usr/bin/env dzx", "#!/usr/bin/env deno") +
42-
bundledScript;
32+
return bundleFile(await preBundle(
33+
script,
34+
options,
35+
), { check: false });
4336
}
4437

4538
export async function preBundle(
@@ -76,13 +69,13 @@ async function bundleFile(
7669
return Object.values(result.files)[0] as string;
7770
}
7871

79-
async function getShebang(script: string): Promise<string> {
80-
let shebang = "";
81-
const file = await Deno.open(script);
82-
const firstLine = await io.readLines(file).next();
83-
if (firstLine.value.startsWith("#!")) {
84-
shebang = firstLine.value + "\n";
85-
}
86-
file.close();
87-
return shebang;
88-
}
72+
// async function getShebang(script: string): Promise<string> {
73+
// let shebang = "";
74+
// const file = await Deno.open(script);
75+
// const firstLine = await io.readLines(file).next();
76+
// if (firstLine.value.startsWith("#!")) {
77+
// shebang = firstLine.value + "\n";
78+
// }
79+
// file.close();
80+
// return shebang;
81+
// }

0 commit comments

Comments
 (0)