@nexus-ioc/cli 0.1.0 → 0.1.2
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/package.json +3 -2
- package/dist/actions/abstract.action.d.ts +0 -4
- package/dist/actions/abstract.action.js +0 -7
- package/dist/actions/abstract.action.js.map +0 -1
- package/dist/actions/generate.action.d.ts +0 -15
- package/dist/actions/generate.action.js +0 -136
- package/dist/actions/generate.action.js.map +0 -1
- package/dist/actions/install.action.d.ts +0 -4
- package/dist/actions/install.action.js +0 -27
- package/dist/actions/install.action.js.map +0 -1
- package/dist/commands/abstract.command.d.ts +0 -4
- package/dist/commands/abstract.command.js +0 -7
- package/dist/commands/abstract.command.js.map +0 -1
- package/dist/commands/command.input.d.ts +0 -5
- package/dist/commands/command.input.js +0 -3
- package/dist/commands/command.input.js.map +0 -1
- package/dist/commands/generate.command.d.ts +0 -8
- package/dist/commands/generate.command.js +0 -31
- package/dist/commands/generate.command.js.map +0 -1
- package/dist/commands/install.command.d.ts +0 -8
- package/dist/commands/install.command.js +0 -21
- package/dist/commands/install.command.js.map +0 -1
- package/dist/commands.helper.d.ts +0 -15
- package/dist/commands.helper.js +0 -42
- package/dist/commands.helper.js.map +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -18
- package/dist/index.js.map +0 -1
- package/dist/templates/module.template.d.ts +0 -18
- package/dist/templates/module.template.js +0 -56
- package/dist/templates/module.template.js.map +0 -1
- package/dist/templates/service-spec.template.d.ts +0 -9
- package/dist/templates/service-spec.template.js +0 -32
- package/dist/templates/service-spec.template.js.map +0 -1
- package/dist/templates/service.template.d.ts +0 -9
- package/dist/templates/service.template.js +0 -20
- package/dist/templates/service.template.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexus-ioc/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "CLI tools for Nexus IoC",
|
|
5
5
|
"author": "Isqanderm <aleksandr.melnik.personal@gmail.com> (https://www.linkedin.com/in/isqander-melnik)",
|
|
6
6
|
"homepage": "https://github.com/Isqanderm/ioc#readme",
|
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"prettier": "^3.3.3",
|
|
52
|
-
"ts-morph": "^23.0.0"
|
|
52
|
+
"ts-morph": "^23.0.0",
|
|
53
|
+
"commander": "^12.1.0"
|
|
53
54
|
},
|
|
54
55
|
"scripts": {
|
|
55
56
|
"build": "tsc",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abstract.action.js","sourceRoot":"","sources":["../../src/actions/abstract.action.ts"],"names":[],"mappings":";;;AAEA,MAAsB,cAAc;CAEnC;AAFD,wCAEC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Input } from "../commands/command.input";
|
|
2
|
-
import { AbstractAction } from "./abstract.action";
|
|
3
|
-
export declare class GenerateAction extends AbstractAction {
|
|
4
|
-
private readonly project;
|
|
5
|
-
handler(inputs: Input[], options: Input[]): Promise<void>;
|
|
6
|
-
private generateProvider;
|
|
7
|
-
generateModule(name: string, outputDir: string, moduleArgs: {
|
|
8
|
-
providers: string[];
|
|
9
|
-
addImports: string[];
|
|
10
|
-
}): Promise<void>;
|
|
11
|
-
generateServiceSpec(name: string, outputDir: string): Promise<void>;
|
|
12
|
-
private ifModuleExist;
|
|
13
|
-
private capitalize;
|
|
14
|
-
private prettify;
|
|
15
|
-
}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GenerateAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs = tslib_1.__importStar(require("node:fs"));
|
|
6
|
-
const path = tslib_1.__importStar(require("node:path"));
|
|
7
|
-
const prettier_1 = tslib_1.__importDefault(require("prettier"));
|
|
8
|
-
const ts_morph_1 = require("ts-morph");
|
|
9
|
-
const module_template_1 = require("../templates/module.template");
|
|
10
|
-
const service_spec_template_1 = require("../templates/service-spec.template");
|
|
11
|
-
const service_template_1 = require("../templates/service.template");
|
|
12
|
-
const abstract_action_1 = require("./abstract.action");
|
|
13
|
-
class GenerateAction extends abstract_action_1.AbstractAction {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
this.project = new ts_morph_1.Project();
|
|
17
|
-
}
|
|
18
|
-
async handler(inputs, options) {
|
|
19
|
-
let outputDir = process.cwd();
|
|
20
|
-
let name = "";
|
|
21
|
-
let type = "";
|
|
22
|
-
const createOptions = options.reduce((prev, next) => {
|
|
23
|
-
prev[next.name] = next.value;
|
|
24
|
-
return prev;
|
|
25
|
-
}, {});
|
|
26
|
-
for (const input of inputs) {
|
|
27
|
-
if (input.name === "path") {
|
|
28
|
-
outputDir = path.resolve(outputDir, input.value);
|
|
29
|
-
}
|
|
30
|
-
else if (input.name === "name") {
|
|
31
|
-
name = input.value;
|
|
32
|
-
}
|
|
33
|
-
else if (input.name === "type") {
|
|
34
|
-
type = input.value;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const moduleName = this.capitalize(name);
|
|
38
|
-
if (type === "module") {
|
|
39
|
-
await this.generateModule(name, outputDir, {
|
|
40
|
-
providers: [],
|
|
41
|
-
addImports: [],
|
|
42
|
-
});
|
|
43
|
-
console.log(`Generating module: ${name}`);
|
|
44
|
-
}
|
|
45
|
-
else if (type === "service") {
|
|
46
|
-
console.log(`Generating service: ${name}`);
|
|
47
|
-
await this.generateProvider(name, outputDir);
|
|
48
|
-
if (this.ifModuleExist(name, outputDir) && !createOptions.skipImport) {
|
|
49
|
-
await this.generateModule(name, outputDir, {
|
|
50
|
-
providers: [`${this.capitalize(name)}Service`],
|
|
51
|
-
addImports: [
|
|
52
|
-
`import { ${moduleName}Service } from './${name}.service';`,
|
|
53
|
-
],
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
if (!createOptions.spec) {
|
|
57
|
-
await this.generateServiceSpec(name, outputDir);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
await this.project.save();
|
|
61
|
-
}
|
|
62
|
-
async generateProvider(name, outputDir) {
|
|
63
|
-
const filePath = path.join(outputDir, `${name}.service.ts`);
|
|
64
|
-
const sourceFile = this.project.createSourceFile(filePath, "", {
|
|
65
|
-
overwrite: true,
|
|
66
|
-
});
|
|
67
|
-
const moduleName = this.capitalize(name);
|
|
68
|
-
const serviceTemplate = new service_template_1.ServiceTemplate({ name: moduleName });
|
|
69
|
-
const sourceText = serviceTemplate.generate();
|
|
70
|
-
const formattedText = await this.prettify(sourceText, {
|
|
71
|
-
filepath: filePath,
|
|
72
|
-
});
|
|
73
|
-
sourceFile.replaceWithText(formattedText);
|
|
74
|
-
}
|
|
75
|
-
async generateModule(name, outputDir, moduleArgs) {
|
|
76
|
-
const filePath = path.join(outputDir, `${name}.module.ts`);
|
|
77
|
-
const moduleName = this.capitalize(name);
|
|
78
|
-
if (this.ifModuleExist(name, outputDir)) {
|
|
79
|
-
const sourceFile = this.project.addSourceFileAtPath(filePath);
|
|
80
|
-
const moduleTemplate = new module_template_1.ModuleTemplate({ name: moduleName }, sourceFile.getText());
|
|
81
|
-
moduleTemplate.addProvider(moduleArgs.providers);
|
|
82
|
-
const sourceText = `
|
|
83
|
-
import { NsModule } from 'nexus-ioc';
|
|
84
|
-
${moduleArgs.addImports.join("\n")}
|
|
85
|
-
|
|
86
|
-
${moduleTemplate.generate()}
|
|
87
|
-
`;
|
|
88
|
-
const formattedText = await this.prettify(sourceText, {
|
|
89
|
-
filepath: filePath,
|
|
90
|
-
});
|
|
91
|
-
sourceFile.replaceWithText(formattedText);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
const moduleTemplate = new module_template_1.ModuleTemplate({ name: moduleName });
|
|
95
|
-
const sourceFile = this.project.createSourceFile(filePath, "", {
|
|
96
|
-
overwrite: true,
|
|
97
|
-
});
|
|
98
|
-
moduleTemplate.addProvider(moduleArgs.providers);
|
|
99
|
-
const sourceText = `
|
|
100
|
-
import { NsModule } from 'nexus-ioc';
|
|
101
|
-
${moduleArgs.addImports.join("\n")}
|
|
102
|
-
|
|
103
|
-
${moduleTemplate.generate()}
|
|
104
|
-
`;
|
|
105
|
-
const formattedText = await this.prettify(sourceText, {
|
|
106
|
-
filepath: filePath,
|
|
107
|
-
});
|
|
108
|
-
sourceFile.replaceWithText(formattedText);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
async generateServiceSpec(name, outputDir) {
|
|
112
|
-
const filePath = path.join(outputDir, `${name}.service.spec.ts`);
|
|
113
|
-
const sourceFile = this.project.createSourceFile(filePath, "", {
|
|
114
|
-
overwrite: true,
|
|
115
|
-
});
|
|
116
|
-
const moduleName = this.capitalize(name);
|
|
117
|
-
const serviceTemplate = new service_spec_template_1.ServiceSpecTemplate({ name: moduleName });
|
|
118
|
-
const sourceText = serviceTemplate.generate();
|
|
119
|
-
const formattedText = await this.prettify(sourceText, {
|
|
120
|
-
filepath: filePath,
|
|
121
|
-
});
|
|
122
|
-
sourceFile.replaceWithText(formattedText);
|
|
123
|
-
}
|
|
124
|
-
ifModuleExist(name, outputDir) {
|
|
125
|
-
const filePath = path.join(outputDir, `${name}.module.ts`);
|
|
126
|
-
return fs.existsSync(filePath);
|
|
127
|
-
}
|
|
128
|
-
capitalize(str) {
|
|
129
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
130
|
-
}
|
|
131
|
-
async prettify(text, options) {
|
|
132
|
-
return prettier_1.default.format(text, options);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
exports.GenerateAction = GenerateAction;
|
|
136
|
-
//# sourceMappingURL=generate.action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate.action.js","sourceRoot":"","sources":["../../src/actions/generate.action.ts"],"names":[],"mappings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,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI,YAAY,CAAC,CAAC;QAE3D,OAAO,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAEO,UAAU,CAAC,GAAW;QAC7B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,IAAY,EAAE,OAA6B;QACjE,OAAO,kBAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;CACD;AArJD,wCAqJC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InstallAction = void 0;
|
|
4
|
-
const node_child_process_1 = require("node:child_process");
|
|
5
|
-
const abstract_action_1 = require("./abstract.action");
|
|
6
|
-
class InstallAction extends abstract_action_1.AbstractAction {
|
|
7
|
-
async handler() {
|
|
8
|
-
try {
|
|
9
|
-
// Запускаем команду npm install --save nexus-ioc
|
|
10
|
-
(0, node_child_process_1.exec)("npm install --save nexus-ioc", (error, stdout, stderr) => {
|
|
11
|
-
if (error) {
|
|
12
|
-
console.error(`Install error: ${error.message}`);
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
if (stderr) {
|
|
16
|
-
console.error(`Error: ${stderr}`);
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
catch (err) {
|
|
22
|
-
console.error(`Error: ${err}`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.InstallAction = InstallAction;
|
|
27
|
-
//# sourceMappingURL=install.action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install.action.js","sourceRoot":"","sources":["../../src/actions/install.action.ts"],"names":[],"mappings":";;;AAAA,2DAA0C;AAC1C,uDAAmD;AAEnD,MAAa,aAAc,SAAQ,gCAAc;IAChD,KAAK,CAAC,OAAO;QACZ,IAAI,CAAC;YACJ,iDAAiD;YACjD,IAAA,yBAAI,EAAC,8BAA8B,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;gBAC9D,IAAI,KAAK,EAAE,CAAC;oBACX,OAAO,CAAC,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;oBACjD,OAAO;gBACR,CAAC;gBAED,IAAI,MAAM,EAAE,CAAC;oBACZ,OAAO,CAAC,KAAK,CAAC,UAAU,MAAM,EAAE,CAAC,CAAC;oBAClC,OAAO;gBACR,CAAC;YACF,CAAC,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC,CAAC;QAChC,CAAC;IACF,CAAC;CACD;AAnBD,sCAmBC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abstract.command.js","sourceRoot":"","sources":["../../src/commands/abstract.command.ts"],"names":[],"mappings":";;;AAEA,MAAsB,eAAe;CAEpC;AAFD,0CAEC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.input.js","sourceRoot":"","sources":["../../src/commands/command.input.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import type { AbstractAction } from "../actions/abstract.action";
|
|
3
|
-
import { AbstractCommand } from "./abstract.command";
|
|
4
|
-
export declare class GenerateCommand extends AbstractCommand {
|
|
5
|
-
private readonly action;
|
|
6
|
-
constructor(action: AbstractAction);
|
|
7
|
-
load(): Promise<Command>;
|
|
8
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GenerateCommand = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const abstract_command_1 = require("./abstract.command");
|
|
6
|
-
class GenerateCommand extends abstract_command_1.AbstractCommand {
|
|
7
|
-
constructor(action) {
|
|
8
|
-
super();
|
|
9
|
-
this.action = action;
|
|
10
|
-
}
|
|
11
|
-
async load() {
|
|
12
|
-
return new commander_1.Command("generate")
|
|
13
|
-
.description("Generate a new schematic")
|
|
14
|
-
.arguments("<schematic> [type] [name] [path]")
|
|
15
|
-
.alias("g")
|
|
16
|
-
.option("--skip-import", "Skip importing", () => true, false)
|
|
17
|
-
.option("--no-spec", "Disable spec files generation.", () => true, false)
|
|
18
|
-
.action(async (type, name, path, _, params, command) => {
|
|
19
|
-
const options = [];
|
|
20
|
-
options.push({ name: "skipImport", value: params.skipImport });
|
|
21
|
-
options.push({ name: "spec", value: params.spec });
|
|
22
|
-
const inputs = [];
|
|
23
|
-
inputs.push({ name: "type", value: type });
|
|
24
|
-
inputs.push({ name: "name", value: name });
|
|
25
|
-
inputs.push({ name: "path", value: path });
|
|
26
|
-
await this.action.handler(inputs, options);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.GenerateCommand = GenerateCommand;
|
|
31
|
-
//# sourceMappingURL=generate.command.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate.command.js","sourceRoot":"","sources":["../../src/commands/generate.command.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AAEpC,yDAAqD;AAGrD,MAAa,eAAgB,SAAQ,kCAAe;IACnD,YAA6B,MAAsB;QAClD,KAAK,EAAE,CAAC;QADoB,WAAM,GAAN,MAAM,CAAgB;IAEnD,CAAC;IAED,KAAK,CAAC,IAAI;QACT,OAAO,IAAI,mBAAO,CAAC,UAAU,CAAC;aAC5B,WAAW,CAAC,0BAA0B,CAAC;aACvC,SAAS,CAAC,kCAAkC,CAAC;aAC7C,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CAAC,eAAe,EAAE,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;aAC5D,MAAM,CAAC,WAAW,EAAE,gCAAgC,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;aACxE,MAAM,CACN,KAAK,EACJ,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,CAAC,EACD,MAA8C,EAC9C,OAAgB,EACf,EAAE;YACH,MAAM,OAAO,GAAY,EAAE,CAAC;YAC5B,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;YAC/D,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YAEnD,MAAM,MAAM,GAAY,EAAE,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3C,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3C,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAE3C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC5C,CAAC,CACD,CAAC;IACJ,CAAC;CACD;AAlCD,0CAkCC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import type { AbstractAction } from "../actions/abstract.action";
|
|
3
|
-
import { AbstractCommand } from "./abstract.command";
|
|
4
|
-
export declare class InstallCommand extends AbstractCommand {
|
|
5
|
-
private readonly action;
|
|
6
|
-
constructor(action: AbstractAction);
|
|
7
|
-
load(): Promise<Command>;
|
|
8
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InstallCommand = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const abstract_command_1 = require("./abstract.command");
|
|
6
|
-
class InstallCommand extends abstract_command_1.AbstractCommand {
|
|
7
|
-
constructor(action) {
|
|
8
|
-
super();
|
|
9
|
-
this.action = action;
|
|
10
|
-
}
|
|
11
|
-
async load() {
|
|
12
|
-
return new commander_1.Command("install")
|
|
13
|
-
.description("install nexus-ioc package")
|
|
14
|
-
.alias("i")
|
|
15
|
-
.action(async () => {
|
|
16
|
-
return this.action.handler();
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.InstallCommand = InstallCommand;
|
|
21
|
-
//# sourceMappingURL=install.command.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install.command.js","sourceRoot":"","sources":["../../src/commands/install.command.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AAEpC,yDAAqD;AAErD,MAAa,cAAe,SAAQ,kCAAe;IAClD,YAA6B,MAAsB;QAClD,KAAK,EAAE,CAAC;QADoB,WAAM,GAAN,MAAM,CAAgB;IAEnD,CAAC;IAED,KAAK,CAAC,IAAI;QACT,OAAO,IAAI,mBAAO,CAAC,SAAS,CAAC;aAC3B,WAAW,CAAC,2BAA2B,CAAC;aACxC,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CAAC,KAAK,IAAI,EAAE;YAClB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;CACD;AAbD,wCAaC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { AbstractAction } from "./actions/abstract.action";
|
|
2
|
-
import type { AbstractCommand } from "./commands/abstract.command";
|
|
3
|
-
type CommandMapper = {
|
|
4
|
-
command: string;
|
|
5
|
-
alias: string;
|
|
6
|
-
commander: new (action: AbstractAction) => AbstractCommand;
|
|
7
|
-
handler: new () => AbstractAction;
|
|
8
|
-
};
|
|
9
|
-
export declare class CommandsHelper {
|
|
10
|
-
private readonly mapper;
|
|
11
|
-
private readonly commands;
|
|
12
|
-
getAllCommands(): CommandMapper[];
|
|
13
|
-
getCommander(schematic: string): AbstractCommand | null;
|
|
14
|
-
}
|
|
15
|
-
export {};
|
package/dist/commands.helper.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CommandsHelper = void 0;
|
|
4
|
-
const generate_action_1 = require("./actions/generate.action");
|
|
5
|
-
const install_action_1 = require("./actions/install.action");
|
|
6
|
-
const generate_command_1 = require("./commands/generate.command");
|
|
7
|
-
const install_command_1 = require("./commands/install.command");
|
|
8
|
-
class CommandsHelper {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.mapper = [
|
|
11
|
-
{
|
|
12
|
-
command: "generate",
|
|
13
|
-
alias: "g",
|
|
14
|
-
commander: generate_command_1.GenerateCommand,
|
|
15
|
-
handler: generate_action_1.GenerateAction,
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
command: "install",
|
|
19
|
-
alias: "i",
|
|
20
|
-
commander: install_command_1.InstallCommand,
|
|
21
|
-
handler: install_action_1.InstallAction,
|
|
22
|
-
},
|
|
23
|
-
];
|
|
24
|
-
this.commands = new Map(this.mapper.reduce((prev, next) => {
|
|
25
|
-
prev.push([next.command, next]);
|
|
26
|
-
prev.push([next.alias, next]);
|
|
27
|
-
return prev;
|
|
28
|
-
}, []));
|
|
29
|
-
}
|
|
30
|
-
getAllCommands() {
|
|
31
|
-
return this.mapper;
|
|
32
|
-
}
|
|
33
|
-
getCommander(schematic) {
|
|
34
|
-
const commandMapper = this.commands.get(schematic);
|
|
35
|
-
if (!commandMapper) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
return new commandMapper.commander(new commandMapper.handler());
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.CommandsHelper = CommandsHelper;
|
|
42
|
-
//# sourceMappingURL=commands.helper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commands.helper.js","sourceRoot":"","sources":["../src/commands.helper.ts"],"names":[],"mappings":";;;AACA,+DAA2D;AAC3D,6DAAyD;AAEzD,kEAA8D;AAC9D,gEAA4D;AAS5D,MAAa,cAAc;IAA3B;QACkB,WAAM,GAAoB;YAC1C;gBACC,OAAO,EAAE,UAAU;gBACnB,KAAK,EAAE,GAAG;gBACV,SAAS,EAAE,kCAAe;gBAC1B,OAAO,EAAE,gCAAc;aACvB;YACD;gBACC,OAAO,EAAE,SAAS;gBAClB,KAAK,EAAE,GAAG;gBACV,SAAS,EAAE,gCAAc;gBACzB,OAAO,EAAE,8BAAa;aACtB;SACD,CAAC;QAEe,aAAQ,GAAG,IAAI,GAAG,CAClC,IAAI,CAAC,MAAM,CAAC,MAAM,CAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;YAC5D,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;YAChC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;YAE9B,OAAO,IAAI,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CACN,CAAC;IAeH,CAAC;IAbO,cAAc;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAEM,YAAY,CAAC,SAAiB;QACpC,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAEnD,IAAI,CAAC,aAAa,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC;QACb,CAAC;QAED,OAAO,IAAI,aAAa,CAAC,SAAS,CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;CACD;AAtCD,wCAsCC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const commander_1 = require("commander");
|
|
4
|
-
const commands_helper_1 = require("./commands.helper");
|
|
5
|
-
async function bootstrap() {
|
|
6
|
-
const commandsHelper = new commands_helper_1.CommandsHelper();
|
|
7
|
-
const program = new commander_1.Command();
|
|
8
|
-
for (const command of commandsHelper.getAllCommands()) {
|
|
9
|
-
const commander = commandsHelper.getCommander(command.command);
|
|
10
|
-
const commandInstance = await commander?.load();
|
|
11
|
-
if (commandInstance) {
|
|
12
|
-
program.addCommand(commandInstance);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
program.parse(process.argv);
|
|
16
|
-
}
|
|
17
|
-
bootstrap();
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,yCAAoC;AACpC,uDAAmD;AAEnD,KAAK,UAAU,SAAS;IACvB,MAAM,cAAc,GAAG,IAAI,gCAAc,EAAE,CAAC;IAC5C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;IAE9B,KAAK,MAAM,OAAO,IAAI,cAAc,CAAC,cAAc,EAAE,EAAE,CAAC;QACvD,MAAM,SAAS,GAAG,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC/D,MAAM,eAAe,GAAG,MAAM,SAAS,EAAE,IAAI,EAAE,CAAC;QAEhD,IAAI,eAAe,EAAE,CAAC;YACrB,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;QACrC,CAAC;IACF,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,EAAE,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare class ModuleTemplate {
|
|
2
|
-
private readonly params;
|
|
3
|
-
private readonly template?;
|
|
4
|
-
private readonly _imports;
|
|
5
|
-
private readonly _providers;
|
|
6
|
-
private readonly _exports;
|
|
7
|
-
constructor(params: {
|
|
8
|
-
name: string;
|
|
9
|
-
}, template?: string | undefined);
|
|
10
|
-
private get imports();
|
|
11
|
-
private get providers();
|
|
12
|
-
private get exports();
|
|
13
|
-
private parse;
|
|
14
|
-
addImport(importDep: string | string[]): void;
|
|
15
|
-
addProvider(provider: string | string[]): void;
|
|
16
|
-
addExport(exportDep: string | string[]): void;
|
|
17
|
-
generate(): string;
|
|
18
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ModuleTemplate = void 0;
|
|
4
|
-
const importsRegex = /imports:\s*\[\s*([\s\S]*?)\s*\],/;
|
|
5
|
-
const providersRegex = /providers:\s*\[\s*([\s\S]*?)\s*\],/;
|
|
6
|
-
const exportsRegex = /exports:\s*\[\s*([\s\S]*?)\s*\],/;
|
|
7
|
-
class ModuleTemplate {
|
|
8
|
-
constructor(params, template) {
|
|
9
|
-
this.params = params;
|
|
10
|
-
this.template = template;
|
|
11
|
-
this._imports = [];
|
|
12
|
-
this._providers = [];
|
|
13
|
-
this._exports = [];
|
|
14
|
-
if (template) {
|
|
15
|
-
this.parse(template);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
get imports() {
|
|
19
|
-
return this._imports.filter(Boolean).join(",");
|
|
20
|
-
}
|
|
21
|
-
get providers() {
|
|
22
|
-
return this._providers.filter(Boolean).join(",");
|
|
23
|
-
}
|
|
24
|
-
get exports() {
|
|
25
|
-
return this._exports.filter(Boolean).join(",");
|
|
26
|
-
}
|
|
27
|
-
parse(template) {
|
|
28
|
-
const [_, imports] = template.match(importsRegex) || [];
|
|
29
|
-
const [__, providers] = template.match(providersRegex) || [];
|
|
30
|
-
const [___, exports] = template.match(exportsRegex) || [];
|
|
31
|
-
this._imports.push(imports.endsWith(",") ? imports.slice(0, -1) : imports);
|
|
32
|
-
this._providers.push(providers.endsWith(",") ? providers.slice(0, -1) : providers);
|
|
33
|
-
this._exports.push(exports.endsWith(",") ? exports.slice(0, -1) : exports);
|
|
34
|
-
}
|
|
35
|
-
addImport(importDep) {
|
|
36
|
-
this._imports.push(...(Array.isArray(importDep) ? importDep : [importDep]));
|
|
37
|
-
}
|
|
38
|
-
addProvider(provider) {
|
|
39
|
-
this._providers.push(...(Array.isArray(provider) ? provider : [provider]));
|
|
40
|
-
}
|
|
41
|
-
addExport(exportDep) {
|
|
42
|
-
this._exports.push(...(Array.isArray(exportDep) ? exportDep : [exportDep]));
|
|
43
|
-
}
|
|
44
|
-
generate() {
|
|
45
|
-
return `
|
|
46
|
-
@NsModule({
|
|
47
|
-
imports: [${this.imports}],
|
|
48
|
-
providers: [${this.providers}],
|
|
49
|
-
exports: [${this.exports}],
|
|
50
|
-
})
|
|
51
|
-
export class ${this.params.name}Module {}
|
|
52
|
-
`;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.ModuleTemplate = ModuleTemplate;
|
|
56
|
-
//# sourceMappingURL=module.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.template.js","sourceRoot":"","sources":["../../src/templates/module.template.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAAG,kCAAkC,CAAC;AACxD,MAAM,cAAc,GAAG,oCAAoC,CAAC;AAC5D,MAAM,YAAY,GAAG,kCAAkC,CAAC;AAExD,MAAa,cAAc;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Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ServiceSpecTemplate = void 0;
|
|
4
|
-
class ServiceSpecTemplate {
|
|
5
|
-
constructor(params, template) {
|
|
6
|
-
this.params = params;
|
|
7
|
-
this.template = template;
|
|
8
|
-
}
|
|
9
|
-
parse() { }
|
|
10
|
-
generate() {
|
|
11
|
-
const serviceNameLC = this.params.name.toLowerCase();
|
|
12
|
-
const serviceName = `${this.params.name}Service`;
|
|
13
|
-
const variableServiceName = `${serviceNameLC}Service`;
|
|
14
|
-
return `
|
|
15
|
-
import { Test } from "nexus-ioc-testing";
|
|
16
|
-
import { ${serviceName} } from "./${serviceNameLC}.service";
|
|
17
|
-
|
|
18
|
-
describe('${serviceName}', () => {
|
|
19
|
-
it('should get service instance', async () => {
|
|
20
|
-
const moduleRef = await Test.createModule({
|
|
21
|
-
providers: [${serviceName}]
|
|
22
|
-
}).compile();
|
|
23
|
-
const ${variableServiceName} = await moduleRef.get<${serviceName}>(${serviceName});
|
|
24
|
-
|
|
25
|
-
expect(${variableServiceName}).toBeInstanceOf(${serviceName});
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
`;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.ServiceSpecTemplate = ServiceSpecTemplate;
|
|
32
|
-
//# sourceMappingURL=service-spec.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service-spec.template.js","sourceRoot":"","sources":["../../src/templates/service-spec.template.ts"],"names":[],"mappings":";;;AAAA,MAAa,mBAAmB;IAC/B,YACkB,MAAwB,EACxB,QAAiB;QADjB,WAAM,GAAN,MAAM,CAAkB;QACxB,aAAQ,GAAR,QAAQ,CAAS;IAChC,CAAC;IAEI,KAAK,KAAI,CAAC;IAEX,QAAQ;QACd,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QACrD,MAAM,WAAW,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC;QACjD,MAAM,mBAAmB,GAAG,GAAG,aAAa,SAAS,CAAC;QACtD,OAAO;;iBAEQ,WAAW,cAAc,aAAa;;kBAErC,WAAW;;;0BAGH,WAAW;;kBAEnB,mBAAmB,0BAA0B,WAAW,KAAK,WAAW;;mBAEvE,mBAAmB,oBAAoB,WAAW;;;KAGhE,CAAC;IACL,CAAC;CACD;AA5BD,kDA4BC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ServiceTemplate = void 0;
|
|
4
|
-
class ServiceTemplate {
|
|
5
|
-
constructor(params, template) {
|
|
6
|
-
this.params = params;
|
|
7
|
-
this.template = template;
|
|
8
|
-
}
|
|
9
|
-
parse() { }
|
|
10
|
-
generate() {
|
|
11
|
-
return `
|
|
12
|
-
import { Injectable } from "nexus-ioc";
|
|
13
|
-
|
|
14
|
-
@Injectable()
|
|
15
|
-
export class ${this.params.name}Service {}
|
|
16
|
-
`;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.ServiceTemplate = ServiceTemplate;
|
|
20
|
-
//# sourceMappingURL=service.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service.template.js","sourceRoot":"","sources":["../../src/templates/service.template.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;IAC3B,YACkB,MAAwB,EACxB,QAAiB;QADjB,WAAM,GAAN,MAAM,CAAkB;QACxB,aAAQ,GAAR,QAAQ,CAAS;IAChC,CAAC;IAEI,KAAK,KAAI,CAAC;IAEX,QAAQ;QACd,OAAO;;;;qBAIY,IAAI,CAAC,MAAM,CAAC,IAAI;KAChC,CAAC;IACL,CAAC;CACD;AAhBD,0CAgBC"}
|