@dolphjs/cli 1.1.21 → 1.1.22
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/daemon/watcher.js +12 -5
- package/package.json +1 -1
package/dist/daemon/watcher.js
CHANGED
|
@@ -7,6 +7,7 @@ import { join } from "path";
|
|
|
7
7
|
import _ from "lodash";
|
|
8
8
|
let fileExtension = "";
|
|
9
9
|
let indexFilePath = "";
|
|
10
|
+
let child;
|
|
10
11
|
export const startApp = () => {
|
|
11
12
|
console.log(`${chalk.bold(chalk.yellow("[DOLPH INFO]: "))} ${chalk.yellowBright("starting dolph server ...")}`);
|
|
12
13
|
fileExtension = readConfig().language;
|
|
@@ -20,17 +21,20 @@ export const startApp = () => {
|
|
|
20
21
|
if (fileExtension === "js") {
|
|
21
22
|
spawnArgs = [indexFilePath];
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
if (child) {
|
|
25
|
+
// If child process is already running, gracefully close it before restarting
|
|
26
|
+
child.kill("SIGTERM");
|
|
27
|
+
}
|
|
28
|
+
child = spawn(fileExtension === "ts" ? "ts-node" : "node", spawnArgs, {
|
|
25
29
|
stdio: "inherit",
|
|
26
30
|
});
|
|
27
31
|
child.on("error", (err) => {
|
|
28
|
-
`${chalk.bold(chalk.red("[DOLPH ERROR]: "))} ${chalk.redBright(`${err}`)}
|
|
32
|
+
console.error(`${chalk.bold(chalk.red("[DOLPH ERROR]: "))} ${chalk.redBright(`${err}`)}`);
|
|
29
33
|
process.exit(1);
|
|
30
34
|
});
|
|
31
35
|
child.on("close", (code) => {
|
|
32
36
|
if (code === 1) {
|
|
33
|
-
`${chalk.bold(chalk.red("[DOLPH ERROR]: "))} ${chalk.redBright("exiting watch mode ...")}
|
|
37
|
+
console.error(`${chalk.bold(chalk.red("[DOLPH ERROR]: "))} ${chalk.redBright("exiting watch mode ...")}`);
|
|
34
38
|
process.exit(1);
|
|
35
39
|
}
|
|
36
40
|
});
|
|
@@ -66,7 +70,10 @@ export const startProdApp = () => {
|
|
|
66
70
|
console.log(`${chalk.bold(chalk.yellow("[DOLPH INFO]: "))} ${chalk.yellowBright("compiling to javascript ...")}`);
|
|
67
71
|
indexFilePath = join(getRootDirectory(), "src", `server.ts`);
|
|
68
72
|
const spawnArgs = ["src", "-d", "app", "--source-maps", "--copy-files"];
|
|
69
|
-
|
|
73
|
+
if (child) {
|
|
74
|
+
child.kill("SIGTERM");
|
|
75
|
+
}
|
|
76
|
+
child = spawn("swc", spawnArgs, {
|
|
70
77
|
stdio: "inherit",
|
|
71
78
|
});
|
|
72
79
|
child.on("error", (err) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dolphjs/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22",
|
|
4
4
|
"description": "The dolphjs-cli is a tool for efficient intialization and management of a dolphjs project",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"repository": "https://github.com/dolphjs/dolph-cli.git",
|