@absolutejs/absolute 0.13.3 → 0.13.5
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/dist/cli/index.js +9 -27
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -17,36 +17,16 @@ var readDbScripts = async () => {
|
|
|
17
17
|
return null;
|
|
18
18
|
return { upCommand, downCommand };
|
|
19
19
|
};
|
|
20
|
-
var execCommand = async (command, options) => {
|
|
21
|
-
const args = command.split(" ");
|
|
22
|
-
const proc = Bun.spawn(args, {
|
|
23
|
-
stdin: "inherit",
|
|
24
|
-
stdout: options?.silent ? "pipe" : "inherit",
|
|
25
|
-
stderr: options?.silent ? "pipe" : "inherit"
|
|
26
|
-
});
|
|
27
|
-
return proc.exited;
|
|
28
|
-
};
|
|
29
20
|
var startDatabase = async (scripts) => {
|
|
30
21
|
console.log("Starting database container...");
|
|
31
|
-
const exitCode = await
|
|
22
|
+
const { exitCode } = await Bun.$`${{ raw: scripts.upCommand }}`.nothrow();
|
|
32
23
|
if (exitCode !== 0)
|
|
33
24
|
process.exit(exitCode);
|
|
34
25
|
};
|
|
35
26
|
var stopDatabase = async (scripts) => {
|
|
36
27
|
console.log(`
|
|
37
28
|
Stopping database container...`);
|
|
38
|
-
|
|
39
|
-
const exitCode = await execCommand(scripts.downCommand, {
|
|
40
|
-
silent: true
|
|
41
|
-
});
|
|
42
|
-
if (exitCode === 0) {
|
|
43
|
-
console.log("Database container stopped.");
|
|
44
|
-
} else {
|
|
45
|
-
console.error("Failed to stop database container");
|
|
46
|
-
}
|
|
47
|
-
} catch {
|
|
48
|
-
console.error("Failed to stop database container");
|
|
49
|
-
}
|
|
29
|
+
await Bun.$`${{ raw: scripts.downCommand }}`.quiet().nothrow();
|
|
50
30
|
};
|
|
51
31
|
var dev = async (serverEntry) => {
|
|
52
32
|
const usesDocker = existsSync(resolve(COMPOSE_PATH));
|
|
@@ -59,22 +39,24 @@ var dev = async (serverEntry) => {
|
|
|
59
39
|
stderr: "inherit"
|
|
60
40
|
});
|
|
61
41
|
let cleaning = false;
|
|
62
|
-
const cleanup = async (
|
|
42
|
+
const cleanup = async (exitCode = 0) => {
|
|
63
43
|
if (cleaning)
|
|
64
44
|
return;
|
|
65
45
|
cleaning = true;
|
|
66
46
|
try {
|
|
67
47
|
server.kill();
|
|
68
|
-
} catch {
|
|
48
|
+
} catch (err) {
|
|
49
|
+
console.error("Failed to kill server process:", err);
|
|
50
|
+
}
|
|
69
51
|
await server.exited;
|
|
70
52
|
if (scripts)
|
|
71
53
|
await stopDatabase(scripts);
|
|
72
|
-
process.exit(
|
|
54
|
+
process.exit(exitCode);
|
|
73
55
|
};
|
|
74
56
|
process.on("SIGINT", () => cleanup(0));
|
|
75
57
|
process.on("SIGTERM", () => cleanup(0));
|
|
76
|
-
|
|
77
|
-
await cleanup(
|
|
58
|
+
await server.exited;
|
|
59
|
+
await cleanup(0);
|
|
78
60
|
};
|
|
79
61
|
var command = process.argv[2];
|
|
80
62
|
if (command === "dev") {
|
package/package.json
CHANGED