@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.
- package/README.md +41 -95
- package/bin/cicd/cli.d.ts +6 -0
- package/bin/cicd/cli.js +128 -0
- package/bin/cicd/form.d.ts +29 -0
- package/bin/cicd/form.js +346 -0
- package/bin/cicd/generators/azure-devops.d.ts +2 -0
- package/bin/cicd/generators/azure-devops.js +370 -0
- package/bin/cicd/generators/bitbucket.d.ts +2 -0
- package/bin/cicd/generators/bitbucket.js +217 -0
- package/bin/cicd/generators/circleci.d.ts +2 -0
- package/bin/cicd/generators/circleci.js +274 -0
- package/bin/cicd/generators/github-actions.d.ts +14 -0
- package/bin/cicd/generators/github-actions.js +426 -0
- package/bin/cicd/generators/gitlab-ci.d.ts +2 -0
- package/bin/cicd/generators/gitlab-ci.js +237 -0
- package/bin/cicd/generators/index.d.ts +6 -0
- package/bin/cicd/generators/index.js +15 -0
- package/bin/cicd/generators/jenkins.d.ts +2 -0
- package/bin/cicd/generators/jenkins.js +248 -0
- package/bin/cicd/generators/template-loader.d.ts +17 -0
- package/bin/cicd/generators/template-loader.js +128 -0
- package/bin/cicd/index.d.ts +1 -0
- package/bin/cicd/index.js +5 -0
- package/bin/cli.d.ts +1 -5
- package/bin/cli.js +72 -7
- package/bin/commands/project.commands.d.ts +19 -6
- package/bin/commands/project.commands.js +602 -66
- package/bin/config/index.d.ts +5 -0
- package/bin/config/index.js +10 -0
- package/bin/config/manager.d.ts +98 -0
- package/bin/config/manager.js +222 -0
- package/bin/containerize/analyzers/bootstrap-analyzer.d.ts +46 -0
- package/bin/containerize/analyzers/bootstrap-analyzer.js +187 -0
- package/bin/containerize/analyzers/project-analyzer.d.ts +20 -0
- package/bin/containerize/analyzers/project-analyzer.js +150 -0
- package/bin/containerize/cli.d.ts +4 -0
- package/bin/containerize/cli.js +113 -0
- package/bin/containerize/form.d.ts +15 -0
- package/bin/containerize/form.js +152 -0
- package/bin/containerize/generators/ci-generator.d.ts +31 -0
- package/bin/containerize/generators/ci-generator.js +940 -0
- package/bin/containerize/generators/docker-compose-generator.d.ts +8 -0
- package/bin/containerize/generators/docker-compose-generator.js +187 -0
- package/bin/containerize/generators/dockerfile-generator.d.ts +8 -0
- package/bin/containerize/generators/dockerfile-generator.js +657 -0
- package/bin/containerize/generators/kubernetes-generator.d.ts +8 -0
- package/bin/containerize/generators/kubernetes-generator.js +134 -0
- package/bin/containerize/generators/template-loader.d.ts +36 -0
- package/bin/containerize/generators/template-loader.js +129 -0
- package/bin/containerize/index.d.ts +4 -0
- package/bin/containerize/index.js +13 -0
- package/bin/containerize/presets/preset-registry.d.ts +20 -0
- package/bin/containerize/presets/preset-registry.js +102 -0
- package/bin/costs/cli.d.ts +5 -0
- package/bin/costs/cli.js +185 -0
- package/bin/costs/form.d.ts +44 -0
- package/bin/costs/form.js +412 -0
- package/bin/costs/index.d.ts +4 -0
- package/bin/costs/index.js +25 -0
- package/bin/costs/pricing-manager.d.ts +84 -0
- package/bin/costs/pricing-manager.js +342 -0
- package/bin/costs/providers/index.d.ts +32 -0
- package/bin/costs/providers/index.js +153 -0
- package/bin/costs/sources/api-source.d.ts +10 -0
- package/bin/costs/sources/api-source.js +32 -0
- package/bin/costs/sources/index.d.ts +6 -0
- package/bin/costs/sources/index.js +15 -0
- package/bin/costs/sources/local-json-source.d.ts +23 -0
- package/bin/costs/sources/local-json-source.js +59 -0
- package/bin/costs/sources/remote-json-source.d.ts +11 -0
- package/bin/costs/sources/remote-json-source.js +53 -0
- package/bin/costs/types.d.ts +53 -0
- package/bin/costs/types.js +5 -0
- package/bin/dev/cli.d.ts +4 -0
- package/bin/dev/cli.js +136 -0
- package/bin/dev/form.d.ts +36 -0
- package/bin/dev/form.js +254 -0
- package/bin/dev/index.d.ts +1 -0
- package/bin/dev/index.js +5 -0
- package/bin/generate/cli.d.ts +1 -1
- package/bin/generate/cli.js +29 -2
- package/bin/generate/form.d.ts +5 -1
- package/bin/generate/form.js +3 -3
- package/bin/generate/templates/nonopinionated/config.tpl +12 -0
- package/bin/generate/templates/nonopinionated/event.tpl +10 -0
- package/bin/generate/templates/nonopinionated/guard.tpl +18 -0
- package/bin/generate/templates/nonopinionated/handler.tpl +12 -0
- package/bin/generate/templates/nonopinionated/interceptor.tpl +27 -0
- package/bin/generate/templates/opinionated/config.tpl +47 -0
- package/bin/generate/templates/opinionated/entity.tpl +1 -8
- package/bin/generate/templates/opinionated/event.tpl +15 -0
- package/bin/generate/templates/opinionated/guard.tpl +41 -0
- package/bin/generate/templates/opinionated/handler.tpl +23 -0
- package/bin/generate/templates/opinionated/interceptor.tpl +50 -0
- package/bin/generate/utils/command-utils.d.ts +20 -5
- package/bin/generate/utils/command-utils.js +145 -48
- package/bin/generate/utils/nonopininated-cmd.d.ts +10 -1
- package/bin/generate/utils/nonopininated-cmd.js +100 -1
- package/bin/generate/utils/opinionated-cmd.d.ts +10 -1
- package/bin/generate/utils/opinionated-cmd.js +128 -16
- package/bin/generate/utils/string-utils.d.ts +6 -0
- package/bin/generate/utils/string-utils.js +13 -1
- package/bin/help/cli.d.ts +1 -1
- package/bin/help/command-help-registry.d.ts +23 -0
- package/bin/help/command-help-registry.js +303 -0
- package/bin/help/command-help.d.ts +36 -0
- package/bin/help/command-help.js +56 -0
- package/bin/help/form.js +127 -22
- package/bin/help/main-help.d.ts +8 -0
- package/bin/help/main-help.js +126 -0
- package/bin/help/render.d.ts +32 -0
- package/bin/help/render.js +46 -0
- package/bin/info/cli.d.ts +1 -1
- package/bin/info/form.d.ts +1 -1
- package/bin/info/form.js +11 -11
- package/bin/migrate/analyzers/platform-detector.d.ts +14 -0
- package/bin/migrate/analyzers/platform-detector.js +116 -0
- package/bin/migrate/cli.d.ts +6 -0
- package/bin/migrate/cli.js +98 -0
- package/bin/migrate/form.d.ts +25 -0
- package/bin/migrate/form.js +348 -0
- package/bin/migrate/generators/compose-to-k8s.d.ts +2 -0
- package/bin/migrate/generators/compose-to-k8s.js +324 -0
- package/bin/migrate/generators/compose-to-railway.d.ts +2 -0
- package/bin/migrate/generators/compose-to-railway.js +138 -0
- package/bin/migrate/generators/compose-to-render.d.ts +2 -0
- package/bin/migrate/generators/compose-to-render.js +148 -0
- package/bin/migrate/generators/generic-migration.d.ts +9 -0
- package/bin/migrate/generators/generic-migration.js +221 -0
- package/bin/migrate/generators/heroku-to-fly.d.ts +2 -0
- package/bin/migrate/generators/heroku-to-fly.js +291 -0
- package/bin/migrate/generators/heroku-to-railway.d.ts +2 -0
- package/bin/migrate/generators/heroku-to-railway.js +283 -0
- package/bin/migrate/generators/heroku-to-render.d.ts +2 -0
- package/bin/migrate/generators/heroku-to-render.js +148 -0
- package/bin/migrate/generators/index.d.ts +7 -0
- package/bin/migrate/generators/index.js +17 -0
- package/bin/migrate/generators/template-loader.d.ts +21 -0
- package/bin/migrate/generators/template-loader.js +59 -0
- package/bin/migrate/index.d.ts +1 -0
- package/bin/migrate/index.js +5 -0
- package/bin/new/cli.d.ts +5 -1
- package/bin/new/cli.js +77 -14
- package/bin/new/form.d.ts +27 -4
- package/bin/new/form.js +605 -75
- package/bin/profile/analyzers/dockerfile-analyzer.d.ts +27 -0
- package/bin/profile/analyzers/dockerfile-analyzer.js +122 -0
- package/bin/profile/analyzers/image-analyzer.d.ts +19 -0
- package/bin/profile/analyzers/image-analyzer.js +85 -0
- package/bin/profile/cli.d.ts +4 -0
- package/bin/profile/cli.js +94 -0
- package/bin/profile/form.d.ts +56 -0
- package/bin/profile/form.js +401 -0
- package/bin/profile/index.d.ts +1 -0
- package/bin/profile/index.js +5 -0
- package/bin/profile/optimizers/index.d.ts +19 -0
- package/bin/profile/optimizers/index.js +137 -0
- package/bin/providers/add/form.d.ts +1 -1
- package/bin/providers/add/form.js +27 -6
- package/bin/providers/create/form.js +53 -3
- package/bin/scripts/form.js +27 -5
- package/bin/studio/cli.d.ts +15 -0
- package/bin/studio/cli.js +172 -0
- package/bin/studio/index.d.ts +5 -0
- package/bin/studio/index.js +9 -0
- package/bin/templates/cache.d.ts +54 -0
- package/bin/templates/cache.js +180 -0
- package/bin/templates/cli.d.ts +8 -0
- package/bin/templates/cli.js +294 -0
- package/bin/templates/fetcher.d.ts +49 -0
- package/bin/templates/fetcher.js +208 -0
- package/bin/templates/index.d.ts +11 -0
- package/bin/templates/index.js +37 -0
- package/bin/templates/manager.d.ts +116 -0
- package/bin/templates/manager.js +323 -0
- package/bin/templates/renderer.d.ts +49 -0
- package/bin/templates/renderer.js +204 -0
- package/bin/templates/types.d.ts +51 -0
- package/bin/templates/types.js +5 -0
- package/bin/utils/add-module-to-container.d.ts +14 -3
- package/bin/utils/add-module-to-container.js +327 -98
- package/bin/utils/cli-ui.d.ts +49 -3
- package/bin/utils/cli-ui.js +133 -13
- package/bin/utils/index.d.ts +4 -0
- package/bin/utils/index.js +4 -0
- package/bin/utils/input-validation.d.ts +50 -0
- package/bin/utils/input-validation.js +143 -0
- package/bin/utils/package-manager-commands.d.ts +24 -0
- package/bin/utils/package-manager-commands.js +50 -0
- package/bin/utils/safe-spawn.d.ts +35 -0
- package/bin/utils/safe-spawn.js +51 -0
- package/bin/utils/update-tsconfig-paths.d.ts +35 -0
- package/bin/utils/update-tsconfig-paths.js +326 -0
- 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
|
-
*
|
|
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
|
-
|
|
26
|
-
|
|
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
|
|
68
|
-
"💖 Sponsor
|
|
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(
|
|
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,
|
|
12
|
+
* @type {CommandModule<object, DevCommandOptions>}
|
|
5
13
|
* @returns The command module
|
|
6
14
|
*/
|
|
7
|
-
export declare const devCommand: CommandModule<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
|
-
*
|
|
22
|
-
* @param command The command to run
|
|
29
|
+
* Run command options
|
|
23
30
|
*/
|
|
24
|
-
|
|
31
|
+
interface RunCommandOptions {
|
|
25
32
|
command: string;
|
|
26
|
-
}
|
|
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 {};
|