@expressots/cli 3.0.0 → 4.0.0-preview.3

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 (194) hide show
  1. package/README.md +41 -95
  2. package/bin/cicd/cli.d.ts +6 -0
  3. package/bin/cicd/cli.js +128 -0
  4. package/bin/cicd/form.d.ts +29 -0
  5. package/bin/cicd/form.js +346 -0
  6. package/bin/cicd/generators/azure-devops.d.ts +2 -0
  7. package/bin/cicd/generators/azure-devops.js +370 -0
  8. package/bin/cicd/generators/bitbucket.d.ts +2 -0
  9. package/bin/cicd/generators/bitbucket.js +217 -0
  10. package/bin/cicd/generators/circleci.d.ts +2 -0
  11. package/bin/cicd/generators/circleci.js +274 -0
  12. package/bin/cicd/generators/github-actions.d.ts +14 -0
  13. package/bin/cicd/generators/github-actions.js +426 -0
  14. package/bin/cicd/generators/gitlab-ci.d.ts +2 -0
  15. package/bin/cicd/generators/gitlab-ci.js +237 -0
  16. package/bin/cicd/generators/index.d.ts +6 -0
  17. package/bin/cicd/generators/index.js +15 -0
  18. package/bin/cicd/generators/jenkins.d.ts +2 -0
  19. package/bin/cicd/generators/jenkins.js +248 -0
  20. package/bin/cicd/generators/template-loader.d.ts +17 -0
  21. package/bin/cicd/generators/template-loader.js +128 -0
  22. package/bin/cicd/index.d.ts +1 -0
  23. package/bin/cicd/index.js +5 -0
  24. package/bin/cli.d.ts +1 -5
  25. package/bin/cli.js +72 -7
  26. package/bin/commands/project.commands.d.ts +19 -6
  27. package/bin/commands/project.commands.js +602 -66
  28. package/bin/config/index.d.ts +5 -0
  29. package/bin/config/index.js +10 -0
  30. package/bin/config/manager.d.ts +98 -0
  31. package/bin/config/manager.js +222 -0
  32. package/bin/containerize/analyzers/bootstrap-analyzer.d.ts +46 -0
  33. package/bin/containerize/analyzers/bootstrap-analyzer.js +187 -0
  34. package/bin/containerize/analyzers/project-analyzer.d.ts +20 -0
  35. package/bin/containerize/analyzers/project-analyzer.js +150 -0
  36. package/bin/containerize/cli.d.ts +4 -0
  37. package/bin/containerize/cli.js +113 -0
  38. package/bin/containerize/form.d.ts +15 -0
  39. package/bin/containerize/form.js +152 -0
  40. package/bin/containerize/generators/ci-generator.d.ts +31 -0
  41. package/bin/containerize/generators/ci-generator.js +940 -0
  42. package/bin/containerize/generators/docker-compose-generator.d.ts +8 -0
  43. package/bin/containerize/generators/docker-compose-generator.js +187 -0
  44. package/bin/containerize/generators/dockerfile-generator.d.ts +8 -0
  45. package/bin/containerize/generators/dockerfile-generator.js +657 -0
  46. package/bin/containerize/generators/kubernetes-generator.d.ts +8 -0
  47. package/bin/containerize/generators/kubernetes-generator.js +134 -0
  48. package/bin/containerize/generators/template-loader.d.ts +36 -0
  49. package/bin/containerize/generators/template-loader.js +129 -0
  50. package/bin/containerize/index.d.ts +4 -0
  51. package/bin/containerize/index.js +13 -0
  52. package/bin/containerize/presets/preset-registry.d.ts +20 -0
  53. package/bin/containerize/presets/preset-registry.js +102 -0
  54. package/bin/costs/cli.d.ts +5 -0
  55. package/bin/costs/cli.js +185 -0
  56. package/bin/costs/form.d.ts +44 -0
  57. package/bin/costs/form.js +412 -0
  58. package/bin/costs/index.d.ts +4 -0
  59. package/bin/costs/index.js +25 -0
  60. package/bin/costs/pricing-manager.d.ts +84 -0
  61. package/bin/costs/pricing-manager.js +342 -0
  62. package/bin/costs/providers/index.d.ts +32 -0
  63. package/bin/costs/providers/index.js +153 -0
  64. package/bin/costs/sources/api-source.d.ts +10 -0
  65. package/bin/costs/sources/api-source.js +32 -0
  66. package/bin/costs/sources/index.d.ts +6 -0
  67. package/bin/costs/sources/index.js +15 -0
  68. package/bin/costs/sources/local-json-source.d.ts +23 -0
  69. package/bin/costs/sources/local-json-source.js +59 -0
  70. package/bin/costs/sources/remote-json-source.d.ts +11 -0
  71. package/bin/costs/sources/remote-json-source.js +53 -0
  72. package/bin/costs/types.d.ts +53 -0
  73. package/bin/costs/types.js +5 -0
  74. package/bin/dev/cli.d.ts +4 -0
  75. package/bin/dev/cli.js +136 -0
  76. package/bin/dev/form.d.ts +36 -0
  77. package/bin/dev/form.js +254 -0
  78. package/bin/dev/index.d.ts +1 -0
  79. package/bin/dev/index.js +5 -0
  80. package/bin/generate/cli.d.ts +1 -1
  81. package/bin/generate/cli.js +29 -2
  82. package/bin/generate/form.d.ts +5 -1
  83. package/bin/generate/form.js +3 -3
  84. package/bin/generate/templates/nonopinionated/config.tpl +12 -0
  85. package/bin/generate/templates/nonopinionated/event.tpl +10 -0
  86. package/bin/generate/templates/nonopinionated/guard.tpl +18 -0
  87. package/bin/generate/templates/nonopinionated/handler.tpl +12 -0
  88. package/bin/generate/templates/nonopinionated/interceptor.tpl +27 -0
  89. package/bin/generate/templates/opinionated/config.tpl +47 -0
  90. package/bin/generate/templates/opinionated/entity.tpl +1 -8
  91. package/bin/generate/templates/opinionated/event.tpl +15 -0
  92. package/bin/generate/templates/opinionated/guard.tpl +41 -0
  93. package/bin/generate/templates/opinionated/handler.tpl +23 -0
  94. package/bin/generate/templates/opinionated/interceptor.tpl +50 -0
  95. package/bin/generate/utils/command-utils.d.ts +20 -5
  96. package/bin/generate/utils/command-utils.js +145 -48
  97. package/bin/generate/utils/nonopininated-cmd.d.ts +10 -1
  98. package/bin/generate/utils/nonopininated-cmd.js +100 -1
  99. package/bin/generate/utils/opinionated-cmd.d.ts +10 -1
  100. package/bin/generate/utils/opinionated-cmd.js +128 -16
  101. package/bin/generate/utils/string-utils.d.ts +6 -0
  102. package/bin/generate/utils/string-utils.js +13 -1
  103. package/bin/help/cli.d.ts +1 -1
  104. package/bin/help/command-help-registry.d.ts +23 -0
  105. package/bin/help/command-help-registry.js +303 -0
  106. package/bin/help/command-help.d.ts +36 -0
  107. package/bin/help/command-help.js +56 -0
  108. package/bin/help/form.js +127 -22
  109. package/bin/help/main-help.d.ts +8 -0
  110. package/bin/help/main-help.js +126 -0
  111. package/bin/help/render.d.ts +32 -0
  112. package/bin/help/render.js +46 -0
  113. package/bin/info/cli.d.ts +1 -1
  114. package/bin/info/form.d.ts +1 -1
  115. package/bin/info/form.js +11 -11
  116. package/bin/migrate/analyzers/platform-detector.d.ts +14 -0
  117. package/bin/migrate/analyzers/platform-detector.js +116 -0
  118. package/bin/migrate/cli.d.ts +6 -0
  119. package/bin/migrate/cli.js +98 -0
  120. package/bin/migrate/form.d.ts +25 -0
  121. package/bin/migrate/form.js +348 -0
  122. package/bin/migrate/generators/compose-to-k8s.d.ts +2 -0
  123. package/bin/migrate/generators/compose-to-k8s.js +324 -0
  124. package/bin/migrate/generators/compose-to-railway.d.ts +2 -0
  125. package/bin/migrate/generators/compose-to-railway.js +138 -0
  126. package/bin/migrate/generators/compose-to-render.d.ts +2 -0
  127. package/bin/migrate/generators/compose-to-render.js +148 -0
  128. package/bin/migrate/generators/generic-migration.d.ts +9 -0
  129. package/bin/migrate/generators/generic-migration.js +221 -0
  130. package/bin/migrate/generators/heroku-to-fly.d.ts +2 -0
  131. package/bin/migrate/generators/heroku-to-fly.js +291 -0
  132. package/bin/migrate/generators/heroku-to-railway.d.ts +2 -0
  133. package/bin/migrate/generators/heroku-to-railway.js +283 -0
  134. package/bin/migrate/generators/heroku-to-render.d.ts +2 -0
  135. package/bin/migrate/generators/heroku-to-render.js +148 -0
  136. package/bin/migrate/generators/index.d.ts +7 -0
  137. package/bin/migrate/generators/index.js +17 -0
  138. package/bin/migrate/generators/template-loader.d.ts +21 -0
  139. package/bin/migrate/generators/template-loader.js +59 -0
  140. package/bin/migrate/index.d.ts +1 -0
  141. package/bin/migrate/index.js +5 -0
  142. package/bin/new/cli.d.ts +5 -1
  143. package/bin/new/cli.js +77 -14
  144. package/bin/new/form.d.ts +27 -4
  145. package/bin/new/form.js +605 -75
  146. package/bin/profile/analyzers/dockerfile-analyzer.d.ts +27 -0
  147. package/bin/profile/analyzers/dockerfile-analyzer.js +122 -0
  148. package/bin/profile/analyzers/image-analyzer.d.ts +19 -0
  149. package/bin/profile/analyzers/image-analyzer.js +85 -0
  150. package/bin/profile/cli.d.ts +4 -0
  151. package/bin/profile/cli.js +94 -0
  152. package/bin/profile/form.d.ts +56 -0
  153. package/bin/profile/form.js +401 -0
  154. package/bin/profile/index.d.ts +1 -0
  155. package/bin/profile/index.js +5 -0
  156. package/bin/profile/optimizers/index.d.ts +19 -0
  157. package/bin/profile/optimizers/index.js +137 -0
  158. package/bin/providers/add/form.d.ts +1 -1
  159. package/bin/providers/add/form.js +27 -6
  160. package/bin/providers/create/form.js +53 -3
  161. package/bin/scripts/form.js +27 -5
  162. package/bin/studio/cli.d.ts +15 -0
  163. package/bin/studio/cli.js +172 -0
  164. package/bin/studio/index.d.ts +5 -0
  165. package/bin/studio/index.js +9 -0
  166. package/bin/templates/cache.d.ts +54 -0
  167. package/bin/templates/cache.js +180 -0
  168. package/bin/templates/cli.d.ts +8 -0
  169. package/bin/templates/cli.js +294 -0
  170. package/bin/templates/fetcher.d.ts +49 -0
  171. package/bin/templates/fetcher.js +208 -0
  172. package/bin/templates/index.d.ts +11 -0
  173. package/bin/templates/index.js +37 -0
  174. package/bin/templates/manager.d.ts +116 -0
  175. package/bin/templates/manager.js +323 -0
  176. package/bin/templates/renderer.d.ts +49 -0
  177. package/bin/templates/renderer.js +204 -0
  178. package/bin/templates/types.d.ts +51 -0
  179. package/bin/templates/types.js +5 -0
  180. package/bin/utils/add-module-to-container.d.ts +14 -3
  181. package/bin/utils/add-module-to-container.js +327 -98
  182. package/bin/utils/cli-ui.d.ts +49 -3
  183. package/bin/utils/cli-ui.js +133 -13
  184. package/bin/utils/index.d.ts +4 -0
  185. package/bin/utils/index.js +4 -0
  186. package/bin/utils/input-validation.d.ts +50 -0
  187. package/bin/utils/input-validation.js +143 -0
  188. package/bin/utils/package-manager-commands.d.ts +24 -0
  189. package/bin/utils/package-manager-commands.js +50 -0
  190. package/bin/utils/safe-spawn.d.ts +35 -0
  191. package/bin/utils/safe-spawn.js +51 -0
  192. package/bin/utils/update-tsconfig-paths.d.ts +35 -0
  193. package/bin/utils/update-tsconfig-paths.js +326 -0
  194. package/package.json +165 -156
package/bin/cli.js CHANGED
@@ -5,11 +5,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.BUNDLE_VERSION = void 0;
8
+ const fs_1 = require("fs");
9
+ const path_1 = require("path");
8
10
  const chalk_1 = __importDefault(require("chalk"));
9
- const process_1 = require("process");
10
11
  const yargs_1 = __importDefault(require("yargs"));
11
12
  const helpers_1 = require("yargs/helpers");
12
13
  const project_commands_1 = require("./commands/project.commands");
14
+ const containerize_1 = require("./containerize");
15
+ const cicd_1 = require("./cicd");
16
+ const migrate_1 = require("./migrate");
17
+ const profile_1 = require("./profile");
18
+ const dev_1 = require("./dev");
19
+ const costs_1 = require("./costs");
20
+ const templates_1 = require("./templates");
13
21
  const generate_1 = require("./generate");
14
22
  const cli_1 = require("./help/cli");
15
23
  const info_1 = require("./info");
@@ -17,13 +25,60 @@ const new_1 = require("./new");
17
25
  const providers_1 = require("./providers");
18
26
  const cli_2 = require("./providers/create/cli");
19
27
  const cli_ui_1 = require("./utils/cli-ui");
28
+ const main_help_1 = require("./help/main-help");
29
+ const command_help_registry_1 = require("./help/command-help-registry");
20
30
  const scripts_1 = require("./scripts");
31
+ const studio_1 = require("./studio");
21
32
  /**
22
33
  * The current version of the ExpressoTS Bundle.
23
- * core, adapters, and cli.
34
+ * Derived from this CLI package's own package.json — single source of truth.
35
+ * The compiled binary lives at `bin/cli.js`, so the package.json is one
36
+ * directory above `__dirname`. When running from source via tsx the layout
37
+ * is `src/cli.ts` -> `../package.json`, which still resolves correctly.
24
38
  */
25
- exports.BUNDLE_VERSION = "3.0.0";
26
- process_1.stdout.write(`\n${[chalk_1.default.bold.green("🐎 Expressots")]}\n\n`);
39
+ function readBundleVersion() {
40
+ try {
41
+ const pkgPath = (0, path_1.resolve)(__dirname, "..", "package.json");
42
+ const pkg = JSON.parse((0, fs_1.readFileSync)(pkgPath, "utf8"));
43
+ if (typeof pkg.version === "string" && pkg.version.length > 0) {
44
+ return pkg.version;
45
+ }
46
+ }
47
+ catch {
48
+ // fall through to the safe default below
49
+ }
50
+ return "0.0.0";
51
+ }
52
+ exports.BUNDLE_VERSION = readBundleVersion();
53
+ // Respect the NO_COLOR convention (https://no-color.org). chalk v4 does
54
+ // not auto-detect this, so we disable color output explicitly when the
55
+ // variable is present (regardless of its value).
56
+ if (process.env.NO_COLOR !== undefined) {
57
+ chalk_1.default.level = 0;
58
+ }
59
+ // Intercept the *top-level* help (and the bare no-command invocation)
60
+ // to render our refined, grouped help screen instead of the sprawling
61
+ // default yargs output. Per-command help (e.g. `new --help`) is left to
62
+ // yargs so its rich, command-specific epilogs still work.
63
+ const cliArgs = (0, helpers_1.hideBin)(process.argv);
64
+ const TOP_LEVEL_HELP_TOKENS = new Set(["help", "--help", "-h"]);
65
+ const isTopLevelHelp = cliArgs.length === 0 ||
66
+ (cliArgs.length === 1 && TOP_LEVEL_HELP_TOKENS.has(cliArgs[0]));
67
+ if (isTopLevelHelp) {
68
+ (0, main_help_1.printMainHelp)(exports.BUNDLE_VERSION);
69
+ process.exit(0);
70
+ }
71
+ // Intercept per-command help (e.g. `costs --help`) for commands that have a
72
+ // registered spec, rendering the same refined, grouped screen as the rest of
73
+ // the CLI. Commands without a spec fall through to yargs' default help.
74
+ if ((0, command_help_registry_1.tryPrintCommandHelp)(cliArgs, exports.BUNDLE_VERSION)) {
75
+ process.exit(0);
76
+ }
77
+ // Only show the banner in interactive terminals. When output is piped
78
+ // (CI, file redirection, shell completion), the header would be noise.
79
+ if (process.stdout.isTTY) {
80
+ (0, cli_ui_1.printHeader)(exports.BUNDLE_VERSION);
81
+ }
27
82
  (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
28
83
  .scriptName("expressots")
29
84
  .command((0, new_1.createProject)())
@@ -34,9 +89,18 @@ process_1.stdout.write(`\n${[chalk_1.default.bold.green("🐎 Expressots")]}\n\n
34
89
  .command((0, providers_1.addProviderCMD)())
35
90
  .command((0, providers_1.removeProviderCMD)())
36
91
  .command((0, generate_1.generateProject)())
92
+ .command((0, containerize_1.containerize)())
93
+ .command((0, cicd_1.cicdCommand)())
94
+ .command((0, migrate_1.migrateCommand)())
95
+ .command((0, profile_1.profileCommand)())
96
+ .command((0, dev_1.devContainerCommand)())
97
+ .command((0, costs_1.costsCommand)())
98
+ .command((0, templates_1.templatesCommand)())
37
99
  .command((0, scripts_1.scriptsCommand)())
100
+ .command((0, studio_1.studioCommand)())
38
101
  .command((0, info_1.infoProject)())
39
102
  .command((0, cli_1.helpCommand)())
103
+ .completion("completion", "Generate a shell completion script (bash/zsh)")
40
104
  .demandCommand(1, "You need at least one command before moving on")
41
105
  .strict()
42
106
  .fail((msg, err, yargs) => {
@@ -64,10 +128,11 @@ process_1.stdout.write(`\n${[chalk_1.default.bold.green("🐎 Expressots")]}\n\n
64
128
  process.exit(1);
65
129
  })
66
130
  .epilog(`${chalk_1.default.bold.green("For more information:")} \n\n` +
67
- "🌐 visit:\t https://expresso-ts.com\n" +
68
- "💖 Sponsor:\t https://github.com/sponsors/expressots")
131
+ `${"🌐 visit:".padEnd(12)} https://expresso-ts.com\n` +
132
+ `${"💖 Sponsor:".padEnd(12)} https://github.com/sponsors/expressots`)
69
133
  .help("help", "Show command help")
70
134
  .alias("h", "help")
71
- .version(false)
135
+ .version(exports.BUNDLE_VERSION)
136
+ .alias("V", "version")
72
137
  .wrap(140)
73
138
  .parse();
@@ -1,10 +1,18 @@
1
1
  import { CommandModule } from "yargs";
2
+ /**
3
+ * Dev command options interface
4
+ */
5
+ interface DevCommandOptions {
6
+ container?: boolean;
7
+ build?: boolean;
8
+ detach?: boolean;
9
+ }
2
10
  /**
3
11
  * Dev command module
4
- * @type {CommandModule<object, object>}
12
+ * @type {CommandModule<object, DevCommandOptions>}
5
13
  * @returns The command module
6
14
  */
7
- export declare const devCommand: CommandModule<object, object>;
15
+ export declare const devCommand: CommandModule<object, DevCommandOptions>;
8
16
  /**
9
17
  * Build command module
10
18
  * @type {CommandModule<object, object>}
@@ -18,9 +26,14 @@ export declare const buildCommand: CommandModule<object, object>;
18
26
  */
19
27
  export declare const prodCommand: CommandModule<object, object>;
20
28
  /**
21
- * Helper function to run a command
22
- * @param command The command to run
29
+ * Run command options
23
30
  */
24
- export declare const runCommand: ({ command, }: {
31
+ interface RunCommandOptions {
25
32
  command: string;
26
- }) => Promise<void>;
33
+ }
34
+ /**
35
+ * Helper function to run a command
36
+ * @param options The command options
37
+ */
38
+ export declare const runCommand: ({ command, }: RunCommandOptions) => Promise<void>;
39
+ export {};