@expressots/cli 1.12.0 → 3.0.0-beta.1

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.
Files changed (43) hide show
  1. package/bin/cli.d.ts +5 -1
  2. package/bin/cli.js +7 -0
  3. package/bin/commands/project.commands.js +4 -15
  4. package/bin/generate/templates/nonopinionated/module.tpl +1 -2
  5. package/bin/generate/templates/opinionated/controller-service-delete.tpl +6 -14
  6. package/bin/generate/templates/opinionated/controller-service-get.tpl +7 -15
  7. package/bin/generate/templates/opinionated/controller-service-patch.tpl +7 -17
  8. package/bin/generate/templates/opinionated/controller-service-post.tpl +7 -14
  9. package/bin/generate/templates/opinionated/controller-service-put.tpl +7 -17
  10. package/bin/generate/templates/opinionated/controller-service.tpl +1 -2
  11. package/bin/generate/templates/opinionated/module-service.tpl +1 -2
  12. package/bin/generate/templates/opinionated/module.tpl +1 -2
  13. package/bin/generate/utils/command-utils.d.ts +1 -1
  14. package/bin/generate/utils/command-utils.js +12 -12
  15. package/bin/generate/utils/nonopininated-cmd.d.ts +1 -1
  16. package/bin/generate/utils/nonopininated-cmd.js +12 -12
  17. package/bin/generate/utils/opinionated-cmd.d.ts +1 -1
  18. package/bin/generate/utils/opinionated-cmd.js +12 -12
  19. package/bin/generate/utils/string-utils.d.ts +36 -0
  20. package/bin/generate/utils/string-utils.js +71 -0
  21. package/bin/help/form.js +5 -1
  22. package/bin/index.d.ts +0 -1
  23. package/bin/index.js +0 -1
  24. package/bin/info/form.js +3 -13
  25. package/bin/new/form.js +37 -21
  26. package/bin/providers/add/cli.d.ts +1 -0
  27. package/bin/providers/add/cli.js +27 -4
  28. package/bin/providers/add/form.d.ts +2 -1
  29. package/bin/providers/add/form.js +72 -39
  30. package/bin/providers/create/form.js +1 -1
  31. package/bin/utils/add-module-to-container.js +16 -11
  32. package/bin/utils/compiler.d.ts +1 -1
  33. package/package.json +19 -20
  34. package/bin/@types/config.d.ts +0 -39
  35. package/bin/@types/config.js +0 -2
  36. package/bin/@types/index.d.ts +0 -1
  37. package/bin/@types/index.js +0 -17
  38. package/bin/app.container.d.ts +0 -1
  39. package/bin/app.container.js +0 -8
  40. package/bin/commands/__tests__/project.commands.spec.d.ts +0 -1
  41. package/bin/commands/__tests__/project.commands.spec.js +0 -8
  42. package/bin/types.d.ts +0 -1
  43. package/bin/types.js +0 -17
package/bin/help/form.js CHANGED
@@ -19,7 +19,11 @@ const helpForm = async () => {
19
19
  "service",
20
20
  "g s",
21
21
  "Generate a service [controller, usecase, dto, module]",
22
- ], ["controller", "g c", "Generate a controller"], ["usecase", "g u", "Generate a usecase"], ["dto", "g d", "Generate a dto"], ["entity", "g e", "Generate an entity"], ["provider", "g p", "Generate internal provider"], ["provider", "add", "Add external provider to the project"], ["provider", "create", "Create external provider"], ["module", "g mo", "Generate a module"], ["middleware", "g mi", "Generate a middleware"]);
22
+ ], ["controller", "g c", "Generate a controller"], ["usecase", "g u", "Generate a usecase"], ["dto", "g d", "Generate a dto"], ["entity", "g e", "Generate an entity"], ["provider", "g p", "Generate internal provider"], [
23
+ "provider",
24
+ "add",
25
+ "Add provider to the project. Use -d to add as dev dependency",
26
+ ], ["provider", "remove", "Remove provider from the project"], ["provider", "create", "Create external provider"], ["module", "g mo", "Generate a module"], ["middleware", "g mi", "Generate a middleware"]);
23
27
  console.log(chalk_1.default.bold.white("ExpressoTS:", `${chalk_1.default.green("Resources List")}`));
24
28
  console.log(chalk_1.default.whiteBright(table.toString()));
25
29
  console.log(chalk_1.default.bold.white(`📝 More info: ${chalk_1.default.green("https://doc.expresso-ts.com/docs/category/cli")}`));
package/bin/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from "./types";
2
1
  export * from "./generate";
3
2
  export * from "./utils";
4
3
  export * from "./new";
package/bin/index.js CHANGED
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
17
  __exportStar(require("./generate"), exports);
19
18
  __exportStar(require("./utils"), exports);
20
19
  __exportStar(require("./new"), exports);
package/bin/info/form.js CHANGED
@@ -5,11 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.infoForm = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
- const path_1 = __importDefault(require("path"));
9
8
  const fs_1 = __importDefault(require("fs"));
10
9
  const os_1 = __importDefault(require("os"));
10
+ const path_1 = __importDefault(require("path"));
11
+ const cli_1 = require("../cli");
11
12
  const cli_ui_1 = require("../utils/cli-ui");
12
- const axios_1 = __importDefault(require("axios"));
13
13
  function getInfosFromPackage() {
14
14
  try {
15
15
  // Get the absolute path of the input directory parameter
@@ -33,16 +33,6 @@ const infoForm = () => {
33
33
  console.log(chalk_1.default.green("System information:"));
34
34
  console.log(chalk_1.default.white(`\tOS Version: ${os_1.default.version()}`));
35
35
  console.log(chalk_1.default.white(`\tNodeJS version: ${process.version}`));
36
- currentCLIVersion();
36
+ (0, cli_ui_1.printSuccess)("CLI version:", cli_1.BUNDLE_VERSION);
37
37
  };
38
38
  exports.infoForm = infoForm;
39
- async function currentCLIVersion() {
40
- try {
41
- const response = await axios_1.default.get("https://api.github.com/repos/expressots/expressots-cli/releases");
42
- const latestRelease = `v${response.data[0].tag_name}`;
43
- (0, cli_ui_1.printSuccess)("CLI version:", latestRelease);
44
- }
45
- catch (error) {
46
- (0, cli_ui_1.printError)("Error:", error.message);
47
- }
48
- }
package/bin/new/form.js CHANGED
@@ -14,48 +14,64 @@ const node_path_1 = __importDefault(require("node:path"));
14
14
  const center_text_1 = require("../utils/center-text");
15
15
  const cli_ui_1 = require("../utils/cli-ui");
16
16
  const change_package_info_1 = require("../utils/change-package-info");
17
+ const cli_1 = require("../cli");
17
18
  async function packageManagerInstall({ packageManager, directory, progressBar, }) {
19
+ const command = process.platform === "win32" ? `${packageManager}.cmd` : packageManager;
20
+ const args = ["install", "--prefer-offline", "--silent"];
21
+ if (packageManager === "yarn") {
22
+ args.push("--ignore-engines");
23
+ args.splice(args.indexOf("--prefer-offline"), 1);
24
+ }
18
25
  return new Promise((resolve, reject) => {
19
- const isWindows = process.platform === "win32";
20
- const command = isWindows
21
- ? `${packageManager}.cmd`
22
- : packageManager;
23
- const installProcess = (0, node_child_process_1.spawn)(command, ["install", "--prefer-offline"], {
26
+ const installProcess = (0, node_child_process_1.spawn)(command, args, {
24
27
  cwd: directory,
25
28
  shell: true,
26
29
  timeout: 600000,
27
30
  });
28
- // eslint-disable-next-line prefer-const
29
- let installTimeout;
30
- installProcess.on("error", (error) => {
31
- clearTimeout(installTimeout);
32
- reject(new Error(`Failed to start subprocess: ${error.message}`));
33
- });
31
+ // Simulate incremental progress
32
+ let progress = 0;
33
+ const interval = setInterval(() => {
34
+ if (progress < 90) {
35
+ progress += 5;
36
+ progressBar.update(progress);
37
+ }
38
+ }, 1000);
39
+ // Handle stdout for meaningful output or progress feedback
34
40
  installProcess.stdout?.on("data", (data) => {
35
41
  const output = data.toString().trim();
36
- const npmProgressMatch = output.match(/\[(\d+)\/(\d+)\] (?:npm )?([\w\s]+)\.{3}/);
42
+ // Remove all data from || to the end of the line
43
+ const cleanedOutput = output.replace(/\|\|.*$/g, "");
44
+ // Match and handle npm-specific progress
45
+ const npmProgressMatch = cleanedOutput.match(/\[(\d+)\/(\d+)\] (?:npm )?([\w\s]+)\.{3}/);
37
46
  if (npmProgressMatch) {
38
47
  const [, current, total, task] = npmProgressMatch;
39
- const progress = Math.round((parseInt(current) / parseInt(total)) * 100);
48
+ progress = Math.round((parseInt(current) / parseInt(total)) * 100);
40
49
  progressBar.update(progress, { doing: task });
41
50
  }
42
51
  else {
43
- progressBar.increment(5, { doing: output });
52
+ // Update "task" without changing the progress
53
+ progressBar.update(progress, { doing: cleanedOutput });
44
54
  }
45
55
  });
56
+ // Handle errors
57
+ installProcess.on("error", (error) => {
58
+ clearInterval(interval); // Stop interval on error
59
+ progressBar.stop();
60
+ reject(new Error(`Failed to start subprocess: ${error.message}`));
61
+ });
62
+ // Finalize progress on close
46
63
  installProcess.on("close", (code) => {
47
- clearTimeout(installTimeout);
64
+ clearInterval(interval); // Stop interval when the process ends
48
65
  if (code === 0) {
66
+ progressBar.update(100, { doing: "Complete!" }); // Finalize progress
67
+ progressBar.stop();
49
68
  resolve("Installation Done!");
50
69
  }
51
70
  else {
71
+ progressBar.stop();
52
72
  reject(new Error(`${packageManager} install exited with code ${code}`));
53
73
  }
54
74
  });
55
- installTimeout = setTimeout(() => {
56
- installProcess.kill("SIGKILL");
57
- reject(new Error("Installation took too long. Aborted!"));
58
- }, 600000);
59
75
  });
60
76
  }
61
77
  async function checkIfPackageManagerExists(packageManager) {
@@ -164,8 +180,9 @@ const projectForm = async (projectName, args) => {
164
180
  doing: "Cloning project",
165
181
  });
166
182
  const [_, template] = answer.template.match(/(.*) ::/);
183
+ const repo = `expressots/templates/${templates[template]}#${cli_1.BUNDLE_VERSION}`;
167
184
  try {
168
- const emitter = (0, degit_1.default)(`expressots/expressots/templates/${templates[template]}`);
185
+ const emitter = (0, degit_1.default)(`expressots/templates/${templates[template]}`);
169
186
  await emitter.clone(answer.name);
170
187
  }
171
188
  catch (err) {
@@ -186,7 +203,6 @@ const projectForm = async (projectName, args) => {
186
203
  directory: answer.name,
187
204
  name: projectName,
188
205
  });
189
- renameEnvFile(answer.name);
190
206
  progressBar.update(100);
191
207
  progressBar.stop();
192
208
  console.log("\n");
@@ -1,4 +1,5 @@
1
1
  import { CommandModule } from "yargs";
2
2
  type CommandModuleArgs = {};
3
3
  export declare const addProviderCMD: () => CommandModule<CommandModuleArgs, any>;
4
+ export declare const removeProviderCMD: () => CommandModule<CommandModuleArgs, any>;
4
5
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addProviderCMD = void 0;
3
+ exports.removeProviderCMD = exports.addProviderCMD = void 0;
4
4
  const form_1 = require("./form");
5
5
  const addProviderCMD = () => {
6
6
  return {
@@ -15,14 +15,37 @@ const addProviderCMD = () => {
15
15
  .option("version", {
16
16
  describe: "The provider version to be installed",
17
17
  type: "string",
18
- default: "latest",
18
+ default: false,
19
19
  alias: "v",
20
+ })
21
+ .option("dev", {
22
+ describe: "Add provider as a dev dependency",
23
+ type: "boolean",
24
+ default: false,
25
+ alias: "d",
20
26
  });
21
27
  return yargs;
22
28
  },
23
- handler: async ({ provider, version }) => {
24
- await (0, form_1.addExternalProvider)(provider, version);
29
+ handler: async ({ provider, version, dev }) => {
30
+ await (0, form_1.addProvider)(provider, version, dev);
25
31
  },
26
32
  };
27
33
  };
28
34
  exports.addProviderCMD = addProviderCMD;
35
+ const removeProviderCMD = () => {
36
+ return {
37
+ command: "remove <provider>",
38
+ describe: "Remove provider from the project.",
39
+ builder: (yargs) => {
40
+ yargs.positional("provider", {
41
+ describe: "The provider to be removed from the project",
42
+ type: "string",
43
+ });
44
+ return yargs;
45
+ },
46
+ handler: async ({ provider: packageName }) => {
47
+ await (0, form_1.removeProvider)(packageName);
48
+ },
49
+ };
50
+ };
51
+ exports.removeProviderCMD = removeProviderCMD;
@@ -1 +1,2 @@
1
- export declare const addExternalProvider: (provider: string, version: string) => Promise<void>;
1
+ export declare function addProvider(packageName: string, version?: string, isDevDependency?: boolean): Promise<void>;
2
+ export declare function removeProvider(packageName: string): Promise<void>;
@@ -3,66 +3,99 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.addExternalProvider = void 0;
6
+ exports.removeProvider = exports.addProvider = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const node_child_process_1 = require("node:child_process");
9
9
  const node_fs_1 = __importDefault(require("node:fs"));
10
10
  const node_process_1 = require("node:process");
11
11
  const cli_ui_1 = require("../../utils/cli-ui");
12
- const addExternalProvider = async (provider, version) => {
13
- await installProvider(provider, version);
12
+ const PACKAGE_MANAGERS = {
13
+ npm: {
14
+ install: "install",
15
+ addDev: "install --save-dev",
16
+ remove: "uninstall",
17
+ },
18
+ yarn: {
19
+ install: "add",
20
+ addDev: "add --dev",
21
+ remove: "remove",
22
+ },
23
+ pnpm: {
24
+ install: "add",
25
+ addDev: "add --save-dev",
26
+ remove: "remove",
27
+ },
14
28
  };
15
- exports.addExternalProvider = addExternalProvider;
16
- async function installProvider(provider, version) {
17
- const packageManager = node_fs_1.default.existsSync("package-lock.json" || "yarn.lock" || "pnpm-lock.yaml")
18
- ? "npm"
19
- : node_fs_1.default.existsSync("yarn.lock")
20
- ? "yarn"
21
- : node_fs_1.default.existsSync("pnpm-lock.yaml")
22
- ? "pnpm"
23
- : null;
24
- if (packageManager) {
25
- console.log(`Installing ${provider} provider ...`);
26
- const currentVersion = version === "latest" ? "" : `@${version}`;
27
- await execProcess({
28
- commandArg: packageManager,
29
- args: ["add", `${provider}${currentVersion}`, "--prefer-offline"],
30
- directory: process.cwd(),
31
- });
32
- }
33
- else {
34
- (0, cli_ui_1.printError)("No package manager found in the project", "install-provider");
35
- return;
29
+ function detectPackageManager() {
30
+ const lockFiles = ["package-lock.json", "yarn.lock", "pnpm-lock.yaml"];
31
+ const managers = Object.keys(PACKAGE_MANAGERS);
32
+ for (let i = 0; i < lockFiles.length; i++) {
33
+ if (node_fs_1.default.existsSync(lockFiles[i])) {
34
+ return managers[i];
35
+ }
36
36
  }
37
+ return null;
37
38
  }
38
- async function execProcess({ commandArg, args, directory, }) {
39
+ async function execProcess({ command, args, directory, }) {
39
40
  return new Promise((resolve, reject) => {
40
41
  const isWindows = process.platform === "win32";
41
- const command = isWindows ? `${commandArg}.cmd` : commandArg;
42
- const installProcess = (0, node_child_process_1.spawn)(command, args, {
42
+ const execCommand = isWindows ? `${command}.cmd` : command;
43
+ const processRunner = (0, node_child_process_1.spawn)(execCommand, args, {
43
44
  cwd: directory,
44
45
  shell: true,
45
46
  });
46
- console.log(chalk_1.default.bold.blue(`Executing: ${commandArg} ${args.join(" ")}`));
47
+ console.log(chalk_1.default.bold.blue(`Executing: ${command} ${args.join(" ")}`));
47
48
  console.log(chalk_1.default.yellow("-------------------------------------------------"));
48
- installProcess.stdout.on("data", (data) => {
49
- console.log(chalk_1.default.green(data.toString().trim())); // Display regular messages in green
49
+ processRunner.stdout.on("data", (data) => {
50
+ console.log(chalk_1.default.green(data.toString().trim()));
50
51
  });
51
- installProcess.stderr.on("data", (data) => {
52
- console.error(chalk_1.default.red(data.toString().trim())); // Display error messages in red
52
+ processRunner.stderr.on("data", (data) => {
53
+ console.error(chalk_1.default.red(data.toString().trim()));
53
54
  });
54
- installProcess.on("close", (code) => {
55
+ processRunner.on("close", (code) => {
55
56
  if (code === 0) {
56
- console.log(chalk_1.default.bold.green("-------------------------------------------------"));
57
- console.log(chalk_1.default.bold.green("Installation Done!\n"));
58
- resolve("Installation Done!");
57
+ console.log(chalk_1.default.bold.green("Operation completed successfully!\n"));
58
+ resolve();
59
59
  }
60
60
  else {
61
- console.error(chalk_1.default.bold.red("---------------------------------------"));
62
- console.error(chalk_1.default.bold.red(`Command ${command} ${args.join(" ")} exited with code ${code}`));
63
- reject(new Error(`Command ${command} ${args.join(" ")} exited with code ${code}`));
61
+ console.error(chalk_1.default.bold.red(`Command failed with exit code ${code}`));
62
+ reject(new Error(`Command failed with exit code ${code}`));
64
63
  (0, node_process_1.exit)(1);
65
64
  }
66
65
  });
67
66
  });
68
67
  }
68
+ async function addProvider(packageName, version, isDevDependency = false) {
69
+ const packageManager = detectPackageManager();
70
+ if (!packageManager) {
71
+ (0, cli_ui_1.printError)("No package manager found in the project", "add-package");
72
+ return;
73
+ }
74
+ const pkgManagerConfig = PACKAGE_MANAGERS[packageManager];
75
+ const command = isDevDependency
76
+ ? pkgManagerConfig.addDev
77
+ : pkgManagerConfig.install;
78
+ const versionSuffix = version && version !== "latest" ? `@${version}` : "";
79
+ console.log(`${isDevDependency ? "Adding devDependency" : "Installing"} ${packageName}...`);
80
+ await execProcess({
81
+ command: packageManager,
82
+ args: [...command.split(" "), `${packageName}${versionSuffix}`],
83
+ directory: process.cwd(),
84
+ });
85
+ }
86
+ exports.addProvider = addProvider;
87
+ async function removeProvider(packageName) {
88
+ const packageManager = detectPackageManager();
89
+ if (!packageManager) {
90
+ (0, cli_ui_1.printError)("No package manager found in the project", "remove-package");
91
+ return;
92
+ }
93
+ const command = PACKAGE_MANAGERS[packageManager].remove;
94
+ console.log(`Removing ${packageName}...`);
95
+ await execProcess({
96
+ command: packageManager,
97
+ args: [...command.split(" "), packageName],
98
+ directory: process.cwd(),
99
+ });
100
+ }
101
+ exports.removeProvider = removeProvider;
@@ -39,7 +39,7 @@ const createExternalProvider = async (provider) => {
39
39
  ]);
40
40
  }
41
41
  try {
42
- const emitter = (0, degit_1.default)(`expressots/expressots-provider-template`);
42
+ const emitter = (0, degit_1.default)(`expressots/templates/provider`);
43
43
  await emitter.clone(providerInfo.providerName);
44
44
  (0, change_package_info_1.changePackageName)({
45
45
  directory: providerInfo.providerName,
@@ -9,11 +9,12 @@ const glob_1 = require("glob");
9
9
  const node_fs_1 = __importDefault(require("node:fs"));
10
10
  const cli_ui_1 = require("./cli-ui");
11
11
  const compiler_1 = __importDefault(require("./compiler"));
12
- const APP_CONTAINER = "app.container.ts";
12
+ const APP_CONTAINER = "app.ts";
13
13
  async function validateAppContainer() {
14
14
  const { sourceRoot } = await compiler_1.default.loadConfig();
15
15
  const imports = [];
16
16
  const notImports = [];
17
+ // Locate the container file
17
18
  const path = (0, glob_1.globSync)(`./${sourceRoot}/${APP_CONTAINER}`, {
18
19
  absolute: true,
19
20
  ignore: "**/node_modules/**",
@@ -22,7 +23,9 @@ async function validateAppContainer() {
22
23
  (0, cli_ui_1.printError)("Module not added to Container. Container file not found!", APP_CONTAINER);
23
24
  process.exit(1);
24
25
  }
26
+ // Read the container file
25
27
  const fileContent = await node_fs_1.default.promises.readFile(path[0], "utf8");
28
+ // Collect imports and other lines
26
29
  fileContent.split("\n").forEach((line) => {
27
30
  if (line.startsWith("import")) {
28
31
  imports.push(line);
@@ -31,28 +34,30 @@ async function validateAppContainer() {
31
34
  notImports.push(line);
32
35
  }
33
36
  });
34
- // Validate the file content
35
- const moduleDeclarationRegex = /.create\(\s*\[([\s\S]*?)]/;
36
- const moduleDeclarationMatch = fileContent.match(moduleDeclarationRegex);
37
- if (!moduleDeclarationMatch) {
38
- (0, cli_ui_1.printError)("Container format incorrect!", APP_CONTAINER);
37
+ // Regex to detect and extract modules from configContainer
38
+ const moduleRegex = /this\.configContainer\(\s*\[\s*([\s\S]*?)\s*]\s*\)/;
39
+ const moduleMatch = fileContent.match(moduleRegex);
40
+ if (!moduleMatch) {
41
+ (0, cli_ui_1.printError)("The App class does not contain a valid configContainer([]) declaration!", APP_CONTAINER);
39
42
  process.exit(1);
40
43
  }
41
- const modules = moduleDeclarationMatch[1]
44
+ // Extract modules if present
45
+ const modules = moduleMatch[1]
42
46
  .trim()
43
47
  .split(",")
44
48
  .filter((m) => m.trim() !== "")
45
49
  .map((m) => m.trim());
46
50
  return {
47
- regex: moduleDeclarationRegex,
51
+ regex: moduleRegex,
48
52
  path: path[0],
49
- content: moduleDeclarationMatch,
53
+ content: fileContent,
50
54
  modules,
51
55
  imports,
52
56
  notImports,
53
57
  };
54
58
  }
55
59
  async function addModuleToContainer(name, modulePath, path) {
60
+ console.log("To chamando esse cara");
56
61
  const containerData = await validateAppContainer();
57
62
  const moduleName = (name[0].toUpperCase() + name.slice(1)).trimStart();
58
63
  const { opinionated } = await compiler_1.default.loadConfig();
@@ -83,7 +88,7 @@ async function addModuleToContainer(name, modulePath, path) {
83
88
  containerData.imports.push(newImport);
84
89
  containerData.modules.push(`${moduleName}Module`);
85
90
  const newModule = containerData.modules.join(", ");
86
- const newModuleDeclaration = `.create([${newModule}]`;
91
+ const newModuleDeclaration = `this.configContainer([${newModule}])`;
87
92
  const newFileContent = [
88
93
  ...containerData.imports,
89
94
  ...containerData.notImports,
@@ -116,7 +121,7 @@ async function addModuleToContainerNestedPath(name, path) {
116
121
  containerData.imports.push(newImport);
117
122
  containerData.modules.push(`${moduleName}Module`);
118
123
  const newModule = containerData.modules.join(", ");
119
- const newModuleDeclaration = `.create([${newModule}]`;
124
+ const newModuleDeclaration = `this.configContainer([${newModule}])`;
120
125
  const newFileContent = [
121
126
  ...containerData.imports,
122
127
  ...containerData.notImports,
@@ -1,5 +1,5 @@
1
1
  import { Service } from "ts-node";
2
- import { ExpressoConfig } from "../types";
2
+ import { ExpressoConfig } from "@expressots/shared";
3
3
  /**
4
4
  * Singleton compiler class
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressots/cli",
3
- "version": "1.12.0",
3
+ "version": "3.0.0-beta.1",
4
4
  "description": "Expressots CLI - modern, fast, lightweight nodejs web framework (@cli)",
5
5
  "author": "Richard Zampieri",
6
6
  "license": "MIT",
@@ -8,10 +8,11 @@
8
8
  "url": "https://github.com/expressots/expressots-cli/issues"
9
9
  },
10
10
  "bin": {
11
- "expressots": "bin/cli.js"
11
+ "expressots": "bin/cli.js",
12
+ "ex": "bin/cli.js"
12
13
  },
13
14
  "engines": {
14
- "node": ">=18.0.0"
15
+ "node": ">=20.18.0"
15
16
  },
16
17
  "funding": {
17
18
  "type": "github",
@@ -34,23 +35,22 @@
34
35
  "prepare": "husky",
35
36
  "start:build": "npm run build && npm run start",
36
37
  "start": "node ./bin/cli.js",
37
- "start:dev": "tsnd ./src/cli.ts",
38
- "build": "npm run clean && tsc -p tsconfig.json && yarn cp:templates && chmod +x ./bin/cli.js",
39
- "cp:templates": "cp -r ./src/generate/templates ./bin/generate/templates",
40
- "clean": "rimraf ./bin",
38
+ "start:dev": "tsx ./src/cli.ts",
39
+ "build": "npm run clean && tsc -p tsconfig.json && npm run cp:templates && node scripts/chmod.js ./bin/cli.js",
40
+ "cp:templates": "node scripts/cp.js ./src/generate/templates ./bin/generate/",
41
+ "clean": "node scripts/rm.js bin",
41
42
  "prepublish": "npm run build && npm pack",
42
43
  "publish": "npm publish --tag latest",
43
44
  "format": "prettier --write \"./src/**/*.ts\" --cache",
44
45
  "lint": "eslint \"./src/**/*.ts\"",
45
46
  "lint:fix": "eslint \"./src/**/*.ts\" --fix",
46
47
  "release": "release-it",
47
- "test": "vitest run --reporter default",
48
- "test:watch": "vitest",
49
- "coverage": "vitest run --coverage"
48
+ "test": "jest",
49
+ "coverage": "jest --coverage",
50
+ "test:watch": "jest --watch"
50
51
  },
51
52
  "dependencies": {
52
- "@expressots/boost-ts": "1.3.0",
53
- "axios": "^1.7.3",
53
+ "axios": "1.7.7",
54
54
  "chalk-animation": "2.0.3",
55
55
  "cli-progress": "3.12.0",
56
56
  "cli-table3": "0.6.5",
@@ -58,7 +58,7 @@
58
58
  "glob": "10.4.5",
59
59
  "inquirer": "8.2.6",
60
60
  "mustache": "4.2.0",
61
- "semver": "7.6.2",
61
+ "semver": "7.6.3",
62
62
  "ts-node": "10.9.2",
63
63
  "yargs": "17.7.2"
64
64
  },
@@ -66,31 +66,30 @@
66
66
  "@codecov/vite-plugin": "^0.0.1-beta.9",
67
67
  "@commitlint/cli": "19.2.1",
68
68
  "@commitlint/config-conventional": "19.1.0",
69
+ "@expressots/shared": "0.1.0",
69
70
  "@release-it/conventional-changelog": "7.0.2",
70
71
  "@types/chalk-animation": "1.6.1",
71
72
  "@types/cli-progress": "3.11.0",
72
73
  "@types/degit": "2.8.3",
73
74
  "@types/inquirer": "9.0.3",
75
+ "@types/jest": "^29.5.14",
74
76
  "@types/mustache": "4.2.2",
75
77
  "@types/node": "20.12.7",
76
78
  "@types/yargs": "17.0.22",
77
79
  "@typescript-eslint/eslint-plugin": "7.6.0",
78
80
  "@typescript-eslint/parser": "7.6.0",
79
- "@vitest/coverage-v8": "1.4.0",
80
81
  "chalk": "4.1.2",
81
82
  "eslint": "8.57.0",
82
83
  "eslint-config-prettier": "9.1.0",
83
84
  "husky": "9.0.11",
85
+ "jest": "^29.7.0",
84
86
  "prettier": "3.2.5",
85
87
  "reflect-metadata": "0.2.2",
86
88
  "release-it": "16.3.0",
87
- "rimraf": "5.0.5",
88
89
  "shx": "0.3.4",
89
- "ts-node-dev": "2.0.0",
90
- "typescript": "5.2.2",
91
- "vite": "5.2.8",
92
- "vite-tsconfig-paths": "4.3.2",
93
- "vitest": "1.4.0"
90
+ "ts-jest": "^29.2.5",
91
+ "tsx": "^4.19.2",
92
+ "typescript": "5.2.2"
94
93
  },
95
94
  "release-it": {
96
95
  "git": {
@@ -1,39 +0,0 @@
1
- export declare const enum Pattern {
2
- LOWER_CASE = "lowercase",
3
- KEBAB_CASE = "kebab-case",
4
- PASCAL_CASE = "PascalCase",
5
- CAMEL_CASE = "camelCase"
6
- }
7
- interface IProviders {
8
- prisma?: {
9
- schemaName: string;
10
- schemaPath: string;
11
- entitiesPath: string;
12
- entityNamePattern: string;
13
- };
14
- }
15
- /**
16
- * The configuration object for the Expresso CLI.
17
- *
18
- * @property {Pattern} scaffoldPattern - The pattern to use when scaffolding files.
19
- * @property {string} sourceRoot - The root directory for the source files.
20
- * @property {boolean} opinionated - Whether or not to use the opinionated configuration.
21
- *
22
- * @see [ExpressoConfig](https://expresso-ts.com/docs)
23
- */
24
- export interface ExpressoConfig {
25
- scaffoldPattern: Pattern;
26
- sourceRoot: string;
27
- opinionated: boolean;
28
- providers?: IProviders;
29
- scaffoldSchematics?: {
30
- entity?: string;
31
- controller?: string;
32
- usecase?: string;
33
- dto?: string;
34
- module?: string;
35
- provider?: string;
36
- middleware?: string;
37
- };
38
- }
39
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export * from "./config";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./config"), exports);
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /* import { AppContainer } from "@expressots/core";
4
-
5
- export const appContainer = new AppContainer();
6
-
7
- export const container = appContainer.create([]);
8
- */
@@ -1 +0,0 @@
1
- export {};