@dolphjs/cli 1.0.20 → 1.0.21
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
CHANGED
|
@@ -7,6 +7,7 @@ import { join } from "path";
|
|
|
7
7
|
let fileExtension = "";
|
|
8
8
|
let indexFilePath = "";
|
|
9
9
|
export const startApp = () => {
|
|
10
|
+
console.log(chalk.bold(`${chalk.yellow("[DOLPH INFO]: ")} ${chalk.yellowBright("starting dolph server ...")}`));
|
|
10
11
|
fileExtension = readConfig().language;
|
|
11
12
|
indexFilePath = join(getRootDirectory(), "src", `server.${fileExtension}`);
|
|
12
13
|
const additionalOptions = [
|
|
@@ -15,6 +16,7 @@ export const startApp = () => {
|
|
|
15
16
|
"--transpile-only",
|
|
16
17
|
];
|
|
17
18
|
const spawnArgs = [...additionalOptions, indexFilePath];
|
|
19
|
+
console.log(chalk.bold(`${chalk.green("[DOLPH INFO]: ")} ${chalk.greenBright("starting dolph server ...")}`));
|
|
18
20
|
const child = spawn(fileExtension === "ts" ? "ts-node" : "node", spawnArgs, {
|
|
19
21
|
stdio: "inherit",
|
|
20
22
|
});
|
|
@@ -25,6 +27,34 @@ export const startApp = () => {
|
|
|
25
27
|
}
|
|
26
28
|
});
|
|
27
29
|
};
|
|
30
|
+
export const startProdApp = () => {
|
|
31
|
+
fileExtension = readConfig().language;
|
|
32
|
+
if (fileExtension === "ts") {
|
|
33
|
+
console.log(chalk.bold(`${chalk.yellow("[DOLPH INFO]: ")} ${chalk.yellowBright("compiling to javascript ...")}`));
|
|
34
|
+
}
|
|
35
|
+
indexFilePath = join(getRootDirectory(), "src", `server.${fileExtension}`);
|
|
36
|
+
const spawnArgs = ["src", "-d", "app", "--source-maps", "--copy-files"];
|
|
37
|
+
const child = spawn("swc", spawnArgs, {
|
|
38
|
+
stdio: "inherit",
|
|
39
|
+
});
|
|
40
|
+
console.log(chalk.bold(`${chalk.green("[DOLPH INFO]: ")} ${chalk.greenBright("starting dolph server ...")}`));
|
|
41
|
+
child.on("close", (code) => {
|
|
42
|
+
if (code === 1) {
|
|
43
|
+
console.log(chalk.bold(`${chalk.red("[DOLPH ERROR]: ")} ${chalk.redBright("exiting compilation ...")}`));
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
indexFilePath = join(getRootDirectory(), "app", `server.${fileExtension}`);
|
|
48
|
+
const child2 = spawn("node", indexFilePath, {
|
|
49
|
+
stdio: "inherit",
|
|
50
|
+
});
|
|
51
|
+
child2.on("close", (code) => {
|
|
52
|
+
if (code === 1) {
|
|
53
|
+
console.log(chalk.bold(`${chalk.red("[DOLPH ERROR]: ")} ${chalk.redBright("exiting watch mode ...")}`));
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
};
|
|
28
58
|
export const watchFile = () => {
|
|
29
59
|
console.log(chalk.bold(`${chalk.green("[DOLPH INFO]: ")} ${chalk.greenBright("watching files for changes ...")}`));
|
|
30
60
|
fileExtension = readConfig().language;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { program } from "commander";
|
|
2
|
-
import {
|
|
2
|
+
import { startProdApp, watchFile } from "./watcher.js";
|
|
3
3
|
export const watcherConfig = () => {
|
|
4
4
|
program
|
|
5
5
|
.command("start")
|
|
6
6
|
.description("starts the dolphjs application")
|
|
7
|
-
.action(() =>
|
|
7
|
+
.action(() => startProdApp());
|
|
8
8
|
program
|
|
9
9
|
.command("watch")
|
|
10
10
|
.description("starts the dolphjs application in watch mode")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dolphjs/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
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",
|