@tsed/cli 3.24.1 → 3.25.0
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/cjs/Cli.js +35 -4
- package/lib/cjs/Cli.js.map +1 -1
- package/lib/cjs/bin/tsed.js +1 -23
- package/lib/cjs/bin/tsed.js.map +1 -1
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/Cli.js +35 -4
- package/lib/esm/Cli.js.map +1 -1
- package/lib/esm/bin/tsed.js +1 -22
- package/lib/esm/bin/tsed.js.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/types/Cli.d.ts +23 -1
- package/lib/types/commands/index.d.ts +1 -1
- package/lib/types/index.d.ts +1 -0
- package/package.json +2 -2
- package/readme.md +27 -8
package/lib/cjs/Cli.js
CHANGED
|
@@ -7,7 +7,29 @@ const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
8
8
|
// @ts-ignore
|
|
9
9
|
const module_alias_1 = tslib_1.__importDefault(require("module-alias"));
|
|
10
|
+
const constants_1 = require("./constants");
|
|
11
|
+
const commands_1 = tslib_1.__importDefault(require("./commands"));
|
|
12
|
+
const interfaces_1 = require("./interfaces");
|
|
10
13
|
class Cli extends cli_core_1.CliCore {
|
|
14
|
+
static defaults = {
|
|
15
|
+
name: "tsed",
|
|
16
|
+
pkg: constants_1.PKG,
|
|
17
|
+
templateDir: constants_1.TEMPLATE_DIR,
|
|
18
|
+
plugins: true,
|
|
19
|
+
commands: commands_1.default,
|
|
20
|
+
defaultProjectPreferences() {
|
|
21
|
+
return {
|
|
22
|
+
convention: interfaces_1.ProjectConvention.DEFAULT,
|
|
23
|
+
architecture: interfaces_1.ArchitectureConvention.DEFAULT
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
project: {
|
|
27
|
+
reinstallAfterRun: true
|
|
28
|
+
},
|
|
29
|
+
logger: {
|
|
30
|
+
level: "info"
|
|
31
|
+
}
|
|
32
|
+
};
|
|
11
33
|
static checkPackage(pkg) {
|
|
12
34
|
if (!pkg) {
|
|
13
35
|
console.log(chalk_1.default.red(`settings.pkg is required. Require the package.json of your CLI when you bootstrap the CLI.`));
|
|
@@ -28,12 +50,21 @@ class Cli extends cli_core_1.CliCore {
|
|
|
28
50
|
this.checkNodeVersion(pkg.engines.node, pkg.name);
|
|
29
51
|
}
|
|
30
52
|
}
|
|
31
|
-
static async bootstrap(settings) {
|
|
32
|
-
const
|
|
33
|
-
|
|
53
|
+
static async bootstrap(settings = {}) {
|
|
54
|
+
const opts = {
|
|
55
|
+
...Cli.defaults,
|
|
56
|
+
...settings
|
|
57
|
+
};
|
|
58
|
+
const { pkg } = opts;
|
|
59
|
+
this.checkPrecondition(opts);
|
|
34
60
|
this.createAliases();
|
|
35
61
|
this.updateNotifier(pkg);
|
|
36
|
-
return super.bootstrap(
|
|
62
|
+
return super.bootstrap(opts, Cli);
|
|
63
|
+
}
|
|
64
|
+
static async dispatch(cmd, context) {
|
|
65
|
+
this.createAliases();
|
|
66
|
+
const cli = await this.create({ ...Cli.defaults }, Cli);
|
|
67
|
+
await cli.cliService.dispatch(cmd, context);
|
|
37
68
|
}
|
|
38
69
|
static createAliases() {
|
|
39
70
|
module_alias_1.default.addAliases({
|
package/lib/cjs/Cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cli.js","sourceRoot":"","sources":["../../src/Cli.ts"],"names":[],"mappings":";;;;AAAA,6CAAuC;AACvC,0DAA0B;AAC1B,6DAA6D;AAC7D,aAAa;AACb,wEAAiC;
|
|
1
|
+
{"version":3,"file":"Cli.js","sourceRoot":"","sources":["../../src/Cli.ts"],"names":[],"mappings":";;;;AAAA,6CAAuC;AACvC,0DAA0B;AAC1B,6DAA6D;AAC7D,aAAa;AACb,wEAAiC;AACjC,2CAA8C;AAC9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IAED,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,WAAgB,EAAE;QACvC,MAAM,IAAI,GAAQ;YAChB,GAAG,GAAG,CAAC,QAAQ;YACf,GAAG,QAAQ;SACZ,CAAC;QAEF,MAAM,EAAC,GAAG,EAAC,GAAG,IAAI,CAAC;QAEnB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QAEzB,OAAO,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACpC,CAAC;IAID,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAW,EAAE,OAAY;QAC7C,IAAI,CAAC,aAAa,EAAE,CAAC;QAErB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAM,EAAC,GAAG,GAAG,CAAC,QAAQ,EAAQ,EAAE,GAAG,CAAC,CAAC;QAElE,MAAM,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,aAAa;QAClB,sBAAK,CAAC,UAAU,CAAC;YACf,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;YAC3C,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;YACvC,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC;YAC/C,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC;YACnD,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;SAC1C,CAAC,CAAC;IACL,CAAC;;AA/EH,kBAgFC","sourcesContent":["import {CliCore} from \"@tsed/cli-core\";\nimport chalk from \"chalk\";\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport alias from \"module-alias\";\nimport {PKG, TEMPLATE_DIR} from \"./constants\";\nimport commands from \"./commands\";\nimport {ArchitectureConvention, ProjectConvention} from \"./interfaces\";\nimport {InitCmdContext} from \"./commands/init/InitCmd\";\nimport {GenerateCmdContext} from \"./commands/generate/GenerateCmd\";\n\nexport class Cli extends CliCore {\n static defaults = {\n name: \"tsed\",\n pkg: PKG,\n templateDir: TEMPLATE_DIR,\n plugins: true,\n commands,\n defaultProjectPreferences() {\n return {\n convention: ProjectConvention.DEFAULT,\n architecture: ArchitectureConvention.DEFAULT\n };\n },\n project: {\n reinstallAfterRun: true\n },\n logger: {\n level: \"info\"\n }\n };\n\n static checkPackage(pkg: any) {\n if (!pkg) {\n console.log(chalk.red(`settings.pkg is required. Require the package.json of your CLI when you bootstrap the CLI.`));\n process.exit(1);\n }\n }\n\n static checkName(name: string) {\n if (!name) {\n console.log(chalk.red(`settings.name is required. Add the name of your CLI.`));\n process.exit(1);\n }\n }\n\n static checkPrecondition(settings: any) {\n const {pkg} = settings;\n\n this.checkPackage(pkg);\n this.checkName(pkg.name);\n\n if (pkg?.engines?.node) {\n this.checkNodeVersion(pkg.engines.node, pkg.name);\n }\n }\n\n static async bootstrap(settings: any = {}) {\n const opts: any = {\n ...Cli.defaults,\n ...settings\n };\n\n const {pkg} = opts;\n\n this.checkPrecondition(opts);\n this.createAliases();\n this.updateNotifier(pkg);\n\n return super.bootstrap(opts, Cli);\n }\n\n static async dispatch(cmd: \"init\", context: InitCmdContext): Promise<void>;\n static async dispatch(cmd: \"generate\", context: GenerateCmdContext): Promise<void>;\n static async dispatch(cmd: string, context: any) {\n this.createAliases();\n\n const cli = await this.create<Cli>({...Cli.defaults} as any, Cli);\n\n await cli.cliService.dispatch(cmd, context);\n }\n\n static createAliases() {\n alias.addAliases({\n \"@tsed/core\": require.resolve(\"@tsed/core\"),\n \"@tsed/di\": require.resolve(\"@tsed/di\"),\n \"@tsed/schema\": require.resolve(\"@tsed/schema\"),\n \"@tsed/cli-core\": require.resolve(\"@tsed/cli-core\"),\n \"@tsed/cli\": require.resolve(\"@tsed/cli\")\n });\n }\n}\n"]}
|
package/lib/cjs/bin/tsed.js
CHANGED
|
@@ -1,28 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const Cli_1 = require("../Cli");
|
|
6
|
-
|
|
7
|
-
const interfaces_1 = require("../interfaces");
|
|
8
|
-
const constants_1 = require("../constants");
|
|
9
|
-
Cli_1.Cli.bootstrap({
|
|
10
|
-
name: "tsed",
|
|
11
|
-
pkg: constants_1.PKG,
|
|
12
|
-
templateDir: constants_1.TEMPLATE_DIR,
|
|
13
|
-
plugins: true,
|
|
14
|
-
commands: commands_1.default,
|
|
15
|
-
defaultProjectPreferences() {
|
|
16
|
-
return {
|
|
17
|
-
convention: interfaces_1.ProjectConvention.DEFAULT,
|
|
18
|
-
architecture: interfaces_1.ArchitectureConvention.DEFAULT
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
project: {
|
|
22
|
-
reinstallAfterRun: true
|
|
23
|
-
},
|
|
24
|
-
logger: {
|
|
25
|
-
level: "info"
|
|
26
|
-
}
|
|
27
|
-
}).catch(console.error);
|
|
5
|
+
Cli_1.Cli.bootstrap({}).catch(console.error);
|
|
28
6
|
//# sourceMappingURL=tsed.js.map
|
package/lib/cjs/bin/tsed.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsed.js","sourceRoot":"","sources":["../../../src/bin/tsed.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsed.js","sourceRoot":"","sources":["../../../src/bin/tsed.ts"],"names":[],"mappings":";;;AACA,gCAA2B;AAE3B,SAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport {Cli} from \"../Cli\";\n\nCli.bootstrap({}).catch(console.error);\n"]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -10,4 +10,5 @@ tslib_1.__exportStar(require("./services/ProvidersInfoService"), exports);
|
|
|
10
10
|
tslib_1.__exportStar(require("./services/Features"), exports);
|
|
11
11
|
tslib_1.__exportStar(require("./pipes"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./constants"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./Cli"), exports);
|
|
13
14
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,kEAAwC;AACxC,0EAAgD;AAChD,sEAA4C;AAC5C,uDAA6B;AAC7B,0EAAgD;AAChD,8DAAoC;AACpC,kDAAwB;AACxB,sDAA4B","sourcesContent":["export * from \"./commands/add/AddCmd\";\nexport * from \"./commands/init/InitCmd\";\nexport * from \"./commands/generate/GenerateCmd\";\nexport * from \"./commands/update/UpdateCmd\";\nexport * from \"./interfaces\";\nexport * from \"./services/ProvidersInfoService\";\nexport * from \"./services/Features\";\nexport * from \"./pipes\";\nexport * from \"./constants\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,kEAAwC;AACxC,0EAAgD;AAChD,sEAA4C;AAC5C,uDAA6B;AAC7B,0EAAgD;AAChD,8DAAoC;AACpC,kDAAwB;AACxB,sDAA4B;AAC5B,gDAAsB","sourcesContent":["export * from \"./commands/add/AddCmd\";\nexport * from \"./commands/init/InitCmd\";\nexport * from \"./commands/generate/GenerateCmd\";\nexport * from \"./commands/update/UpdateCmd\";\nexport * from \"./interfaces\";\nexport * from \"./services/ProvidersInfoService\";\nexport * from \"./services/Features\";\nexport * from \"./pipes\";\nexport * from \"./constants\";\nexport * from \"./Cli\";\n"]}
|
package/lib/esm/Cli.js
CHANGED
|
@@ -3,7 +3,29 @@ import chalk from "chalk";
|
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
4
|
// @ts-ignore
|
|
5
5
|
import alias from "module-alias";
|
|
6
|
+
import { PKG, TEMPLATE_DIR } from "./constants.js";
|
|
7
|
+
import commands from "./commands.js";
|
|
8
|
+
import { ArchitectureConvention, ProjectConvention } from "./interfaces.js";
|
|
6
9
|
export class Cli extends CliCore {
|
|
10
|
+
static defaults = {
|
|
11
|
+
name: "tsed",
|
|
12
|
+
pkg: PKG,
|
|
13
|
+
templateDir: TEMPLATE_DIR,
|
|
14
|
+
plugins: true,
|
|
15
|
+
commands,
|
|
16
|
+
defaultProjectPreferences() {
|
|
17
|
+
return {
|
|
18
|
+
convention: ProjectConvention.DEFAULT,
|
|
19
|
+
architecture: ArchitectureConvention.DEFAULT
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
project: {
|
|
23
|
+
reinstallAfterRun: true
|
|
24
|
+
},
|
|
25
|
+
logger: {
|
|
26
|
+
level: "info"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
7
29
|
static checkPackage(pkg) {
|
|
8
30
|
if (!pkg) {
|
|
9
31
|
console.log(chalk.red(`settings.pkg is required. Require the package.json of your CLI when you bootstrap the CLI.`));
|
|
@@ -24,12 +46,21 @@ export class Cli extends CliCore {
|
|
|
24
46
|
this.checkNodeVersion(pkg.engines.node, pkg.name);
|
|
25
47
|
}
|
|
26
48
|
}
|
|
27
|
-
static async bootstrap(settings) {
|
|
28
|
-
const
|
|
29
|
-
|
|
49
|
+
static async bootstrap(settings = {}) {
|
|
50
|
+
const opts = {
|
|
51
|
+
...Cli.defaults,
|
|
52
|
+
...settings
|
|
53
|
+
};
|
|
54
|
+
const { pkg } = opts;
|
|
55
|
+
this.checkPrecondition(opts);
|
|
30
56
|
this.createAliases();
|
|
31
57
|
this.updateNotifier(pkg);
|
|
32
|
-
return super.bootstrap(
|
|
58
|
+
return super.bootstrap(opts, Cli);
|
|
59
|
+
}
|
|
60
|
+
static async dispatch(cmd, context) {
|
|
61
|
+
this.createAliases();
|
|
62
|
+
const cli = await this.create({ ...Cli.defaults }, Cli);
|
|
63
|
+
await cli.cliService.dispatch(cmd, context);
|
|
33
64
|
}
|
|
34
65
|
static createAliases() {
|
|
35
66
|
alias.addAliases({
|
package/lib/esm/Cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cli.js","sourceRoot":"","sources":["../../src/Cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,6DAA6D;AAC7D,aAAa;AACb,OAAO,KAAK,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Cli.js","sourceRoot":"","sources":["../../src/Cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,6DAA6D;AAC7D,aAAa;AACb,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAC,GAAG,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAC9C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,sBAAsB,EAAE,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAIvE,MAAM,OAAO,GAAI,SAAQ,OAAO;IAC9B,MAAM,CAAC,QAAQ,GAAG;QAChB,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,GAAG;QACR,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,IAAI;QACb,QAAQ;QACR,yBAAyB;YACvB,OAAO;gBACL,UAAU,EAAE,iBAAiB,CAAC,OAAO;gBACrC,YAAY,EAAE,sBAAsB,CAAC,OAAO;aAC7C,CAAC;QACJ,CAAC;QACD,OAAO,EAAE;YACP,i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AI,EAAE,GAAG,CAAC,CAAC;IACpC,CAAC;IAID,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAW,EAAE,OAAY;QAC7C,IAAI,CAAC,aAAa,EAAE,CAAC;QAErB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAM,EAAC,GAAG,GAAG,CAAC,QAAQ,EAAQ,EAAE,GAAG,CAAC,CAAC;QAElE,MAAM,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,aAAa;QAClB,KAAK,CAAC,UAAU,CAAC;YACf,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;YAC3C,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;YACvC,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC;YAC/C,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC;YACnD,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;SAC1C,CAAC,CAAC;IACL,CAAC","sourcesContent":["import {CliCore} from \"@tsed/cli-core\";\nimport chalk from \"chalk\";\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport alias from \"module-alias\";\nimport {PKG, TEMPLATE_DIR} from \"./constants\";\nimport commands from \"./commands\";\nimport {ArchitectureConvention, ProjectConvention} from \"./interfaces\";\nimport {InitCmdContext} from \"./commands/init/InitCmd\";\nimport {GenerateCmdContext} from \"./commands/generate/GenerateCmd\";\n\nexport class Cli extends CliCore {\n static defaults = {\n name: \"tsed\",\n pkg: PKG,\n templateDir: TEMPLATE_DIR,\n plugins: true,\n commands,\n defaultProjectPreferences() {\n return {\n convention: ProjectConvention.DEFAULT,\n architecture: ArchitectureConvention.DEFAULT\n };\n },\n project: {\n reinstallAfterRun: true\n },\n logger: {\n level: \"info\"\n }\n };\n\n static checkPackage(pkg: any) {\n if (!pkg) {\n console.log(chalk.red(`settings.pkg is required. Require the package.json of your CLI when you bootstrap the CLI.`));\n process.exit(1);\n }\n }\n\n static checkName(name: string) {\n if (!name) {\n console.log(chalk.red(`settings.name is required. Add the name of your CLI.`));\n process.exit(1);\n }\n }\n\n static checkPrecondition(settings: any) {\n const {pkg} = settings;\n\n this.checkPackage(pkg);\n this.checkName(pkg.name);\n\n if (pkg?.engines?.node) {\n this.checkNodeVersion(pkg.engines.node, pkg.name);\n }\n }\n\n static async bootstrap(settings: any = {}) {\n const opts: any = {\n ...Cli.defaults,\n ...settings\n };\n\n const {pkg} = opts;\n\n this.checkPrecondition(opts);\n this.createAliases();\n this.updateNotifier(pkg);\n\n return super.bootstrap(opts, Cli);\n }\n\n static async dispatch(cmd: \"init\", context: InitCmdContext): Promise<void>;\n static async dispatch(cmd: \"generate\", context: GenerateCmdContext): Promise<void>;\n static async dispatch(cmd: string, context: any) {\n this.createAliases();\n\n const cli = await this.create<Cli>({...Cli.defaults} as any, Cli);\n\n await cli.cliService.dispatch(cmd, context);\n }\n\n static createAliases() {\n alias.addAliases({\n \"@tsed/core\": require.resolve(\"@tsed/core\"),\n \"@tsed/di\": require.resolve(\"@tsed/di\"),\n \"@tsed/schema\": require.resolve(\"@tsed/schema\"),\n \"@tsed/cli-core\": require.resolve(\"@tsed/cli-core\"),\n \"@tsed/cli\": require.resolve(\"@tsed/cli\")\n });\n }\n}\n"]}
|
package/lib/esm/bin/tsed.js
CHANGED
|
@@ -1,25 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Cli } from "../Cli.js";
|
|
3
|
-
|
|
4
|
-
import { ArchitectureConvention, ProjectConvention } from "../interfaces.js";
|
|
5
|
-
import { PKG, TEMPLATE_DIR } from "../constants.js";
|
|
6
|
-
Cli.bootstrap({
|
|
7
|
-
name: "tsed",
|
|
8
|
-
pkg: PKG,
|
|
9
|
-
templateDir: TEMPLATE_DIR,
|
|
10
|
-
plugins: true,
|
|
11
|
-
commands,
|
|
12
|
-
defaultProjectPreferences() {
|
|
13
|
-
return {
|
|
14
|
-
convention: ProjectConvention.DEFAULT,
|
|
15
|
-
architecture: ArchitectureConvention.DEFAULT
|
|
16
|
-
};
|
|
17
|
-
},
|
|
18
|
-
project: {
|
|
19
|
-
reinstallAfterRun: true
|
|
20
|
-
},
|
|
21
|
-
logger: {
|
|
22
|
-
level: "info"
|
|
23
|
-
}
|
|
24
|
-
}).catch(console.error);
|
|
3
|
+
Cli.bootstrap({}).catch(console.error);
|
|
25
4
|
//# sourceMappingURL=tsed.js.map
|
package/lib/esm/bin/tsed.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsed.js","sourceRoot":"","sources":["../../../src/bin/tsed.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,GAAG,EAAC,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"tsed.js","sourceRoot":"","sources":["../../../src/bin/tsed.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,GAAG,EAAC,MAAM,QAAQ,CAAC;AAE3B,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport {Cli} from \"../Cli\";\n\nCli.bootstrap({}).catch(console.error);\n"]}
|
package/lib/esm/index.js
CHANGED
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,cAAc,CAAC;AAC7B,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC","sourcesContent":["export * from \"./commands/add/AddCmd\";\nexport * from \"./commands/init/InitCmd\";\nexport * from \"./commands/generate/GenerateCmd\";\nexport * from \"./commands/update/UpdateCmd\";\nexport * from \"./interfaces\";\nexport * from \"./services/ProvidersInfoService\";\nexport * from \"./services/Features\";\nexport * from \"./pipes\";\nexport * from \"./constants\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,cAAc,CAAC;AAC7B,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC","sourcesContent":["export * from \"./commands/add/AddCmd\";\nexport * from \"./commands/init/InitCmd\";\nexport * from \"./commands/generate/GenerateCmd\";\nexport * from \"./commands/update/UpdateCmd\";\nexport * from \"./interfaces\";\nexport * from \"./services/ProvidersInfoService\";\nexport * from \"./services/Features\";\nexport * from \"./pipes\";\nexport * from \"./constants\";\nexport * from \"./Cli\";\n"]}
|
package/lib/types/Cli.d.ts
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
import { CliCore } from "@tsed/cli-core";
|
|
2
|
+
import { ArchitectureConvention, ProjectConvention } from "./interfaces";
|
|
3
|
+
import { InitCmdContext } from "./commands/init/InitCmd";
|
|
4
|
+
import { GenerateCmdContext } from "./commands/generate/GenerateCmd";
|
|
2
5
|
export declare class Cli extends CliCore {
|
|
6
|
+
static defaults: {
|
|
7
|
+
name: string;
|
|
8
|
+
pkg: import("read-pkg").NormalizedPackageJson;
|
|
9
|
+
templateDir: string;
|
|
10
|
+
plugins: boolean;
|
|
11
|
+
commands: (typeof import("./commands/init/InitCmd").InitCmd | typeof import("./commands/generate/GenerateCmd").GenerateCmd | typeof import(".").UpdateCmd | typeof import(".").AddCmd | typeof import("./commands/run/RunCmd").RunCmd)[];
|
|
12
|
+
defaultProjectPreferences(): {
|
|
13
|
+
convention: ProjectConvention;
|
|
14
|
+
architecture: ArchitectureConvention;
|
|
15
|
+
};
|
|
16
|
+
project: {
|
|
17
|
+
reinstallAfterRun: boolean;
|
|
18
|
+
};
|
|
19
|
+
logger: {
|
|
20
|
+
level: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
3
23
|
static checkPackage(pkg: any): void;
|
|
4
24
|
static checkName(name: string): void;
|
|
5
25
|
static checkPrecondition(settings: any): void;
|
|
6
|
-
static bootstrap(settings
|
|
26
|
+
static bootstrap(settings?: any): Promise<CliCore>;
|
|
27
|
+
static dispatch(cmd: "init", context: InitCmdContext): Promise<void>;
|
|
28
|
+
static dispatch(cmd: "generate", context: GenerateCmdContext): Promise<void>;
|
|
7
29
|
static createAliases(): void;
|
|
8
30
|
}
|
|
@@ -3,5 +3,5 @@ import { GenerateCmd } from "./generate/GenerateCmd";
|
|
|
3
3
|
import { UpdateCmd } from "./update/UpdateCmd";
|
|
4
4
|
import { AddCmd } from "./add/AddCmd";
|
|
5
5
|
import { RunCmd } from "./run/RunCmd";
|
|
6
|
-
declare const _default: (typeof
|
|
6
|
+
declare const _default: (typeof InitCmd | typeof GenerateCmd | typeof UpdateCmd | typeof AddCmd | typeof RunCmd)[];
|
|
7
7
|
export default _default;
|
package/lib/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.25.0",
|
|
4
4
|
"source": "./src/index.ts",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"node": ">=14"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@tsed/cli-core": "3.
|
|
59
|
+
"@tsed/cli-core": "3.25.0",
|
|
60
60
|
"@tsed/core": ">=6.114.14",
|
|
61
61
|
"@tsed/di": ">=6.114.14",
|
|
62
62
|
"@tsed/logger": ">=6.0.0",
|
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @tsed/cli
|
|
1
|
+
# @tsed/cli
|
|
2
2
|
|
|
3
3
|
<p style="text-align: center" align="center">
|
|
4
4
|
<a href="https://tsed.io" target="_blank"><img src="https://tsed.io/tsed-og.png" width="200" alt="Ts.ED logo"/></a>
|
|
@@ -45,24 +45,36 @@ https-proxy=http://username:password@host:port
|
|
|
45
45
|
https_proxy=http://username:password@host:port
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
> Note: The following environment variables can be also used to configure the proxy `HTTPS_PROXY`, `HTTP_PROXY`
|
|
48
|
+
> Note: The following environment variables can be also used to configure the proxy `HTTPS_PROXY`, `HTTP_PROXY`
|
|
49
|
+
> and `NODE_TLS_REJECT_UNAUTHORIZED`.
|
|
50
|
+
|
|
51
|
+
## Run Cli from code
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import {Cli} from "@tsed/cli";
|
|
55
|
+
|
|
56
|
+
Cli.dispatch("init", {
|
|
57
|
+
//... init options
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
```
|
|
49
61
|
|
|
50
62
|
## Contributors
|
|
63
|
+
|
|
51
64
|
Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html)
|
|
52
65
|
|
|
53
66
|
<a href="https://github.com/tsedio/ts-express-decorators/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
|
|
54
67
|
|
|
55
|
-
|
|
56
68
|
## Backers
|
|
57
69
|
|
|
58
70
|
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/tsed#backer)]
|
|
59
71
|
|
|
60
72
|
<a href="https://opencollective.com/tsed#backers" target="_blank"><img src="https://opencollective.com/tsed/tiers/backer.svg?width=890"></a>
|
|
61
73
|
|
|
62
|
-
|
|
63
74
|
## Sponsors
|
|
64
75
|
|
|
65
|
-
Support this project by becoming a sponsor. Your logo will show up here with a link to your
|
|
76
|
+
Support this project by becoming a sponsor. Your logo will show up here with a link to your
|
|
77
|
+
website. [[Become a sponsor](https://opencollective.com/tsed#sponsor)]
|
|
66
78
|
|
|
67
79
|
## License
|
|
68
80
|
|
|
@@ -70,8 +82,15 @@ The MIT License (MIT)
|
|
|
70
82
|
|
|
71
83
|
Copyright (c) 2016 - 2018 Romain Lenzotti
|
|
72
84
|
|
|
73
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
85
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
86
|
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
87
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
88
|
+
persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
74
89
|
|
|
75
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
90
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
91
|
+
Software.
|
|
76
92
|
|
|
77
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
93
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
94
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
95
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
96
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|