@dolphjs/cli 1.0.5 → 1.0.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 +5 -8
- package/package.json +1 -1
package/dist/daemon/watcher.js
CHANGED
|
@@ -3,16 +3,15 @@ import chokidar from "chokidar";
|
|
|
3
3
|
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
|
-
import { join } from "path";
|
|
6
|
+
import path, { join } from "path";
|
|
7
7
|
let fileExtension = "";
|
|
8
|
-
let runtimeEngine = "ts-node";
|
|
9
8
|
let indexFilePath = "";
|
|
10
9
|
export const startApp = () => {
|
|
11
10
|
fileExtension = readConfig().language;
|
|
12
|
-
if (fileExtension === "js")
|
|
13
|
-
runtimeEngine = "node";
|
|
14
11
|
indexFilePath = join(getRootDirectory(), `index.${fileExtension}`);
|
|
15
|
-
const
|
|
12
|
+
const tsNodePath = path.join(__dirname, "node_modules", ".bin", "ts-node");
|
|
13
|
+
const nodePath = path.join(__dirname, "node_modules", ".bin", "node");
|
|
14
|
+
const child = spawn(fileExtension === "ts" ? tsNodePath : "node", [indexFilePath], { stdio: "inherit" });
|
|
16
15
|
child.on("close", (code) => {
|
|
17
16
|
if (code === 1) {
|
|
18
17
|
console.log(chalk.bold(`${chalk.red("[DOLPH ERROR]: ")} ${chalk.redBright("exiting watch mode ...")}`));
|
|
@@ -23,12 +22,10 @@ export const startApp = () => {
|
|
|
23
22
|
export const watchFile = () => {
|
|
24
23
|
console.log(chalk.bold(`${chalk.green("[DOLPH INFO]: ")} ${chalk.greenBright("watching files for changes ...")}`));
|
|
25
24
|
fileExtension = readConfig().language;
|
|
26
|
-
if (fileExtension === "js")
|
|
27
|
-
runtimeEngine = "node";
|
|
28
25
|
const watcher = chokidar.watch(indexFilePath, {
|
|
29
26
|
ignored: "/node_modules",
|
|
30
27
|
persistent: true,
|
|
31
|
-
ignoreInitial:
|
|
28
|
+
ignoreInitial: false,
|
|
32
29
|
});
|
|
33
30
|
watcher.on("all", (_event, path) => {
|
|
34
31
|
chalk.bold(`${chalk.green("[DOLPH INFO]: ")} ${chalk.greenBright("file changed" + `[${path}]`)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dolphjs/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.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",
|