@pristine-ts/cli 2.0.4 → 2.0.6
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/dist/bin/pristine.cjs +6 -2
- package/dist/lib/cjs/bin.js +18 -1
- package/dist/lib/cjs/bin.js.map +1 -1
- package/dist/lib/cjs/bootstrap/app-module-loader.js +40 -78
- package/dist/lib/cjs/bootstrap/app-module-loader.js.map +1 -1
- package/dist/lib/cjs/bootstrap/loaded-app-module.js +9 -13
- package/dist/lib/cjs/bootstrap/loaded-app-module.js.map +1 -1
- package/dist/lib/cjs/bootstrap/plugin-loader.js +3 -3
- package/dist/lib/cjs/bootstrap/plugin-loader.js.map +1 -1
- package/dist/lib/cjs/cli.js +173 -85
- package/dist/lib/cjs/cli.js.map +1 -1
- package/dist/lib/cjs/cli.module.js +24 -8
- package/dist/lib/cjs/cli.module.js.map +1 -1
- package/dist/lib/cjs/commands/build-alias.command.js.map +1 -1
- package/dist/lib/cjs/commands/build.command.js +9 -10
- package/dist/lib/cjs/commands/build.command.js.map +1 -1
- package/dist/lib/cjs/commands/config-print.command.js +1 -2
- package/dist/lib/cjs/commands/config-print.command.js.map +1 -1
- package/dist/lib/cjs/commands/help-alias.command.js.map +1 -1
- package/dist/lib/cjs/commands/help.command.js +1 -2
- package/dist/lib/cjs/commands/help.command.js.map +1 -1
- package/dist/lib/cjs/commands/info-alias.command.js.map +1 -1
- package/dist/lib/cjs/commands/info.command.js +7 -8
- package/dist/lib/cjs/commands/info.command.js.map +1 -1
- package/dist/lib/cjs/commands/init-alias.command.js.map +1 -1
- package/dist/lib/cjs/commands/init.command.js +13 -12
- package/dist/lib/cjs/commands/init.command.js.map +1 -1
- package/dist/lib/cjs/commands/list-alias.command.js.map +1 -1
- package/dist/lib/cjs/commands/list.command.js +1 -2
- package/dist/lib/cjs/commands/list.command.js.map +1 -1
- package/dist/lib/cjs/commands/start-alias.command.js.map +1 -1
- package/dist/lib/cjs/commands/start.command.js +3 -4
- package/dist/lib/cjs/commands/start.command.js.map +1 -1
- package/dist/lib/cjs/commands/verify-alias.command.js.map +1 -1
- package/dist/lib/cjs/commands/verify.command.js +3 -4
- package/dist/lib/cjs/commands/verify.command.js.map +1 -1
- package/dist/lib/cjs/config/resolved-pristine-config.js +2 -3
- package/dist/lib/cjs/config/resolved-pristine-config.js.map +1 -1
- package/dist/lib/cjs/errors/cli-error-code.enum.js +17 -0
- package/dist/lib/cjs/errors/cli-error-code.enum.js.map +1 -0
- package/dist/lib/cjs/errors/command-not-found.error.js +11 -12
- package/dist/lib/cjs/errors/command-not-found.error.js.map +1 -1
- package/dist/lib/cjs/errors/errors.js +1 -0
- package/dist/lib/cjs/errors/errors.js.map +1 -1
- package/dist/lib/cjs/event-handlers/cli.event-handler.js +28 -20
- package/dist/lib/cjs/event-handlers/cli.event-handler.js.map +1 -1
- package/dist/lib/cjs/reporters/cli-error.reporter.js +121 -0
- package/dist/lib/cjs/reporters/cli-error.reporter.js.map +1 -0
- package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/lib/cjs/types/command-event-response.type.js.map +1 -1
- package/dist/lib/esm/bin.js +18 -1
- package/dist/lib/esm/bin.js.map +1 -1
- package/dist/lib/esm/bootstrap/app-module-loader.js +40 -78
- package/dist/lib/esm/bootstrap/app-module-loader.js.map +1 -1
- package/dist/lib/esm/bootstrap/loaded-app-module.js +9 -13
- package/dist/lib/esm/bootstrap/loaded-app-module.js.map +1 -1
- package/dist/lib/esm/bootstrap/plugin-loader.js +3 -3
- package/dist/lib/esm/bootstrap/plugin-loader.js.map +1 -1
- package/dist/lib/esm/cli.js +172 -84
- package/dist/lib/esm/cli.js.map +1 -1
- package/dist/lib/esm/cli.module.js +24 -8
- package/dist/lib/esm/cli.module.js.map +1 -1
- package/dist/lib/esm/commands/build-alias.command.js.map +1 -1
- package/dist/lib/esm/commands/build.command.js +10 -11
- package/dist/lib/esm/commands/build.command.js.map +1 -1
- package/dist/lib/esm/commands/config-print.command.js +2 -3
- package/dist/lib/esm/commands/config-print.command.js.map +1 -1
- package/dist/lib/esm/commands/help-alias.command.js.map +1 -1
- package/dist/lib/esm/commands/help.command.js +2 -3
- package/dist/lib/esm/commands/help.command.js.map +1 -1
- package/dist/lib/esm/commands/info-alias.command.js.map +1 -1
- package/dist/lib/esm/commands/info.command.js +8 -9
- package/dist/lib/esm/commands/info.command.js.map +1 -1
- package/dist/lib/esm/commands/init-alias.command.js.map +1 -1
- package/dist/lib/esm/commands/init.command.js +14 -13
- package/dist/lib/esm/commands/init.command.js.map +1 -1
- package/dist/lib/esm/commands/list-alias.command.js.map +1 -1
- package/dist/lib/esm/commands/list.command.js +2 -3
- package/dist/lib/esm/commands/list.command.js.map +1 -1
- package/dist/lib/esm/commands/start-alias.command.js.map +1 -1
- package/dist/lib/esm/commands/start.command.js +4 -5
- package/dist/lib/esm/commands/start.command.js.map +1 -1
- package/dist/lib/esm/commands/verify-alias.command.js.map +1 -1
- package/dist/lib/esm/commands/verify.command.js +4 -5
- package/dist/lib/esm/commands/verify.command.js.map +1 -1
- package/dist/lib/esm/config/resolved-pristine-config.js +2 -3
- package/dist/lib/esm/config/resolved-pristine-config.js.map +1 -1
- package/dist/lib/esm/errors/cli-error-code.enum.js +14 -0
- package/dist/lib/esm/errors/cli-error-code.enum.js.map +1 -0
- package/dist/lib/esm/errors/command-not-found.error.js +12 -13
- package/dist/lib/esm/errors/command-not-found.error.js.map +1 -1
- package/dist/lib/esm/errors/errors.js +1 -0
- package/dist/lib/esm/errors/errors.js.map +1 -1
- package/dist/lib/esm/event-handlers/cli.event-handler.js +29 -21
- package/dist/lib/esm/event-handlers/cli.event-handler.js.map +1 -1
- package/dist/lib/esm/reporters/cli-error.reporter.js +118 -0
- package/dist/lib/esm/reporters/cli-error.reporter.js.map +1 -0
- package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/lib/esm/types/command-event-response.type.js.map +1 -1
- package/dist/types/bin.d.ts +1 -0
- package/dist/types/bootstrap/app-module-loader.d.ts +24 -25
- package/dist/types/bootstrap/loaded-app-module.d.ts +12 -26
- package/dist/types/bootstrap/plugin-loader.d.ts +1 -1
- package/dist/types/cli.d.ts +69 -9
- package/dist/types/cli.module.d.ts +2 -2
- package/dist/types/commands/build-alias.command.d.ts +2 -2
- package/dist/types/commands/build.command.d.ts +2 -2
- package/dist/types/commands/config-print.command.d.ts +2 -2
- package/dist/types/commands/help-alias.command.d.ts +2 -2
- package/dist/types/commands/help.command.d.ts +2 -2
- package/dist/types/commands/info-alias.command.d.ts +2 -2
- package/dist/types/commands/info.command.d.ts +2 -2
- package/dist/types/commands/init-alias.command.d.ts +2 -2
- package/dist/types/commands/init.command.d.ts +2 -2
- package/dist/types/commands/list-alias.command.d.ts +2 -2
- package/dist/types/commands/list.command.d.ts +2 -2
- package/dist/types/commands/start-alias.command.d.ts +2 -2
- package/dist/types/commands/start.command.d.ts +2 -2
- package/dist/types/commands/verify-alias.command.d.ts +2 -2
- package/dist/types/commands/verify.command.d.ts +2 -2
- package/dist/types/config/pristine-config.interface.d.ts +38 -12
- package/dist/types/config/resolved-pristine-config.d.ts +4 -6
- package/dist/types/errors/cli-error-code.enum.d.ts +12 -0
- package/dist/types/errors/command-not-found.error.d.ts +8 -7
- package/dist/types/errors/errors.d.ts +1 -0
- package/dist/types/event-handlers/cli.event-handler.d.ts +4 -19
- package/dist/types/interfaces/command.interface.d.ts +2 -2
- package/dist/types/reporters/cli-error.reporter.d.ts +45 -0
- package/dist/types/types/command-event-response.type.d.ts +2 -2
- package/package.json +9 -9
- package/dist/lib/cjs/enums/enums.js +0 -18
- package/dist/lib/cjs/enums/enums.js.map +0 -1
- package/dist/lib/cjs/enums/exit-code.enum.js +0 -9
- package/dist/lib/cjs/enums/exit-code.enum.js.map +0 -1
- package/dist/lib/esm/enums/enums.js +0 -2
- package/dist/lib/esm/enums/enums.js.map +0 -1
- package/dist/lib/esm/enums/exit-code.enum.js +0 -6
- package/dist/lib/esm/enums/exit-code.enum.js.map +0 -1
- package/dist/types/enums/enums.d.ts +0 -1
- package/dist/types/enums/exit-code.enum.d.ts +0 -4
package/dist/lib/esm/cli.js
CHANGED
|
@@ -7,8 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { ExecutionContextKeynameEnum, Kernel } from "@pristine-ts/core";
|
|
10
|
+
import { EnvironmentManager, ExecutionContextKeynameEnum, Kernel, PristineEnvironment, PristineEnvironmentConfigurationKey } from "@pristine-ts/core";
|
|
11
11
|
import { ServiceDefinitionTagEnum } from "@pristine-ts/common";
|
|
12
|
+
import { PristineConfigFileLoader } from "@pristine-ts/configuration";
|
|
12
13
|
import { AppModuleLoader } from "./bootstrap/app-module-loader";
|
|
13
14
|
import { BuildManifestChecker } from "./bootstrap/build-manifest-checker";
|
|
14
15
|
import { BuildManifestReader } from "./bootstrap/build-manifest-reader";
|
|
@@ -19,96 +20,183 @@ import { PluginLoader } from "./bootstrap/plugin-loader";
|
|
|
19
20
|
import { SourceHasher } from "./bootstrap/source-hasher";
|
|
20
21
|
import { ConfigLoader } from "./config/config-loader";
|
|
21
22
|
import { CliModule } from "./cli.module";
|
|
23
|
+
import { CliErrorReporter } from "./reporters/cli-error.reporter";
|
|
22
24
|
/**
|
|
23
25
|
* Boots the CLI: discovers the consumer's AppModule, starts the kernel, and dispatches
|
|
24
|
-
* `process.argv` to whichever command matches.
|
|
25
|
-
*
|
|
26
|
-
* its types or `bootstrap` reference do not accidentally trigger an entire kernel boot.
|
|
26
|
+
* `process.argv` to whichever command matches. Returns the process exit code rather than
|
|
27
|
+
* exiting itself — `bin.ts` does `new Cli().bootstrap().then(process.exit)`.
|
|
27
28
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// registered when the bin is the entry point — regardless of whether the user's
|
|
41
|
-
// AppModule already imports CliModule. The kernel dedupes modules by keyname during
|
|
42
|
-
// start, so wrapping when CliModule is already in the graph is a no-op; we don't
|
|
43
|
-
// bother walking the graph to detect that case.
|
|
44
|
-
yield kernel.start(wrapWithCliModule(appModule), configuration);
|
|
45
|
-
// Make the running kernel resolvable from within commands so things like `pristine start`
|
|
46
|
-
// and the alias commands can register signal handlers and resolve their delegates.
|
|
47
|
-
kernel.container.registerInstance(Kernel, kernel);
|
|
48
|
-
warnOnCommandCollisions(kernel);
|
|
49
|
-
yield kernel.handle(process.argv, { keyname: ExecutionContextKeynameEnum.Cli, context: null });
|
|
50
|
-
});
|
|
51
|
-
/**
|
|
52
|
-
* Hand-wired graph of the bootstrap-layer classes. The kernel container does not exist yet,
|
|
53
|
-
* so we cannot resolve via DI — but the class graph here is shallow and stable, so manual
|
|
54
|
-
* wiring stays readable. Each class is `@injectable()` so DI resolution would also work if
|
|
55
|
-
* we ever moved this into a kernel-pre-boot container.
|
|
56
|
-
*/
|
|
57
|
-
/**
|
|
58
|
-
* Builds a synthetic outer AppModule that imports both the user's AppModule and CliModule.
|
|
59
|
-
* The wrap is unconditional — the kernel dedupes module imports by keyname, so adding
|
|
60
|
-
* CliModule on top of a graph that already contains it is a no-op rather than an error
|
|
61
|
-
* or duplicate registration. Cheaper than walking the user's import tree to detect the
|
|
62
|
-
* already-present case.
|
|
63
|
-
*/
|
|
64
|
-
const wrapWithCliModule = (appModule) => {
|
|
65
|
-
var _a;
|
|
66
|
-
return {
|
|
67
|
-
keyname: `${appModule.keyname}.with-cli`,
|
|
68
|
-
importModules: [appModule, CliModule],
|
|
69
|
-
importServices: (_a = appModule.importServices) !== null && _a !== void 0 ? _a : [],
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
const buildAppModuleLoader = () => {
|
|
73
|
-
const dynamicImporter = new DynamicImporter();
|
|
74
|
-
const configLoader = new ConfigLoader(dynamicImporter);
|
|
75
|
-
const pluginLoader = new PluginLoader(dynamicImporter);
|
|
76
|
-
const sourceHasher = new SourceHasher();
|
|
77
|
-
const buildManifestReader = new BuildManifestReader();
|
|
78
|
-
const buildManifestChecker = new BuildManifestChecker(sourceHasher);
|
|
79
|
-
const buildStalenessPrompt = new BuildStalenessPrompt(dynamicImporter);
|
|
80
|
-
const buildRunner = new BuildRunner();
|
|
81
|
-
return new AppModuleLoader(configLoader, pluginLoader, dynamicImporter, buildManifestReader, buildManifestChecker, buildStalenessPrompt, buildRunner);
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Walks every registered Command-tagged service and warns to stderr if multiple share a
|
|
85
|
-
* `name`. The CLI's event dispatcher picks whichever match it sees first — without this
|
|
86
|
-
* warning, a plugin silently shadowing a built-in command (or two plugins shadowing each
|
|
87
|
-
* other) would be invisible until someone debugged "why is my command not running?". Warning
|
|
88
|
-
* rather than throwing keeps the bin runnable; users decide whether to fix the conflict.
|
|
29
|
+
* **Error handling is internal.** Every throw — from `appModuleLoader.load()`,
|
|
30
|
+
* `kernel.start()`, or the dispatched command — funnels through `reportFatalError` and
|
|
31
|
+
* gets rendered via `CliErrorReporter`. The bin doesn't need its own catch.
|
|
32
|
+
*
|
|
33
|
+
* **Per-call state.** `kernel` lives as an instance field so it's available to
|
|
34
|
+
* `reportFatalError` and `warnOnCommandCollisions` without threading it through method
|
|
35
|
+
* parameters. One `Cli` instance per `bootstrap()` invocation — the lifetime matches
|
|
36
|
+
* the CLI process.
|
|
37
|
+
*
|
|
38
|
+
* **No DI.** The kernel container does not exist yet during boot — the bootstrap-layer
|
|
39
|
+
* collaborators (loaders, discoverers, cache, prompt) are hand-wired in `build()`. Once
|
|
40
|
+
* the kernel is up, it registers itself into its own container so commands can inject it.
|
|
89
41
|
*/
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
42
|
+
export class Cli {
|
|
43
|
+
bootstrap() {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
try {
|
|
46
|
+
const appModuleLoader = this.buildAppModuleLoader();
|
|
47
|
+
const loaded = yield appModuleLoader.load();
|
|
48
|
+
this.kernel = new Kernel();
|
|
49
|
+
// Wrap the user's AppModule with CliModule so the CLI's own commands (`build`,
|
|
50
|
+
// `start`, `verify`, `init`, `help`, `list`, `info`, custom commands) are always
|
|
51
|
+
// registered when the bin is the entry point — regardless of whether the user's
|
|
52
|
+
// AppModule already imports CliModule. The kernel dedupes modules by keyname during
|
|
53
|
+
// start, so wrapping when CliModule is already in the graph is a no-op; we don't
|
|
54
|
+
// bother walking the graph to detect that case.
|
|
55
|
+
//
|
|
56
|
+
// No second argument to `kernel.start()`: runtime configuration values from
|
|
57
|
+
// `pristine.config.ts:config` are read directly by `ConfigurationManager` during
|
|
58
|
+
// boot, so the CLI no longer needs to pre-load or thread them through.
|
|
59
|
+
yield this.kernel.start(this.wrapWithCliModule(loaded.appModule));
|
|
60
|
+
// Make the running kernel resolvable from within commands so things like `pristine start`
|
|
61
|
+
// and the alias commands can register signal handlers and resolve their delegates.
|
|
62
|
+
this.kernel.container.registerInstance(Kernel, this.kernel);
|
|
63
|
+
this.warnOnCommandCollisions();
|
|
64
|
+
yield this.kernel.handle(process.argv, { keyname: ExecutionContextKeynameEnum.Cli, context: null });
|
|
65
|
+
// The CLI event handler calls `process.exit(exitCode)` itself after the command runs,
|
|
66
|
+
// so this return is only reached if the dispatcher somehow resolves without exiting —
|
|
67
|
+
// treat that as a success exit.
|
|
68
|
+
return 0;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
return yield this.reportFatalError(error);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Renders any error that escapes the boot/dispatch flow and returns the exit code the
|
|
77
|
+
* bin should pass to `process.exit`.
|
|
78
|
+
*
|
|
79
|
+
* Two resolution paths for `EnvironmentManager`, picked in order of "most likely to be
|
|
80
|
+
* correctly configured":
|
|
81
|
+
*
|
|
82
|
+
* 1. **Kernel up**: resolve `CliErrorReporter` (and its `EnvironmentManager`) through
|
|
83
|
+
* DI. This is the path for command-runtime errors — the configuration system
|
|
84
|
+
* already ran and `pristine.environment` is whatever the user configured.
|
|
85
|
+
*
|
|
86
|
+
* 2. **Kernel-start failed**: peek directly at `pristine.config.ts:config` via
|
|
87
|
+
* `PristineConfigFileLoader`. If a value for `pristine.environment` is set in the
|
|
88
|
+
* file, use it; otherwise default to production. Boot-time errors get sanitized
|
|
89
|
+
* unless the user explicitly opted into `dev` in the file.
|
|
90
|
+
*
|
|
91
|
+
* No `process.env` reads in any branch — the environment flows exclusively through
|
|
92
|
+
* the configuration system or its file source.
|
|
93
|
+
*/
|
|
94
|
+
reportFatalError(error) {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
if (this.kernel !== undefined) {
|
|
97
|
+
try {
|
|
98
|
+
const reporter = this.kernel.container.resolve(CliErrorReporter);
|
|
99
|
+
return reporter.report(error);
|
|
100
|
+
}
|
|
101
|
+
catch (_a) {
|
|
102
|
+
// Kernel container couldn't produce a reporter (kernel may have started but DI is
|
|
103
|
+
// in a weird state). Fall through to the manual-build path.
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const rawEnvironment = yield this.readEnvironmentFromConfigFile();
|
|
107
|
+
const environmentManager = new EnvironmentManager(rawEnvironment);
|
|
108
|
+
const reporter = new CliErrorReporter(environmentManager);
|
|
109
|
+
return reporter.report(error);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Peeks at `pristine.config.ts:config[pristine.environment]` directly via the shared
|
|
114
|
+
* file loader. Used only by the kernel-down fallback in `reportFatalError`. Failures
|
|
115
|
+
* (file missing, parse error, etc.) silently fall back to production — boot-time
|
|
116
|
+
* sanitized output is the safer default.
|
|
117
|
+
*/
|
|
118
|
+
readEnvironmentFromConfigFile() {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
var _a;
|
|
121
|
+
try {
|
|
122
|
+
const loader = new PristineConfigFileLoader();
|
|
123
|
+
const parsed = yield loader.load();
|
|
124
|
+
const value = (_a = parsed === null || parsed === void 0 ? void 0 : parsed.config) === null || _a === void 0 ? void 0 : _a[PristineEnvironmentConfigurationKey];
|
|
125
|
+
if (typeof value === "string") {
|
|
126
|
+
return value;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch (_b) {
|
|
130
|
+
// Fall through to the production default.
|
|
131
|
+
}
|
|
132
|
+
return PristineEnvironment.Production;
|
|
133
|
+
});
|
|
100
134
|
}
|
|
101
|
-
|
|
102
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Builds a synthetic outer AppModule that imports both the user's AppModule and CliModule.
|
|
137
|
+
* The wrap is unconditional — the kernel dedupes module imports by keyname, so adding
|
|
138
|
+
* CliModule on top of a graph that already contains it is a no-op rather than an error
|
|
139
|
+
* or duplicate registration. Cheaper than walking the user's import tree to detect the
|
|
140
|
+
* already-present case.
|
|
141
|
+
*/
|
|
142
|
+
wrapWithCliModule(appModule) {
|
|
143
|
+
var _a;
|
|
144
|
+
return {
|
|
145
|
+
keyname: `${appModule.keyname}.with-cli`,
|
|
146
|
+
importModules: [appModule, CliModule],
|
|
147
|
+
importServices: (_a = appModule.importServices) !== null && _a !== void 0 ? _a : [],
|
|
148
|
+
};
|
|
103
149
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Hand-wired graph of the bootstrap-layer classes. The kernel container does not exist
|
|
152
|
+
* yet, so we cannot resolve via DI — but the class graph here is shallow and stable, so
|
|
153
|
+
* manual wiring stays readable. Each class is `@injectable()` so DI resolution would also
|
|
154
|
+
* work if we ever moved this into a kernel-pre-boot container.
|
|
155
|
+
*/
|
|
156
|
+
buildAppModuleLoader() {
|
|
157
|
+
const dynamicImporter = new DynamicImporter();
|
|
158
|
+
const configLoader = new ConfigLoader(dynamicImporter);
|
|
159
|
+
const pluginLoader = new PluginLoader(dynamicImporter);
|
|
160
|
+
const sourceHasher = new SourceHasher();
|
|
161
|
+
const buildManifestReader = new BuildManifestReader();
|
|
162
|
+
const buildManifestChecker = new BuildManifestChecker(sourceHasher);
|
|
163
|
+
const buildStalenessPrompt = new BuildStalenessPrompt(dynamicImporter);
|
|
164
|
+
const buildRunner = new BuildRunner();
|
|
165
|
+
return new AppModuleLoader(configLoader, pluginLoader, dynamicImporter, buildManifestReader, buildManifestChecker, buildStalenessPrompt, buildRunner);
|
|
107
166
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
167
|
+
/**
|
|
168
|
+
* Walks every registered Command-tagged service and warns to stderr if multiple share a
|
|
169
|
+
* `name`. The CLI's event dispatcher picks whichever match it sees first — without this
|
|
170
|
+
* warning, a plugin silently shadowing a built-in command (or two plugins shadowing each
|
|
171
|
+
* other) would be invisible until someone debugged "why is my command not running?".
|
|
172
|
+
* Warning rather than throwing keeps the bin runnable; users decide whether to fix the
|
|
173
|
+
* conflict.
|
|
174
|
+
*/
|
|
175
|
+
warnOnCommandCollisions() {
|
|
176
|
+
var _a;
|
|
177
|
+
if (this.kernel === undefined)
|
|
178
|
+
return;
|
|
179
|
+
let commands;
|
|
180
|
+
try {
|
|
181
|
+
// ── container.resolveAll, justified ───────────────────────────────────────
|
|
182
|
+
// Per CLAUDE.md: framework bootstrap. This runs from `Cli.bootstrap()` — pre-DI
|
|
183
|
+
// hand-wiring, no constructor to inject into. The whole point is to enumerate
|
|
184
|
+
// every registered Command for collision detection, which is inherently a
|
|
185
|
+
// container-introspection operation.
|
|
186
|
+
commands = this.kernel.container.resolveAll(ServiceDefinitionTagEnum.Command);
|
|
187
|
+
}
|
|
188
|
+
catch (_b) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const byName = new Map();
|
|
192
|
+
for (const command of commands) {
|
|
193
|
+
byName.set(command.name, ((_a = byName.get(command.name)) !== null && _a !== void 0 ? _a : 0) + 1);
|
|
194
|
+
}
|
|
195
|
+
for (const [name, count] of byName.entries()) {
|
|
196
|
+
if (count > 1) {
|
|
197
|
+
process.stderr.write(`[pristine] WARNING: command '${name}' is registered ${count} times. Only the first match will be dispatched.\n`);
|
|
198
|
+
}
|
|
111
199
|
}
|
|
112
200
|
}
|
|
113
|
-
}
|
|
201
|
+
}
|
|
114
202
|
//# sourceMappingURL=cli.js.map
|
package/dist/lib/esm/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/cli.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,2BAA2B,EAAE,MAAM,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/cli.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,kBAAkB,EAAE,2BAA2B,EAAE,MAAM,EAAE,mBAAmB,EAAE,mCAAmC,EAAC,MAAM,mBAAmB,CAAC;AACpJ,OAAO,EAAqB,wBAAwB,EAAC,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAAC,eAAe,EAAC,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAC,oBAAoB,EAAC,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAC,mBAAmB,EAAC,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,oBAAoB,EAAC,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAC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AQ,EAAE,CAAC;YAC/B,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,MAAA,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAChE,CAAC;QAED,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;YAC7C,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;gBACd,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,gCAAgC,IAAI,mBAAmB,KAAK,oDAAoD,CACjH,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { CliModuleKeyname } from "./cli.module.keyname";
|
|
2
2
|
import { CoreModule } from "@pristine-ts/core";
|
|
3
3
|
import { ValidationModule } from "@pristine-ts/validation";
|
|
4
|
-
import { LoggingModule } from "@pristine-ts/logging";
|
|
4
|
+
import { LoggingModule, LoggingModuleKeyname, OutputModeEnum, SeverityEnum } from "@pristine-ts/logging";
|
|
5
5
|
import { DataMappingModule } from "@pristine-ts/data-mapping";
|
|
6
6
|
export * from "./bootstrap/bootstrap";
|
|
7
7
|
export * from "./commands/commands";
|
|
8
8
|
export * from "./config/config";
|
|
9
|
-
export * from "./enums/enums";
|
|
10
9
|
export * from "./errors/errors";
|
|
11
10
|
export * from "./event-handlers/event-handlers";
|
|
12
11
|
export * from "./event-payloads/event-payloads";
|
|
@@ -14,12 +13,13 @@ export * from "./interfaces/interfaces";
|
|
|
14
13
|
export * from "./managers/managers";
|
|
15
14
|
export * from "./mappers/mappers";
|
|
16
15
|
export * from "./options/options";
|
|
16
|
+
export * from "./reporters/cli-error.reporter";
|
|
17
17
|
export * from "./types/types";
|
|
18
|
-
// Re-export the
|
|
19
|
-
//
|
|
20
|
-
// classes the consumer's AppModule references — avoiding cross-realm decorator
|
|
21
|
-
// mismatches that occur when bin and consumer end up with separate copies.
|
|
22
|
-
export {
|
|
18
|
+
// Re-export the `Cli` entrypoint so `bin.ts` (and any other downstream entry script) can
|
|
19
|
+
// invoke `new (require('@pristine-ts/cli').Cli)().bootstrap()` to load the same physical
|
|
20
|
+
// CLI classes the consumer's AppModule references — avoiding cross-realm decorator
|
|
21
|
+
// metadata mismatches that occur when bin and consumer end up with separate copies.
|
|
22
|
+
export { Cli } from "./cli";
|
|
23
23
|
export const CliModule = {
|
|
24
24
|
keyname: CliModuleKeyname,
|
|
25
25
|
configurationDefinitions: [],
|
|
@@ -28,6 +28,22 @@ export const CliModule = {
|
|
|
28
28
|
DataMappingModule,
|
|
29
29
|
LoggingModule,
|
|
30
30
|
ValidationModule,
|
|
31
|
-
]
|
|
31
|
+
],
|
|
32
|
+
/**
|
|
33
|
+
* When running through the CLI, logs share stderr with our own CLI output. We layer a
|
|
34
|
+
* tighter set of defaults than `LoggingModule` ships with so the terminal stays
|
|
35
|
+
* readable: Simple line-oriented format and `Error`-only severity threshold. Users can
|
|
36
|
+
* override both in `pristine.config.ts:config` or via env-var resolvers — `configDefaults`
|
|
37
|
+
* sits below the file and overrides in the resolution chain.
|
|
38
|
+
*
|
|
39
|
+
* No `isLoggingModulePresent` check needed — `LoggingModule` is a hard import above, so
|
|
40
|
+
* these keys are always registered when CliModule is in the graph. (And if a future
|
|
41
|
+
* refactor removed LoggingModule from this import list, the kernel would throw at boot
|
|
42
|
+
* with an actionable "unknown key" error — the right failure mode for that case.)
|
|
43
|
+
*/
|
|
44
|
+
configDefaults: {
|
|
45
|
+
[LoggingModuleKeyname + ".consoleLoggerOutputMode"]: OutputModeEnum.Simple,
|
|
46
|
+
[LoggingModuleKeyname + ".logSeverityLevelConfiguration"]: SeverityEnum.Error,
|
|
47
|
+
},
|
|
32
48
|
};
|
|
33
49
|
//# sourceMappingURL=cli.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.module.js","sourceRoot":"","sources":["../../../src/cli.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.module.js","sourceRoot":"","sources":["../../../src/cli.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAC,aAAa,EAAE,oBAAoB,EAAE,cAAc,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AACvG,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAA;AAE3D,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAE9B,yFAAyF;AACzF,yFAAyF;AACzF,mFAAmF;AACnF,oFAAoF;AACpF,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,SAAS,GAAoB;IACxC,OAAO,EAAE,gBAAgB;IACzB,wBAAwB,EAAE,EAAE;IAC5B,aAAa,EAAE;QACb,UAAU;QACV,iBAAiB;QACjB,aAAa;QACb,gBAAgB;KACjB;IACD;;;;;;;;;;;OAWG;IACH,cAAc,EAAE;QACd,CAAC,oBAAoB,GAAG,0BAA0B,CAAC,EAAE,cAAc,CAAC,MAAM;QAC1E,CAAC,oBAAoB,GAAG,gCAAgC,CAAC,EAAE,YAAY,CAAC,KAAK;KAC9E;CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-alias.command.js","sourceRoot":"","sources":["../../../../src/commands/build-alias.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"build-alias.command.js","sourceRoot":"","sources":["../../../../src/commands/build-alias.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAW,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEpC,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AAII,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAK5B,YAA6B,QAAsB;QAAtB,aAAQ,GAAR,QAAQ,CAAc;QAJnD,gBAAW,GAAG,IAAI,CAAC;QACnB,SAAI,GAAG,OAAO,CAAC;QACf,gBAAW,GAAG,oBAAoB,CAAC;IAGnC,CAAC;IAEK,GAAG,CAAC,IAAS;;YACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;KAAA;CACF,CAAA;AAXY,iBAAiB;IAH7B,GAAG,CAAC,wBAAwB,CAAC,OAAO,CAAC;IACrC,YAAY,CAAC,gBAAgB,CAAC;IAC9B,UAAU,EAAE;qCAM4B,YAAY;GALxC,iBAAiB,CAW7B"}
|
|
@@ -18,11 +18,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
};
|
|
19
19
|
import fs from "fs";
|
|
20
20
|
import path from "path";
|
|
21
|
-
import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
|
|
21
|
+
import { moduleScoped, ServiceDefinitionTagEnum, tag, ExitCode } from "@pristine-ts/common";
|
|
22
22
|
import { injectable } from "tsyringe";
|
|
23
23
|
import { ConsoleManager } from "../managers/console.manager";
|
|
24
24
|
import { ShellManager } from "../managers/shell.manager";
|
|
25
|
-
import { ExitCodeEnum } from "../enums/exit-code.enum";
|
|
26
25
|
import { CliModuleKeyname } from "../cli.module.keyname";
|
|
27
26
|
import { ConfigLoader } from "../config/config-loader";
|
|
28
27
|
import { BuildManifestWriter } from "../bootstrap/build-manifest-writer";
|
|
@@ -59,13 +58,13 @@ let BuildCommand = class BuildCommand {
|
|
|
59
58
|
}
|
|
60
59
|
run(args) {
|
|
61
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
var _a, _b, _c, _d;
|
|
61
|
+
var _a, _b, _c, _d, _e, _f;
|
|
63
62
|
const projectRoot = process.cwd();
|
|
64
63
|
const resolvedConfig = yield this.configLoader.load({ startDir: projectRoot });
|
|
65
|
-
const buildConfig = (_a = resolvedConfig.config.build) !== null &&
|
|
66
|
-
const tsconfig = (
|
|
67
|
-
const format = (
|
|
68
|
-
const clean = (
|
|
64
|
+
const buildConfig = (_b = (_a = resolvedConfig.config.cli) === null || _a === void 0 ? void 0 : _a.build) !== null && _b !== void 0 ? _b : {};
|
|
65
|
+
const tsconfig = (_c = buildConfig.tsconfig) !== null && _c !== void 0 ? _c : this.defaultTsconfig;
|
|
66
|
+
const format = (_d = buildConfig.format) !== null && _d !== void 0 ? _d : this.defaultFormat;
|
|
67
|
+
const clean = (_e = buildConfig.clean) !== null && _e !== void 0 ? _e : false;
|
|
69
68
|
const outDir = buildConfig.outDir;
|
|
70
69
|
if (clean && outDir !== undefined) {
|
|
71
70
|
const absOut = path.resolve(projectRoot, outDir);
|
|
@@ -77,7 +76,7 @@ let BuildCommand = class BuildCommand {
|
|
|
77
76
|
const invocations = this.resolveTscInvocations(projectRoot, tsconfig, format);
|
|
78
77
|
if (invocations.length === 0) {
|
|
79
78
|
this.consoleManager.writeError(`No tsconfig found. Looked for: ${this.expectedTsconfigsForFormat(tsconfig, format).join(", ")}`);
|
|
80
|
-
return
|
|
79
|
+
return ExitCode.Error;
|
|
81
80
|
}
|
|
82
81
|
for (const tsconfigPath of invocations) {
|
|
83
82
|
const relTsconfig = path.relative(projectRoot, tsconfigPath);
|
|
@@ -94,12 +93,12 @@ let BuildCommand = class BuildCommand {
|
|
|
94
93
|
}
|
|
95
94
|
catch (error) {
|
|
96
95
|
this.consoleManager.writeError(`tsc failed for ${relTsconfig}`);
|
|
97
|
-
return
|
|
96
|
+
return ExitCode.Error;
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
|
-
this.writeManifestIfConfigured(projectRoot, resolvedConfig.config.appModule);
|
|
99
|
+
this.writeManifestIfConfigured(projectRoot, (_f = resolvedConfig.config.cli) === null || _f === void 0 ? void 0 : _f.appModule);
|
|
101
100
|
this.consoleManager.writeSuccess(`Build complete (${invocations.length} tsconfig${invocations.length > 1 ? "s" : ""}).`);
|
|
102
|
-
return
|
|
101
|
+
return ExitCode.Success;
|
|
103
102
|
});
|
|
104
103
|
}
|
|
105
104
|
writeManifestIfConfigured(projectRoot, appModule) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.command.js","sourceRoot":"","sources":["../../../../src/commands/build.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"build.command.js","sourceRoot":"","sources":["../../../../src/commands/build.command.ts"],"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C;QAC5F,CAAC;QAED,OAAO;QACP,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;YAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACvD,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/C,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,0BAA0B,CAAC,OAAe,EAAE,MAA8B;QAChF,IAAI,MAAM,KAAK,KAAK;YAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACpD,IAAI,MAAM,KAAK,KAAK;YAAE,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC5C,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACxB,CAAC;CACF,CAAA;AA9HY,YAAY;IAHxB,GAAG,CAAC,wBAAwB,CAAC,OAAO,CAAC;IACrC,YAAY,CAAC,gBAAgB,CAAC;IAC9B,UAAU,EAAE;qCAUwB,cAAc;QAChB,YAAY;QACZ,YAAY;QACL,mBAAmB;GAZhD,YAAY,CA8HxB"}
|
|
@@ -17,10 +17,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
import path from "path";
|
|
20
|
-
import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
|
|
20
|
+
import { moduleScoped, ServiceDefinitionTagEnum, tag, ExitCode } from "@pristine-ts/common";
|
|
21
21
|
import { injectable } from "tsyringe";
|
|
22
22
|
import { ConsoleManager } from "../managers/console.manager";
|
|
23
|
-
import { ExitCodeEnum } from "../enums/exit-code.enum";
|
|
24
23
|
import { CliModuleKeyname } from "../cli.module.keyname";
|
|
25
24
|
import { ConfigLoader } from "../config/config-loader";
|
|
26
25
|
/**
|
|
@@ -54,7 +53,7 @@ let ConfigPrintCommand = class ConfigPrintCommand {
|
|
|
54
53
|
this.consoleManager.writeLine(` ${field}: ${source}`);
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
|
-
return
|
|
56
|
+
return ExitCode.Success;
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-print.command.js","sourceRoot":"","sources":["../../../../src/commands/config-print.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"config-print.command.js","sourceRoot":"","sources":["../../../../src/commands/config-print.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEpC,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAErD;;;;GAIG;AAII,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAK7B,YACmB,cAA8B,EAC9B,YAA0B;QAD1B,mBAAc,GAAd,cAAc,CAAgB;QAC9B,iBAAY,GAAZ,YAAY,CAAc;QAN7C,gBAAW,GAAG,IAAI,CAAC;QACnB,SAAI,GAAG,gBAAgB,CAAC;QACxB,gBAAW,GAAG,0EAA0E,CAAC;IAMzF,CAAC;IAEK,GAAG,CAAC,IAAS;;YACjB,MA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AU,EAAE;qCAOwB,cAAc;QAChB,YAAY;GAPlC,kBAAkB,CAiC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-alias.command.js","sourceRoot":"","sources":["../../../../src/commands/help-alias.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"help-alias.command.js","sourceRoot":"","sources":["../../../../src/commands/help-alias.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAW,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEpC,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C;;;;;GAKG;AAII,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAK3B,YAA6B,QAAqB;QAArB,aAAQ,GAAR,QAAQ,CAAa;QAJlD,gBAAW,GAAG,IAAI,CAAC;QACnB,SAAI,GAAG,MAAM,CAAC;QACd,gBAAW,GAAG,mBAAmB,CAAC;IAGlC,CAAC;IAEK,GAAG,CAAC,IAAS;;YACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;KAAA;CACF,CAAA;AAXY,gBAAgB;IAH5B,GAAG,CAAC,wBAAwB,CAAC,OAAO,CAAC;IACrC,YAAY,CAAC,gBAAgB,CAAC;IAC9B,UAAU,EAAE;qCAM4B,WAAW;GALvC,gBAAgB,CAW5B"}
|
|
@@ -20,9 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
import { inject, injectable } from "tsyringe";
|
|
23
|
-
import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
|
|
23
|
+
import { moduleScoped, ServiceDefinitionTagEnum, tag, ExitCode } from "@pristine-ts/common";
|
|
24
24
|
import { ConsoleManager } from "../managers/console.manager";
|
|
25
|
-
import { ExitCodeEnum } from "../enums/exit-code.enum";
|
|
26
25
|
import { CliModuleKeyname } from "../cli.module.keyname";
|
|
27
26
|
/**
|
|
28
27
|
* Prints a usage banner plus a one-line summary for every registered command. The output is
|
|
@@ -75,7 +74,7 @@ let HelpCommand = class HelpCommand {
|
|
|
75
74
|
this.consoleManager.writeLine(" 2. Decorate with @tag(ServiceDefinitionTagEnum.Command) @injectable()");
|
|
76
75
|
this.consoleManager.writeLine(" 3. Make sure your AppModule's import graph reaches the file");
|
|
77
76
|
this.consoleManager.writeLine(" 4. Invoke as: pristine <your-command-name>");
|
|
78
|
-
return
|
|
77
|
+
return ExitCode.Success;
|
|
79
78
|
});
|
|
80
79
|
}
|
|
81
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.command.js","sourceRoot":"","sources":["../../../../src/commands/help.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAsB,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AACjE,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"help.command.js","sourceRoot":"","sources":["../../../../src/commands/help.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAsB,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AACjE,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAE1F,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;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,IAAI,MAAM,EAAE,CAAC;gBAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;gBACzD,MAAM,WAAW,GAAG,MAAA,OAAO,CAAC,WAAW,mCAAI,EAAE,CAAC;gBAC9C,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,MAAM,GAAG,WAAW,EAAE,CAAC,CAAC;YAC7D,CAAC;YAED,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;YAClC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC;YAC1D,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,yDAAyD,CAAC,CAAC;YACzF,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,yEAAyE,CAAC,CAAC;YACzG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,+DAA+D,CAAC,CAAC;YAC/F,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,8CAA8C,CAAC,CAAC;YAE9E,OAAO,QAAQ,CAAC,OAAO,CAAC;QAC1B,CAAC;KAAA;CACF,CAAA;AA5CY,WAAW;IAHvB,GAAG,CAAC,wBAAwB,CAAC,OAAO,CAAC;IACrC,YAAY,CAAC,gBAAgB,CAAC;IAC9B,UAAU,EAAE;IAQR,WAAA,MAAM,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,CAAA;qCADtB,cAAc;GANtC,WAAW,CA4CvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info-alias.command.js","sourceRoot":"","sources":["../../../../src/commands/info-alias.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"info-alias.command.js","sourceRoot":"","sources":["../../../../src/commands/info-alias.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAW,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEpC,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C;;;GAGG;AAII,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAK3B,YAA6B,QAAqB;QAArB,aAAQ,GAAR,QAAQ,CAAa;QAJlD,gBAAW,GAAG,IAAI,CAAC;QACnB,SAAI,GAAG,MAAM,CAAC;QACd,gBAAW,GAAG,mBAAmB,CAAC;IAGlC,CAAC;IAEK,GAAG,CAAC,IAAS;;YACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;KAAA;CACF,CAAA;AAXY,gBAAgB;IAH5B,GAAG,CAAC,wBAAwB,CAAC,OAAO,CAAC;IACrC,YAAY,CAAC,gBAAgB,CAAC;IAC9B,UAAU,EAAE;qCAM4B,WAAW;GALvC,gBAAgB,CAW5B"}
|
|
@@ -19,10 +19,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
19
19
|
import fs from "fs";
|
|
20
20
|
import os from "os";
|
|
21
21
|
import path from "path";
|
|
22
|
-
import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
|
|
22
|
+
import { moduleScoped, ServiceDefinitionTagEnum, tag, ExitCode } from "@pristine-ts/common";
|
|
23
23
|
import { injectable } from "tsyringe";
|
|
24
24
|
import { ConsoleManager } from "../managers/console.manager";
|
|
25
|
-
import { ExitCodeEnum } from "../enums/exit-code.enum";
|
|
26
25
|
import { CliModuleKeyname } from "../cli.module.keyname";
|
|
27
26
|
import { ConfigLoader } from "../config/config-loader";
|
|
28
27
|
import { AppModuleLoader } from "../bootstrap/app-module-loader";
|
|
@@ -68,15 +67,15 @@ let InfoCommand = class InfoCommand {
|
|
|
68
67
|
}
|
|
69
68
|
printConfigSection() {
|
|
70
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
var _a, _b, _c;
|
|
70
|
+
var _a, _b, _c, _d, _e;
|
|
72
71
|
const resolvedConfig = yield this.configLoader.load({ startDir: process.cwd() });
|
|
73
72
|
this.consoleManager.writeLine("Configuration");
|
|
74
73
|
this.consoleManager.writeLine(` Config file: ${(_a = resolvedConfig.configFilePath) !== null && _a !== void 0 ? _a : "(none — using defaults)"}`);
|
|
75
|
-
if (((_b = resolvedConfig.config.
|
|
76
|
-
this.consoleManager.writeLine(` AppModule src: ${resolvedConfig.config.appModule.sourcePath} (from config file)`);
|
|
74
|
+
if (((_c = (_b = resolvedConfig.config.cli) === null || _b === void 0 ? void 0 : _b.appModule) === null || _c === void 0 ? void 0 : _c.sourcePath) !== undefined) {
|
|
75
|
+
this.consoleManager.writeLine(` AppModule src: ${resolvedConfig.config.cli.appModule.sourcePath} (from config file)`);
|
|
77
76
|
}
|
|
78
|
-
if (((
|
|
79
|
-
this.consoleManager.writeLine(` AppModule out: ${resolvedConfig.config.appModule.outputPath} (from config file)`);
|
|
77
|
+
if (((_e = (_d = resolvedConfig.config.cli) === null || _d === void 0 ? void 0 : _d.appModule) === null || _e === void 0 ? void 0 : _e.outputPath) !== undefined) {
|
|
78
|
+
this.consoleManager.writeLine(` AppModule out: ${resolvedConfig.config.cli.appModule.outputPath} (from config file)`);
|
|
80
79
|
}
|
|
81
80
|
this.consoleManager.writeLine("");
|
|
82
81
|
});
|
|
@@ -93,7 +92,7 @@ let InfoCommand = class InfoCommand {
|
|
|
93
92
|
}
|
|
94
93
|
catch (error) {
|
|
95
94
|
this.consoleManager.writeError(`Could not load AppModule: ${error.message}`);
|
|
96
|
-
return
|
|
95
|
+
return ExitCode.Error;
|
|
97
96
|
}
|
|
98
97
|
if (pluginNames.length > 0) {
|
|
99
98
|
this.consoleManager.writeLine(`Plugins (${pluginNames.length}):`);
|
|
@@ -109,7 +108,7 @@ let InfoCommand = class InfoCommand {
|
|
|
109
108
|
for (const m of [...uniqueByKeyname.values()].sort((a, b) => a.keyname.localeCompare(b.keyname))) {
|
|
110
109
|
this.consoleManager.writeLine(` - ${m.keyname}`);
|
|
111
110
|
}
|
|
112
|
-
return
|
|
111
|
+
return ExitCode.Success;
|
|
113
112
|
});
|
|
114
113
|
}
|
|
115
114
|
readCliVersion() {
|