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