Skip to content

Commit e520f27

Browse files
committed
fix: execa
1 parent 4d44864 commit e520f27

File tree

2 files changed

+8
-25
lines changed

2 files changed

+8
-25
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli/framework/build.ts

+6-23
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,23 @@
11
import { execa } from "execa";
2-
import { readFile, writeFile, access } from "fs/promises";
2+
import { readFile, writeFile } from "fs/promises";
33
import { join } from "path";
44

55
export async function buildFramework() {
6-
if (process.argv.includes('create')) return;
7-
86
const projectDir = process.cwd();
9-
const tsconfigPath = join(projectDir, "tsconfig.json");
107

118
try {
12-
await access(tsconfigPath);
13-
149
await execa("npx", ["tsc"], {
1510
stdio: "inherit",
1611
reject: true,
1712
});
1813

19-
const distPath = join(projectDir, "dist");
14+
const indexPath = join(projectDir, "dist", "index.js");
2015
const shebang = "#!/usr/bin/env node\n";
2116

22-
const files = [
23-
join(distPath, "index.js"),
24-
join(distPath, "cli", "index.js")
25-
];
26-
27-
await Promise.all(files.map(async (file) => {
28-
try {
29-
const content = await readFile(file, "utf8");
30-
if (!content.startsWith(shebang)) {
31-
await writeFile(file, shebang + content);
32-
}
33-
} catch (error) {
34-
if (file.includes("cli")) return;
35-
throw error;
36-
}
37-
}));
17+
const content = await readFile(indexPath, "utf8");
18+
if (!content.startsWith(shebang)) {
19+
await writeFile(indexPath, shebang + content);
20+
}
3821
} catch (error) {
3922
console.error("Build failed:", error instanceof Error ? error.message : error);
4023
process.exit(1);

0 commit comments

Comments
 (0)