@dolphjs/cli 1.1.19 → 1.1.21

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.
@@ -80,7 +80,7 @@ export const startProdApp = () => {
80
80
  }
81
81
  });
82
82
  }
83
- indexFilePath = join(getRootDirectory(), "app", `server.js`);
83
+ indexFilePath = join(getRootDirectory(), "app", "src", `server.js`);
84
84
  if (fileExtension === "js") {
85
85
  indexFilePath = join(getRootDirectory(), "src", `server.js`);
86
86
  }
@@ -28,7 +28,7 @@ import { autoInitMySql } from "@dolphjs/dolph/packages";`;
28
28
  else if (database === "mongo" && name.length) {
29
29
  importStatement = `import { DolphFactory } from "@dolphjs/dolph";
30
30
  import { ${capitalizedString}Component } from "./components/${name}/${name}.component.ts";
31
- import { autoInitMySql } from "@dolphjs/dolph/packages";`;
31
+ `;
32
32
  }
33
33
  else if (database === "mongo") {
34
34
  importStatement = `import { DolphFactory } from "@dolphjs/dolph";
@@ -87,8 +87,8 @@ export const initDolphCli = (appname) => {
87
87
  const yamlString = comment + yaml.dump(userConfig);
88
88
  writeFileSync(userConfigFilePath, yamlString, "utf8");
89
89
  if (userConfig.language === "ts") {
90
- writeSwcrc();
91
- writeTsConfigFile();
90
+ writeSwcrc(userConfig.routing === "spring" ? true : false);
91
+ writeTsConfigFile(userConfig.routing === "spring" ? true : false);
92
92
  }
93
93
  writeDolphConfig();
94
94
  writePackageJsonFile(projectName, userConfig.language);
@@ -1,8 +1,10 @@
1
1
  import * as fs from "fs";
2
2
  import { getRootDirectory } from "./get_root_dir_path.js";
3
3
  import { join } from "path";
4
- export function writeSwcrc() {
5
- const swcrcContent = `{
4
+ export function writeSwcrc(isSpring) {
5
+ let swcrcContent = ``;
6
+ if (!isSpring) {
7
+ swcrcContent = `{
6
8
  "jsc": {
7
9
  "parser": {
8
10
  "syntax": "typescript",
@@ -43,6 +45,51 @@ export function writeSwcrc() {
43
45
  }
44
46
  }
45
47
  `;
48
+ }
49
+ else {
50
+ swcrcContent = `{
51
+ "jsc": {
52
+ "parser": {
53
+ "syntax": "typescript",
54
+ "tsx": false,
55
+ "dynamicImport": true,
56
+ "decorators": true
57
+ },
58
+ "transform": {
59
+ "legacyDecorator": true,
60
+ "decoratorMetadata": true
61
+ },
62
+ "target": "es2022",
63
+ "externalHelpers": false,
64
+ "keepClassNames": true,
65
+ "loose": false,
66
+ "minify": {
67
+ "compress": false,
68
+ "mangle": false
69
+ },
70
+ "baseUrl": "src",
71
+ "paths": {
72
+ "@/*": ["*"],
73
+ "@/configs/*": ["shared/configs/*"],
74
+ "@/components/*": ["components/*"],
75
+ "@utils/*": ["shared/utils/*"],
76
+ "@shields/*": ["shared/shields/*"],
77
+ "@shared/*": ["shared/*"],
78
+ "@/helpers*": ["shared/helpers/*"],
79
+ "@/interfaces/*": ["shared/interfaces/*"],
80
+ "@/middlewares/*": ["shared/middlewares/*"],
81
+ "@/decorators/*": ["shared/decorators/*"],
82
+ "@/services/*": ["shared/services/*"],
83
+ "@/constants/*": ["shared/constants/*"],
84
+ "@/validations/*": ["shared/validations/*"]
85
+ }
86
+ },
87
+ "module": {
88
+ "type": "commonjs"
89
+ }
90
+ }
91
+ `;
92
+ }
46
93
  const filePath = join(getRootDirectory(), ".swcrc");
47
94
  fs.writeFileSync(filePath, swcrcContent, { encoding: "utf-8" });
48
95
  }
@@ -1,8 +1,11 @@
1
1
  import * as fs from "fs";
2
2
  import { getRootDirectory } from "./get_root_dir_path.js";
3
3
  import { join } from "path";
4
- export function writeTsConfigFile() {
5
- const tsConfigContent = `{
4
+ export function writeTsConfigFile(isSpring) {
5
+ let tsConfigContent = ``;
6
+ if (!isSpring) {
7
+ tsConfigContent = `
8
+ {
6
9
  "exclude": ["node_modules"],
7
10
  "compilerOptions": {
8
11
  "allowJs": false,
@@ -39,7 +42,53 @@ export function writeTsConfigFile() {
39
42
  "module": "CommonJS"
40
43
  }
41
44
  }
42
- }`;
45
+ }
46
+ `;
47
+ }
48
+ else {
49
+ tsConfigContent = `
50
+ {
51
+ "exclude": ["node_modules"],
52
+ "compilerOptions": {
53
+ "allowJs": false,
54
+ "declaration": false,
55
+ "experimentalDecorators": true,
56
+ "sourceMap": false,
57
+ "useUnknownInCatchVariables": false,
58
+ "strictFunctionTypes": false,
59
+ "forceConsistentCasingInFileNames": true,
60
+ "resolveJsonModule": true,
61
+ "esModuleInterop": true,
62
+ "target": "ES2022",
63
+ "baseUrl": "src",
64
+ "outDir": "app",
65
+ "pretty": true,
66
+ "module": "commonjs",
67
+ "paths": {
68
+ "@/*": ["*"],
69
+ "@/configs/*": ["shared/configs/*"],
70
+ "@/components/*": ["components/*"],
71
+ "@utils/*": ["shared/utils/*"],
72
+ "@shields/*": ["shared/shields/*"],
73
+ "@shared/*": ["shared/*"],
74
+ "@/helpers*": ["shared/helpers/*"],
75
+ "@/interfaces/*": ["shared/interfaces/*"],
76
+ "@/middlewares/*": ["shared/middlewares/*"],
77
+ "@/decorators/*": ["shared/decorators/*"],
78
+ "@/services/*": ["shared/services/*"],
79
+ "@/constants/*": ["shared/constants/*"],
80
+ "@/validations/*": ["shared/validations/*"]
81
+ }
82
+ },
83
+ "include": ["src/", ".env"],
84
+ "ts-node": {
85
+ "compilerOptions": {
86
+ "module": "CommonJS"
87
+ }
88
+ }
89
+ }
90
+ `;
91
+ }
43
92
  const filePath = join(getRootDirectory(), "tsconfig.json");
44
93
  fs.writeFileSync(filePath, tsConfigContent, { encoding: "utf-8" });
45
94
  }
@@ -10,7 +10,7 @@ export const writeConfig = (config) => {
10
10
  console.log(chalk.green("Configurations saved successfully! 😎."));
11
11
  }
12
12
  catch (e) {
13
- console.log(chalk.bold(chalk.red("Error encountered reading config file, please run 'dolph tr' to initialize config file 🥹")));
13
+ console.log(chalk.bold(chalk.red("Error encountered reading config file, please run 'dolph cf' to initialize config file 🥹")));
14
14
  process.exit(1);
15
15
  }
16
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolphjs/cli",
3
- "version": "1.1.19",
3
+ "version": "1.1.21",
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",
@@ -38,6 +38,11 @@
38
38
  "dolph": "./dist/index.js",
39
39
  "dc": "./dist/index.js"
40
40
  },
41
+ "peerDependencies": {
42
+ "ts-node": "^10.9.2",
43
+ "@swc/cli": "^0.1.62",
44
+ "@swc/core": "^1.3.91"
45
+ },
41
46
  "dependencies": {
42
47
  "chalk": "^5.3.0",
43
48
  "chokidar": "^3.5.3",