@tsed/cli-core 3.20.11 → 3.20.14
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/lib/index.js +74 -28
- package/lib/index.js.map +1 -1
- package/lib/index.modern.js +74 -28
- package/lib/index.modern.js.map +1 -1
- package/lib/services/Renderer.d.ts +2 -6
- package/package.json +6 -6
package/lib/index.js
CHANGED
|
@@ -176,14 +176,13 @@ exports.CliExeca = class CliExeca {
|
|
|
176
176
|
constructor() {
|
|
177
177
|
this.raw = execa__default['default'];
|
|
178
178
|
}
|
|
179
|
+
|
|
179
180
|
/**
|
|
180
181
|
*
|
|
181
182
|
* @param cmd
|
|
182
183
|
* @param args
|
|
183
184
|
* @param opts
|
|
184
185
|
*/
|
|
185
|
-
|
|
186
|
-
|
|
187
186
|
run(cmd, args, opts) {
|
|
188
187
|
const cp = this.raw(cmd, args, opts);
|
|
189
188
|
const stdout = streamToObservable(cp.stdout.pipe(split()), {
|
|
@@ -370,9 +369,14 @@ function defaultPreferences(pkg) {
|
|
|
370
369
|
|
|
371
370
|
exports.ProjectPackageJson = class ProjectPackageJson {
|
|
372
371
|
constructor(configuration) {
|
|
373
|
-
this.configuration =
|
|
372
|
+
this.configuration = void 0;
|
|
374
373
|
this.rewrite = false;
|
|
375
374
|
this.reinstall = false;
|
|
375
|
+
this.cliExeca = void 0;
|
|
376
|
+
this.fs = void 0;
|
|
377
|
+
this.GH_TOKEN = void 0;
|
|
378
|
+
this.raw = void 0;
|
|
379
|
+
this.configuration = configuration;
|
|
376
380
|
this.setRaw({
|
|
377
381
|
name: "",
|
|
378
382
|
version: "1.0.0",
|
|
@@ -974,6 +978,10 @@ function parseOption(value, options) {
|
|
|
974
978
|
}
|
|
975
979
|
|
|
976
980
|
let CliHooks = class CliHooks {
|
|
981
|
+
constructor() {
|
|
982
|
+
this.injector = void 0;
|
|
983
|
+
}
|
|
984
|
+
|
|
977
985
|
async emit(hookName, cmd, ...args) {
|
|
978
986
|
const providers = this.injector.getProviders();
|
|
979
987
|
let results = [];
|
|
@@ -1009,6 +1017,10 @@ exports.CliService = class CliService {
|
|
|
1009
1017
|
constructor() {
|
|
1010
1018
|
this.program = new commander.Command();
|
|
1011
1019
|
this.reinstallAfterRun = false;
|
|
1020
|
+
this.pkg = void 0;
|
|
1021
|
+
this.injector = void 0;
|
|
1022
|
+
this.hooks = void 0;
|
|
1023
|
+
this.projectPkg = void 0;
|
|
1012
1024
|
this.commands = new Map();
|
|
1013
1025
|
}
|
|
1014
1026
|
|
|
@@ -1333,6 +1345,11 @@ function cast(value) {
|
|
|
1333
1345
|
}
|
|
1334
1346
|
|
|
1335
1347
|
let CliProxyAgent = class CliProxyAgent {
|
|
1348
|
+
constructor() {
|
|
1349
|
+
this.proxySettings = void 0;
|
|
1350
|
+
this.cliExeca = void 0;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1336
1353
|
hasProxy() {
|
|
1337
1354
|
return !!this.proxySettings.url;
|
|
1338
1355
|
}
|
|
@@ -1418,6 +1435,8 @@ function logToCurl({
|
|
|
1418
1435
|
|
|
1419
1436
|
let CliHttpLogClient = class CliHttpLogClient {
|
|
1420
1437
|
constructor(options = {}) {
|
|
1438
|
+
this.callee = void 0;
|
|
1439
|
+
this.logger = void 0;
|
|
1421
1440
|
this.callee = options.callee || "http";
|
|
1422
1441
|
}
|
|
1423
1442
|
|
|
@@ -1499,6 +1518,12 @@ CliHttpLogClient = tslib.__decorate([tslib.__param(0, di.Opts), tslib.__metadata
|
|
|
1499
1518
|
|
|
1500
1519
|
var CliHttpClient_1;
|
|
1501
1520
|
exports.CliHttpClient = CliHttpClient_1 = class CliHttpClient extends CliHttpLogClient {
|
|
1521
|
+
constructor(...args) {
|
|
1522
|
+
super(...args);
|
|
1523
|
+
this.cliProxyAgent = void 0;
|
|
1524
|
+
this.host = void 0;
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1502
1527
|
static getParamsSerializer(params) {
|
|
1503
1528
|
return querystring__default['default'].stringify(core.cleanObject(params));
|
|
1504
1529
|
}
|
|
@@ -1614,12 +1639,8 @@ exports.CliHttpClient = CliHttpClient_1 = tslib.__decorate([di.Injectable()], ex
|
|
|
1614
1639
|
const all = promises => Promise.all(promises);
|
|
1615
1640
|
|
|
1616
1641
|
async function loadPlugins(injector) {
|
|
1617
|
-
const
|
|
1618
|
-
|
|
1619
|
-
project: {
|
|
1620
|
-
rootDir
|
|
1621
|
-
}
|
|
1622
|
-
} = injector.settings;
|
|
1642
|
+
const name = injector.settings.get("name");
|
|
1643
|
+
const rootDir = injector.settings.get("project.rootDir");
|
|
1623
1644
|
const projectPackageJson = injector.invoke(exports.ProjectPackageJson);
|
|
1624
1645
|
const fs = injector.invoke(exports.CliFs);
|
|
1625
1646
|
const promises = Object.keys(projectPackageJson.allDependencies).filter(mod => mod.startsWith(`@${name}/cli-plugin`) || mod.includes(`${name}-cli-plugin`)).map(async mod => {
|
|
@@ -1639,7 +1660,7 @@ async function loadPlugins(injector) {
|
|
|
1639
1660
|
|
|
1640
1661
|
injector.add(token, (_GlobalProviders$get2 = di.GlobalProviders.get(token)) == null ? void 0 : _GlobalProviders$get2.clone());
|
|
1641
1662
|
|
|
1642
|
-
if (injector.settings.loaded) {
|
|
1663
|
+
if (injector.settings.get("loaded")) {
|
|
1643
1664
|
await injector.invoke(token);
|
|
1644
1665
|
}
|
|
1645
1666
|
}));
|
|
@@ -1647,7 +1668,7 @@ async function loadPlugins(injector) {
|
|
|
1647
1668
|
|
|
1648
1669
|
injector.add(plugin, provider);
|
|
1649
1670
|
|
|
1650
|
-
if (injector.settings.loaded) {
|
|
1671
|
+
if (injector.settings.get("loaded")) {
|
|
1651
1672
|
await injector.invoke(plugin);
|
|
1652
1673
|
}
|
|
1653
1674
|
}
|
|
@@ -1675,6 +1696,10 @@ function addSuffix(pattern, suffix) {
|
|
|
1675
1696
|
}
|
|
1676
1697
|
const SCOPE_SEPARATOR = "%2f";
|
|
1677
1698
|
exports.NpmRegistryClient = NpmRegistryClient_1 = class NpmRegistryClient {
|
|
1699
|
+
constructor() {
|
|
1700
|
+
this.httpClient = void 0;
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1678
1703
|
static escapeName(name) {
|
|
1679
1704
|
// scoped packages contain slashes and the npm registry expects them to be escaped
|
|
1680
1705
|
return name.replace("/", SCOPE_SEPARATOR);
|
|
@@ -1800,6 +1825,14 @@ function mapPlugins(_ref) {
|
|
|
1800
1825
|
}
|
|
1801
1826
|
|
|
1802
1827
|
exports.CliPlugins = class CliPlugins {
|
|
1828
|
+
constructor() {
|
|
1829
|
+
this.name = void 0;
|
|
1830
|
+
this.npmRegistryClient = void 0;
|
|
1831
|
+
this.injector = void 0;
|
|
1832
|
+
this.cliHooks = void 0;
|
|
1833
|
+
this.packageJson = void 0;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1803
1836
|
async searchPlugins(keyword = "", options = {}) {
|
|
1804
1837
|
const result = await this.npmRegistryClient.search(this.getKeyword(keyword), options);
|
|
1805
1838
|
return result.filter(({
|
|
@@ -1858,6 +1891,10 @@ exports.CliPlugins = tslib.__decorate([di.Injectable()], exports.CliPlugins);
|
|
|
1858
1891
|
const runScript = require("@npmcli/run-script");
|
|
1859
1892
|
|
|
1860
1893
|
exports.CliRunScript = class CliRunScript {
|
|
1894
|
+
constructor() {
|
|
1895
|
+
this.projectPackageJson = void 0;
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1861
1898
|
run(cmd, args, options = {}) {
|
|
1862
1899
|
return runScript(_extends({
|
|
1863
1900
|
event: "run"
|
|
@@ -3363,6 +3400,12 @@ const _excluded = ["path"];
|
|
|
3363
3400
|
const normalizePath = require("normalize-path");
|
|
3364
3401
|
|
|
3365
3402
|
class Renderer {
|
|
3403
|
+
constructor() {
|
|
3404
|
+
this.configuration = void 0;
|
|
3405
|
+
this.templateDir = void 0;
|
|
3406
|
+
this.fs = void 0;
|
|
3407
|
+
}
|
|
3408
|
+
|
|
3366
3409
|
async render(path$1, data, options = {}) {
|
|
3367
3410
|
const {
|
|
3368
3411
|
output,
|
|
@@ -3501,6 +3544,8 @@ class Renderer {
|
|
|
3501
3544
|
|
|
3502
3545
|
}
|
|
3503
3546
|
|
|
3547
|
+
tslib.__decorate([di.Configuration(), tslib.__metadata("design:type", Object)], Renderer.prototype, "configuration", void 0);
|
|
3548
|
+
|
|
3504
3549
|
tslib.__decorate([di.Constant("templateDir"), tslib.__metadata("design:type", String)], Renderer.prototype, "templateDir", void 0);
|
|
3505
3550
|
|
|
3506
3551
|
tslib.__decorate([di.Inject(), tslib.__metadata("design:type", exports.CliFs)], Renderer.prototype, "fs", void 0);
|
|
@@ -3513,11 +3558,6 @@ exports.RootRendererService = class RootRendererService extends Renderer {
|
|
|
3513
3558
|
}
|
|
3514
3559
|
|
|
3515
3560
|
};
|
|
3516
|
-
|
|
3517
|
-
tslib.__decorate([di.Constant("templateDir"), tslib.__metadata("design:type", String)], exports.RootRendererService.prototype, "templateDir", void 0);
|
|
3518
|
-
|
|
3519
|
-
tslib.__decorate([di.Configuration(), tslib.__metadata("design:type", Object)], exports.RootRendererService.prototype, "configuration", void 0);
|
|
3520
|
-
|
|
3521
3561
|
exports.RootRendererService = tslib.__decorate([di.Injectable()], exports.RootRendererService);
|
|
3522
3562
|
exports.SrcRendererService = class SrcRendererService extends Renderer {
|
|
3523
3563
|
get rootDir() {
|
|
@@ -3527,11 +3567,6 @@ exports.SrcRendererService = class SrcRendererService extends Renderer {
|
|
|
3527
3567
|
}
|
|
3528
3568
|
|
|
3529
3569
|
};
|
|
3530
|
-
|
|
3531
|
-
tslib.__decorate([di.Constant("templateDir"), tslib.__metadata("design:type", String)], exports.SrcRendererService.prototype, "templateDir", void 0);
|
|
3532
|
-
|
|
3533
|
-
tslib.__decorate([di.Configuration(), tslib.__metadata("design:type", Object)], exports.SrcRendererService.prototype, "configuration", void 0);
|
|
3534
|
-
|
|
3535
3570
|
exports.SrcRendererService = tslib.__decorate([di.Injectable()], exports.SrcRendererService);
|
|
3536
3571
|
exports.ScriptsRendererService = class ScriptsRendererService extends Renderer {
|
|
3537
3572
|
get rootDir() {
|
|
@@ -3541,14 +3576,14 @@ exports.ScriptsRendererService = class ScriptsRendererService extends Renderer {
|
|
|
3541
3576
|
}
|
|
3542
3577
|
|
|
3543
3578
|
};
|
|
3544
|
-
|
|
3545
|
-
tslib.__decorate([di.Constant("templateDir"), tslib.__metadata("design:type", String)], exports.ScriptsRendererService.prototype, "templateDir", void 0);
|
|
3546
|
-
|
|
3547
|
-
tslib.__decorate([di.Configuration(), tslib.__metadata("design:type", Object)], exports.ScriptsRendererService.prototype, "configuration", void 0);
|
|
3548
|
-
|
|
3549
3579
|
exports.ScriptsRendererService = tslib.__decorate([di.Injectable()], exports.ScriptsRendererService);
|
|
3550
3580
|
|
|
3551
3581
|
exports.CliYaml = class CliYaml {
|
|
3582
|
+
constructor() {
|
|
3583
|
+
this.projectPackageJson = void 0;
|
|
3584
|
+
this.fs = void 0;
|
|
3585
|
+
}
|
|
3586
|
+
|
|
3552
3587
|
async read(path) {
|
|
3553
3588
|
const file = !this.fs.exists(path) ? this.fs.findUpFile(this.projectPackageJson.dir, path) : path;
|
|
3554
3589
|
|
|
@@ -3579,6 +3614,10 @@ tslib.__decorate([di.Inject(), tslib.__metadata("design:type", exports.CliFs)],
|
|
|
3579
3614
|
exports.CliYaml = tslib.__decorate([di.Injectable()], exports.CliYaml);
|
|
3580
3615
|
|
|
3581
3616
|
exports.CliDockerComposeYaml = class CliDockerComposeYaml {
|
|
3617
|
+
constructor() {
|
|
3618
|
+
this.cliYaml = void 0;
|
|
3619
|
+
}
|
|
3620
|
+
|
|
3582
3621
|
async read() {
|
|
3583
3622
|
return this.cliYaml.read("docker-compose.yml");
|
|
3584
3623
|
}
|
|
@@ -3666,6 +3705,8 @@ class CliError extends Error {
|
|
|
3666
3705
|
}) {
|
|
3667
3706
|
super(origin.message);
|
|
3668
3707
|
this.name = "CLI_ERROR";
|
|
3708
|
+
this.cli = void 0;
|
|
3709
|
+
this.origin = void 0;
|
|
3669
3710
|
this.cli = cli;
|
|
3670
3711
|
this.origin = origin;
|
|
3671
3712
|
this.stack = origin.stack;
|
|
@@ -3682,6 +3723,11 @@ function isHelpManual(argv) {
|
|
|
3682
3723
|
}
|
|
3683
3724
|
|
|
3684
3725
|
exports.CliCore = CliCore_1 = class CliCore {
|
|
3726
|
+
constructor() {
|
|
3727
|
+
this.injector = void 0;
|
|
3728
|
+
this.cliService = void 0;
|
|
3729
|
+
}
|
|
3730
|
+
|
|
3685
3731
|
static checkNodeVersion(wanted, id) {
|
|
3686
3732
|
if (!semver.satisfies(process.version, wanted)) {
|
|
3687
3733
|
console.log(chalk__default['default'].red("You are using Node " + process.version + ", but this version of " + id + " requires Node " + wanted + ".\nPlease upgrade your Node version."));
|
|
@@ -3699,7 +3745,7 @@ exports.CliCore = CliCore_1 = class CliCore {
|
|
|
3699
3745
|
const cli = injector.get(CliCore_1);
|
|
3700
3746
|
|
|
3701
3747
|
try {
|
|
3702
|
-
await cli.cliService.parseArgs(injector.settings.argv);
|
|
3748
|
+
await cli.cliService.parseArgs(injector.settings.get("argv"));
|
|
3703
3749
|
} catch (er) {
|
|
3704
3750
|
throw new CliError({
|
|
3705
3751
|
origin: er,
|
|
@@ -3715,7 +3761,7 @@ exports.CliCore = CliCore_1 = class CliCore {
|
|
|
3715
3761
|
const container = di.createContainer();
|
|
3716
3762
|
await injector.load(container, module);
|
|
3717
3763
|
await injector.emit("$afterInit");
|
|
3718
|
-
injector.settings.loaded
|
|
3764
|
+
injector.settings.set("loaded", true);
|
|
3719
3765
|
}
|
|
3720
3766
|
|
|
3721
3767
|
static updateNotifier(pkg) {
|