@dolphjs/cli 1.0.4 → 1.0.5

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.
@@ -1,5 +1,5 @@
1
1
  import { spawn } from "child_process";
2
- import { watch } from "fs";
2
+ 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";
@@ -25,11 +25,18 @@ export const watchFile = () => {
25
25
  fileExtension = readConfig().language;
26
26
  if (fileExtension === "js")
27
27
  runtimeEngine = "node";
28
- watch(indexFilePath, { recursive: true }, (_event, filenamae) => {
29
- if (filenamae && filenamae.endsWith(`.${fileExtension}`)) {
30
- console.log(chalk.bold(`${chalk.green("[DOLPH INFO]: ")} ${chalk.greenBright("file changed" + `[${filenamae}]`)}`));
31
- startApp();
32
- }
28
+ const watcher = chokidar.watch(indexFilePath, {
29
+ ignored: "/node_modules",
30
+ persistent: true,
31
+ ignoreInitial: true,
32
+ });
33
+ watcher.on("all", (_event, path) => {
34
+ chalk.bold(`${chalk.green("[DOLPH INFO]: ")} ${chalk.greenBright("file changed" + `[${path}]`)}`);
35
+ startApp();
36
+ });
37
+ process.on("SIGINT", () => {
38
+ watcher.close();
39
+ process.exit(0);
33
40
  });
34
41
  };
35
42
  // startApp();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolphjs/cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
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",
@@ -40,6 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "chalk": "^5.3.0",
43
+ "chokidar": "^3.5.3",
43
44
  "commander": "^11.1.0",
44
45
  "figlet": "^1.7.0",
45
46
  "inquirer": "^9.2.12",