@dolphjs/cli 1.2.0 → 1.2.2

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.
@@ -22,8 +22,12 @@ export const startApp = () => {
22
22
  spawnArgs = [indexFilePath];
23
23
  }
24
24
  if (child) {
25
+ child.on("exit", () => {
26
+ child = null;
27
+ });
25
28
  // If child process is already running, gracefully close it before restarting
26
29
  child.kill("SIGTERM");
30
+ // child.kill("SIGKILL");
27
31
  }
28
32
  child = spawn(fileExtension === "ts" ? "ts-node" : "node", spawnArgs, {
29
33
  stdio: "inherit",
@@ -35,6 +39,7 @@ export const startApp = () => {
35
39
  child.on("close", (code) => {
36
40
  if (code === 1) {
37
41
  console.error(`${chalk.bold(chalk.red("[DOLPH ERROR]: "))} ${chalk.redBright("exiting watch mode ...")}`);
42
+ child = null;
38
43
  process.exit(1);
39
44
  }
40
45
  });
@@ -71,6 +76,9 @@ export const startProdApp = () => {
71
76
  indexFilePath = join(getRootDirectory(), "src", `server.ts`);
72
77
  const spawnArgs = ["src", "-d", "app", "--source-maps", "--copy-files"];
73
78
  if (child) {
79
+ child.on("exit", () => {
80
+ child = null;
81
+ });
74
82
  child.kill("SIGTERM");
75
83
  }
76
84
  child = spawn("swc", spawnArgs, {
@@ -5,7 +5,7 @@ export const generateSpringComponent = (componentName) => {
5
5
  const className = capitalizeFirstLetter(componentName) + "Component";
6
6
  const template = `import { Component } from "@dolphjs/dolph/decorators";
7
7
 
8
- @Component({ controllers: [] })
8
+ @Component({ controllers: [], services: [] })
9
9
  export class ${className} {}
10
10
  `;
11
11
  return template;
@@ -24,7 +24,7 @@ export const addControllerInComponentFIle = async (componentName) => {
24
24
  const fileContent = `import { Component } from "@dolphjs/dolph/decorators";
25
25
  import { ${capitalizedString}Controller } from "./${componentName}.controller";
26
26
 
27
- @Component({ controllers: [${capitalizedString}Controller] })
27
+ @Component({ controllers: [${capitalizedString}Controller], services: [] })
28
28
  export class ${capitalizedString}Component {}
29
29
  `;
30
30
  writeFileSync(componentPath, fileContent);
@@ -32,7 +32,7 @@ import { ${capitalizedString}Component } from "./components/${name}/${name}.comp
32
32
  }
33
33
  else if (database === "mongo") {
34
34
  importStatement = `import { DolphFactory } from "@dolphjs/dolph";
35
- import { autoInitMySql } from "@dolphjs/dolph/packages";`;
35
+ `;
36
36
  }
37
37
  if (database === "mysql" && name) {
38
38
  otherFileContent = `const dolph = new DolphFactory([${capitalizedString}Component]);
@@ -103,7 +103,7 @@ export const initDolphCli = (appname) => {
103
103
  addSpringServerFile(userConfig.database, "");
104
104
  }
105
105
  dolphMsg.infoBlue("dolph configurations have been initialized successfully ✨.");
106
- dolphMsg.infoYellow("run `yarn install` to install dependencies in project directory and start building 🚀.");
106
+ dolphMsg.infoBlue("run `yarn install` to install dependencies in project directory and start building 🚀.");
107
107
  process.exit(0);
108
108
  });
109
109
  }
@@ -2,6 +2,6 @@ import chalk from "chalk";
2
2
  import { program } from "commander";
3
3
  export const packageDescription = () => {
4
4
  program
5
- .version("1.1.0")
6
- .description(chalk.cyan("The dolph-cli is a tool for efficient intialization and management of a dolphjs project"));
5
+ .version("1.2.2")
6
+ .description(chalk.cyan("The dolph-cli is a tool for efficient initialization and management of a dolphjs project"));
7
7
  };
@@ -22,11 +22,12 @@ export function writePackageJsonFile(name, extension) {
22
22
  "clean": "rm -r app && rm -r logs"
23
23
  },
24
24
  "dependencies": {
25
- "@dolphjs/dolph": "^1.2.0"
25
+ "@dolphjs/dolph": "^1.3.2"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@swc/cli": "^0.1.62",
29
29
  "@swc/core": "^1.3.91",
30
+ "@types/express": "^4.17.21",
30
31
  "@types/node": "^20.8.2",
31
32
  "ts-node": "^10.9.1",
32
33
  "tsc-alias": "^1.8.8",
@@ -52,7 +53,7 @@ export function writePackageJsonFile(name, extension) {
52
53
  "start": "dolph start"
53
54
  },
54
55
  "dependencies": {
55
- "@dolphjs/dolph": "^1.2.0"
56
+ "@dolphjs/dolph": "^1.3.2"
56
57
  }
57
58
  }
58
59
  `;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dolphjs/cli",
3
- "version": "1.2.0",
4
- "description": "The dolphjs-cli is a tool for efficient intialization and management of a dolphjs project",
3
+ "version": "1.2.2",
4
+ "description": "The dolphjs-cli is a tool for efficient initialization and management of a dolphjs project",
5
5
  "main": "./dist/index.js",
6
6
  "repository": "https://github.com/dolphjs/dolph-cli.git",
7
7
  "author": "<https://github.com/Xlaez>",