@wallentaine/cqrs-schematics 0.0.1
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.
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"cqrs-command": {
|
|
5
|
+
"factory": "./schematics/cqrs-command",
|
|
6
|
+
"schema": "./schematics/cqrs-command/schema.json",
|
|
7
|
+
"description": "Generate CQRS Command files"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schematics/cqrs-command/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,IAAI,EAIJ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAuBtE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = commandSchematic;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const core_1 = require("@angular-devkit/core");
|
|
6
|
+
function commandSchematic(options) {
|
|
7
|
+
return (tree, context) => {
|
|
8
|
+
console.log(options);
|
|
9
|
+
const classifiedName = core_1.strings.classify(options.name);
|
|
10
|
+
const modulePath = options.module ? `/${options.module}` : "";
|
|
11
|
+
const targetPath = `${options.path}${modulePath}/Commands/${classifiedName}`;
|
|
12
|
+
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)("./files"), [
|
|
13
|
+
(0, schematics_1.applyTemplates)({
|
|
14
|
+
...core_1.strings,
|
|
15
|
+
...options,
|
|
16
|
+
name: classifiedName,
|
|
17
|
+
className: classifiedName,
|
|
18
|
+
}),
|
|
19
|
+
(0, schematics_1.move)(targetPath),
|
|
20
|
+
]);
|
|
21
|
+
const rules = [(0, schematics_1.mergeWith)(templateSource)];
|
|
22
|
+
return (0, schematics_1.chain)(rules)(tree, context);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "CqrsCommand",
|
|
4
|
+
"title": "CQRS Command Schematic",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the command",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-prompt": "What name would you like to use for the command?"
|
|
15
|
+
},
|
|
16
|
+
"module": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Module name",
|
|
19
|
+
"x-prompt": "What name would you like to use for the Module?"
|
|
20
|
+
},
|
|
21
|
+
"path": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "The path where to create the files",
|
|
24
|
+
"default": "src"
|
|
25
|
+
},
|
|
26
|
+
"prefix": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "Command prefix (Create, Update, Delete)",
|
|
29
|
+
"default": "Create",
|
|
30
|
+
"x-prompt": "What prefix would you like to use? (Create, Update, Delete)"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"required": ["name", "module"]
|
|
34
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wallentaine/cqrs-schematics",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"prepublishOnly": "npm run build"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/**/*"
|
|
12
|
+
],
|
|
13
|
+
"keywords": [
|
|
14
|
+
"nestjs",
|
|
15
|
+
"nestjs-cli",
|
|
16
|
+
"nest generate"
|
|
17
|
+
],
|
|
18
|
+
"author": "Wallentaine",
|
|
19
|
+
"license": "ISC",
|
|
20
|
+
"description": "CLI-схематика для утилиты nest generate",
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^25.0.8",
|
|
23
|
+
"typescript": "^5.9.3"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@angular-devkit/schematics": "^19.2.19"
|
|
27
|
+
}
|
|
28
|
+
}
|