@dolphjs/cli 1.0.6 → 1.0.7

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,16 +1,19 @@
1
1
  import { spawn } from "child_process";
2
2
  import chokidar from "chokidar";
3
3
  import chalk from "chalk";
4
+ import { fileURLToPath } from "url";
4
5
  import { getRootDirectory } from "../utils/get_root_dir_path.js";
5
6
  import { readConfig } from "../utils/read_user_config_path.js";
6
- import path, { join } from "path";
7
+ import path, { join, dirname } from "path";
7
8
  let fileExtension = "";
8
9
  let indexFilePath = "";
9
10
  export const startApp = () => {
10
11
  fileExtension = readConfig().language;
11
12
  indexFilePath = join(getRootDirectory(), `index.${fileExtension}`);
12
- const tsNodePath = path.join(__dirname, "node_modules", ".bin", "ts-node");
13
- const nodePath = path.join(__dirname, "node_modules", ".bin", "node");
13
+ const currentModuleFileUrl = import.meta.url;
14
+ const currentModuleDir = dirname(fileURLToPath(currentModuleFileUrl));
15
+ const tsNodePath = path.join(currentModuleDir, "node_modules", ".bin", "ts-node");
16
+ const nodePath = path.join(currentModuleDir, "node_modules", ".bin", "node");
14
17
  const child = spawn(fileExtension === "ts" ? tsNodePath : "node", [indexFilePath], { stdio: "inherit" });
15
18
  child.on("close", (code) => {
16
19
  if (code === 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolphjs/cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
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",