create-svc 0.1.30 → 0.1.32
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/package.json +1 -1
- package/src/post-scaffold.ts +15 -9
package/package.json
CHANGED
package/src/post-scaffold.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ScaffoldConfig } from "./scaffold";
|
|
2
|
-
import {
|
|
2
|
+
import { mkdir } from "node:fs/promises";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
3
4
|
|
|
4
5
|
type CommandOptions = {
|
|
5
6
|
cwd: string;
|
|
@@ -33,7 +34,7 @@ export async function runPostScaffoldFlow(config: ScaffoldConfig, cwd: string) {
|
|
|
33
34
|
for (const command of buildDeploymentVerificationCommands(config)) {
|
|
34
35
|
runWithRetries(command, { cwd, quiet: true }, DEPLOYMENT_VERIFY_ATTEMPTS, DEPLOYMENT_VERIFY_DELAY_MS);
|
|
35
36
|
}
|
|
36
|
-
startLocalDevelopment(config, cwd);
|
|
37
|
+
await startLocalDevelopment(config, cwd);
|
|
37
38
|
for (const command of buildLocalVerificationCommands(config)) {
|
|
38
39
|
runWithRetries(command, { cwd, quiet: true }, 18, 5_000);
|
|
39
40
|
}
|
|
@@ -43,14 +44,19 @@ export async function runPostScaffoldFlow(config: ScaffoldConfig, cwd: string) {
|
|
|
43
44
|
return { message: "Backend package generated" };
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
function startLocalDevelopment(config: Pick<ScaffoldConfig, "target">, cwd: string) {
|
|
47
|
-
if (config.target === "workers") {
|
|
48
|
-
run("sh", ["-c", "mkdir -p .service && bun run dev > .service/local-dev.log 2>&1 & echo $! > .service/local-dev.pid"], { cwd });
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
|
|
47
|
+
async function startLocalDevelopment(config: Pick<ScaffoldConfig, "target">, cwd: string) {
|
|
52
48
|
run("bun", ["run", "migrate"], { cwd });
|
|
53
|
-
|
|
49
|
+
await mkdir(join(cwd, ".service"), { recursive: true });
|
|
50
|
+
const child = Bun.spawn(["sh", "-c", "exec bun run dev > .service/local-dev.log 2>&1 < /dev/null"], {
|
|
51
|
+
cwd,
|
|
52
|
+
env: postScaffoldEnv(),
|
|
53
|
+
stdin: "ignore",
|
|
54
|
+
stdout: "ignore",
|
|
55
|
+
stderr: "ignore",
|
|
56
|
+
detached: true,
|
|
57
|
+
});
|
|
58
|
+
child.unref();
|
|
59
|
+
await Bun.write(join(cwd, ".service", "local-dev.pid"), `${child.pid}\n`);
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
function runWithRetries(command: PostScaffoldCommand, options: CommandOptions, attempts: number, delayMs: number) {
|