@dolphjs/cli 1.1.4 → 1.1.6
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 +7 -2
- package/package.json +3 -1
package/dist/daemon/watcher.js
CHANGED
|
@@ -4,6 +4,7 @@ import chalk from "chalk";
|
|
|
4
4
|
import { getRootDirectory } from "../utils/get_root_dir_path.js";
|
|
5
5
|
import { readConfig } from "../utils/read_user_config_path.js";
|
|
6
6
|
import { join } from "path";
|
|
7
|
+
import { debounce } from "lodash";
|
|
7
8
|
let fileExtension = "";
|
|
8
9
|
let indexFilePath = "";
|
|
9
10
|
export const startApp = () => {
|
|
@@ -15,7 +16,10 @@ export const startApp = () => {
|
|
|
15
16
|
"tsconfig-paths/register",
|
|
16
17
|
"--transpile-only",
|
|
17
18
|
];
|
|
18
|
-
|
|
19
|
+
let spawnArgs = [...additionalOptions, indexFilePath];
|
|
20
|
+
if (fileExtension === "js") {
|
|
21
|
+
spawnArgs = [indexFilePath];
|
|
22
|
+
}
|
|
19
23
|
console.log(`${chalk.bold(chalk.green("[DOLPH INFO]: "))} ${chalk.greenBright("starting dolph server ...")}`);
|
|
20
24
|
const child = spawn(fileExtension === "ts" ? "ts-node" : "node", spawnArgs, {
|
|
21
25
|
stdio: "inherit",
|
|
@@ -101,6 +105,7 @@ const watcher = chokidar.watch([], {
|
|
|
101
105
|
ignoreInitial: false,
|
|
102
106
|
});
|
|
103
107
|
let isWatcherActive = false;
|
|
108
|
+
const debouncedStartApp = debounce(startApp, 1000);
|
|
104
109
|
export const watchFile = () => {
|
|
105
110
|
if (!isWatcherActive) {
|
|
106
111
|
console.log(`${chalk.bold(chalk.green("[DOLPH INFO]: "))} ${chalk.greenBright("watching files for changes ...")}`);
|
|
@@ -111,7 +116,7 @@ export const watchFile = () => {
|
|
|
111
116
|
watcher.on("all", (_event, path) => {
|
|
112
117
|
`${chalk.bold(chalk.green("[DOLPH INFO]: "))} ${chalk.greenBright("file changed" + `[${path}]`)}`;
|
|
113
118
|
if (path.endsWith(".ts") || path.endsWith(".js")) {
|
|
114
|
-
|
|
119
|
+
debouncedStartApp();
|
|
115
120
|
}
|
|
116
121
|
});
|
|
117
122
|
process.on("SIGINT", () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dolphjs/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
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",
|
|
@@ -46,11 +46,13 @@
|
|
|
46
46
|
"figlet": "^1.7.0",
|
|
47
47
|
"inquirer": "^9.2.12",
|
|
48
48
|
"js-yaml": "^4.1.0",
|
|
49
|
+
"lodash": "^4.17.21",
|
|
49
50
|
"rimraf": "^5.0.5"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@types/figlet": "^1.5.8",
|
|
53
54
|
"@types/inquirer": "^9.0.7",
|
|
55
|
+
"@types/lodash": "^4.14.202",
|
|
54
56
|
"@types/node": "^20.9.1",
|
|
55
57
|
"eslint": "^8.54.0",
|
|
56
58
|
"eslint-config-airbnb-base": "^15.0.0",
|