@mbc-cqrs-serverless/cli 0.1.49-beta.0 → 0.1.51-beta.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/README.md +94 -63
- package/dist/actions/generate.action.js +44 -0
- package/dist/actions/new.action.get-package-version.spec.js +29 -0
- package/dist/actions/new.action.is-latest-version.spec.js +36 -0
- package/dist/actions/new.action.js +12 -6
- package/dist/actions/new.action.spec.js +84 -0
- package/dist/actions/new.action.update-env-local.spec.js +35 -0
- package/dist/actions/new.action.use-package-version.spec.js +46 -0
- package/dist/actions/ui.action.js +7 -5
- package/dist/commands/command.input.js +2 -0
- package/dist/commands/generate.command.js +24 -0
- package/dist/commands/index.js +2 -0
- package/dist/index.js +13 -2
- package/dist/runners/abstract.runner.js +44 -0
- package/dist/runners/schematic.runner.js +21 -0
- package/dist/schematics/collection.json +34 -0
- package/dist/schematics/index.js +17 -0
- package/dist/schematics/lib/controller/controller.factory.js +40 -0
- package/dist/schematics/lib/controller/controller.factory.spec.js +79 -0
- package/dist/schematics/lib/controller/files/__name@dasherize__.controller.ts +11 -0
- package/dist/schematics/lib/controller/schema.json +18 -0
- package/dist/schematics/lib/controller/units/__name@dasherize__.controller.__specFileSuffix__.ts +19 -0
- package/dist/schematics/lib/dto/dto.factory.js +32 -0
- package/dist/schematics/lib/dto/dto.factory.spec.js +128 -0
- package/dist/schematics/lib/dto/files/dto/__name@dasherize__-attributes.dto.ts +6 -0
- package/dist/schematics/lib/dto/files/dto/__name@dasherize__-command.dto.ts +16 -0
- package/dist/schematics/lib/dto/files/dto/__name@dasherize__-create.dto.ts +18 -0
- package/dist/schematics/lib/dto/files/dto/__name@dasherize__-search.dto.ts +2 -0
- package/dist/schematics/lib/dto/files/dto/__name@dasherize__-update.dto.ts +34 -0
- package/dist/schematics/lib/dto/schema.json +18 -0
- package/dist/schematics/lib/entity/entity.factory.js +30 -0
- package/dist/schematics/lib/entity/entity.factory.spec.js +86 -0
- package/dist/schematics/lib/entity/files/entity/__name@dasherize__-command.entity.ts +12 -0
- package/dist/schematics/lib/entity/files/entity/__name@dasherize__-data-list.entity.ts +12 -0
- package/dist/schematics/lib/entity/files/entity/__name@dasherize__-data.entity.ts +12 -0
- package/dist/schematics/lib/entity/schema.json +18 -0
- package/dist/schematics/lib/module/files/async/__name@dasherize__.controller.ts +74 -0
- package/dist/schematics/lib/module/files/async/__name@dasherize__.module.ts +19 -0
- package/dist/schematics/lib/module/files/async/__name@dasherize__.service.ts +164 -0
- package/dist/schematics/lib/module/files/async/dto/__name@dasherize__-attributes.dto.ts +6 -0
- package/dist/schematics/lib/module/files/async/dto/__name@dasherize__-command.dto.ts +16 -0
- package/dist/schematics/lib/module/files/async/dto/__name@dasherize__-create.dto.ts +18 -0
- package/dist/schematics/lib/module/files/async/dto/__name@dasherize__-search.dto.ts +2 -0
- package/dist/schematics/lib/module/files/async/dto/__name@dasherize__-update.dto.ts +34 -0
- package/dist/schematics/lib/module/files/async/entity/__name@dasherize__-command.entity.ts +12 -0
- package/dist/schematics/lib/module/files/async/entity/__name@dasherize__-data-list.entity.ts +12 -0
- package/dist/schematics/lib/module/files/async/entity/__name@dasherize__-data.entity.ts +12 -0
- package/dist/schematics/lib/module/files/async/handler/__name@dasherize__-rds.handler.ts +62 -0
- package/dist/schematics/lib/module/files/sync/__name@dasherize__.controller.ts +74 -0
- package/dist/schematics/lib/module/files/sync/__name@dasherize__.module.ts +19 -0
- package/dist/schematics/lib/module/files/sync/__name@dasherize__.service.ts +164 -0
- package/dist/schematics/lib/module/files/sync/dto/__name@dasherize__-attributes.dto.ts +6 -0
- package/dist/schematics/lib/module/files/sync/dto/__name@dasherize__-command.dto.ts +16 -0
- package/dist/schematics/lib/module/files/sync/dto/__name@dasherize__-create.dto.ts +18 -0
- package/dist/schematics/lib/module/files/sync/dto/__name@dasherize__-search.dto.ts +2 -0
- package/dist/schematics/lib/module/files/sync/dto/__name@dasherize__-update.dto.ts +34 -0
- package/dist/schematics/lib/module/files/sync/entity/__name@dasherize__-command.entity.ts +12 -0
- package/dist/schematics/lib/module/files/sync/entity/__name@dasherize__-data-list.entity.ts +12 -0
- package/dist/schematics/lib/module/files/sync/entity/__name@dasherize__-data.entity.ts +12 -0
- package/dist/schematics/lib/module/files/sync/handler/__name@dasherize__-rds.handler.ts +62 -0
- package/dist/schematics/lib/module/module.factory.js +204 -0
- package/dist/schematics/lib/module/module.factory.spec.js +188 -0
- package/dist/schematics/lib/module/schema.json +28 -0
- package/dist/schematics/lib/module/units/__name@dasherize__.controller.__specFileSuffix__.ts +19 -0
- package/dist/schematics/lib/module/units/__name@dasherize__.service.__specFileSuffix__.ts +19 -0
- package/dist/schematics/lib/service/files/__name@dasherize__.service.ts +12 -0
- package/dist/schematics/lib/service/schema.json +18 -0
- package/dist/schematics/lib/service/service.factory.js +40 -0
- package/dist/schematics/lib/service/service.factory.spec.js +81 -0
- package/dist/schematics/lib/service/units/__name@dasherize__.service.__specFileSuffix__.ts +19 -0
- package/dist/schematics/schematic.colection.js +60 -0
- package/dist/schematics/schematic.option.js +44 -0
- package/dist/schematics/utils/check-files-exist.js +13 -0
- package/dist/schematics/utils/index.js +17 -0
- package/dist/ui/index.js +18 -0
- package/dist/ui/logger.js +54 -0
- package/dist/ui/message.js +6 -0
- package/dist/utils/formatting.js +18 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/local-binaries.js +20 -0
- package/package.json +14 -5
- package/templates/.env.local +1 -1
- package/templates/README.md +1 -1
- package/templates/infra/README.md +6 -1
- package/templates/infra/libs/infra-stack.ts +1 -1
- package/templates/infra-local/docker-compose.yml +1 -1
- package/templates/infra-local/serverless.yml +19 -21
- package/templates/infra-local/swagger.json +396 -0
- package/templates/package.json +1 -0
- package/templates/prisma/dynamodbs/cqrs.json +1 -1
- package/templates/prisma/schema.prisma +4 -7
- package/templates/src/helpers/id.ts +12 -0
- package/templates/src/helpers/index.ts +1 -0
- package/templates/src/main.module.ts +2 -2
- package/templates/src/{master/dto/master-attributes.dto.ts → sample/dto/sample-attributes.dto.ts} +2 -2
- package/templates/src/{master/dto/master-command.dto.ts → sample/dto/sample-command.dto.ts} +4 -4
- package/templates/src/sample/entity/sample-command.entity.ts +13 -0
- package/templates/src/sample/entity/sample-data-list.entity.ts +13 -0
- package/templates/src/sample/entity/sample-data.entity.ts +13 -0
- package/templates/src/{master/handler/master-rds.handler.ts → sample/handler/sample-rds.handler.ts} +5 -7
- package/templates/src/{master/master.controller.ts → sample/sample.controller.ts} +22 -22
- package/templates/src/sample/sample.module.ts +19 -0
- package/templates/src/{master/master.service.ts → sample/sample.service.ts} +12 -12
- package/templates/test/api.http +25 -0
- package/templates/tsconfig.json +1 -1
- package/templates/src/master/entity/master-command.entity.ts +0 -13
- package/templates/src/master/entity/master-data-list.entity.ts +0 -13
- package/templates/src/master/entity/master-data.entity.ts +0 -13
- package/templates/src/master/master.module.ts +0 -19
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
describe('Entity Factory', () => {
|
|
39
|
+
const runner = new testing_1.SchematicTestRunner('.', path.join(__dirname, '../../collection.json'));
|
|
40
|
+
it('should generate full async template', async () => {
|
|
41
|
+
const options = {
|
|
42
|
+
name: 'foo',
|
|
43
|
+
mode: 'async',
|
|
44
|
+
schema: true,
|
|
45
|
+
};
|
|
46
|
+
const tree = await runner.runSchematic('module', options);
|
|
47
|
+
const files = tree.files;
|
|
48
|
+
// dto
|
|
49
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-attributes.dto.ts')).toBeDefined();
|
|
50
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-command.dto.ts')).toBeDefined();
|
|
51
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-create.dto.ts')).toBeDefined();
|
|
52
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-search.dto.ts')).toBeDefined();
|
|
53
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-update.dto.ts')).toBeDefined();
|
|
54
|
+
// entity
|
|
55
|
+
expect(files.find((filename) => filename === '/src/foo/entity/foo-command.entity.ts')).toBeDefined();
|
|
56
|
+
expect(files.find((filename) => filename === '/src/foo/entity/foo-data-list.entity.ts')).toBeDefined();
|
|
57
|
+
expect(files.find((filename) => filename === '/src/foo/entity/foo-data.entity.ts')).toBeDefined();
|
|
58
|
+
// controller
|
|
59
|
+
expect(files.find((filename) => filename === '/src/foo/foo.controller.ts')).toBeDefined();
|
|
60
|
+
expect(files.find((filename) => filename === '/test/unit/foo/foo.controller.spec.ts')).toBeDefined();
|
|
61
|
+
// service
|
|
62
|
+
expect(files.find((filename) => filename === '/src/foo/foo.service.ts')).toBeDefined();
|
|
63
|
+
expect(files.find((filename) => filename === '/test/unit/foo/foo.service.spec.ts')).toBeDefined();
|
|
64
|
+
// handler
|
|
65
|
+
expect(files.find((filename) => filename === '/src/foo/handler/foo-rds.handler.ts')).toBeDefined();
|
|
66
|
+
// module
|
|
67
|
+
expect(files.find((filename) => filename === '/src/foo/foo.module.ts')).toBeDefined();
|
|
68
|
+
// Verify content of foo.service.ts
|
|
69
|
+
const serviceContent = tree.readContent('/src/foo/foo.service.ts');
|
|
70
|
+
// Check occurrences of specific strings
|
|
71
|
+
const publishPartialUpdateAsyncMatches = (serviceContent.match(/publishPartialUpdateAsync/g) || []).length;
|
|
72
|
+
const publishAsyncMatches = (serviceContent.match(/publishAsync/g) || [])
|
|
73
|
+
.length;
|
|
74
|
+
expect(publishPartialUpdateAsyncMatches).toBe(2);
|
|
75
|
+
expect(publishAsyncMatches).toBe(1);
|
|
76
|
+
});
|
|
77
|
+
it('should generate async template with no schema', async () => {
|
|
78
|
+
const options = {
|
|
79
|
+
name: 'foo',
|
|
80
|
+
mode: 'async',
|
|
81
|
+
schema: false,
|
|
82
|
+
};
|
|
83
|
+
const tree = await runner.runSchematic('module', options);
|
|
84
|
+
const files = tree.files;
|
|
85
|
+
// dto
|
|
86
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-attributes.dto.ts')).toBeDefined();
|
|
87
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-command.dto.ts')).toBeDefined();
|
|
88
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-create.dto.ts')).toBeDefined();
|
|
89
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-search.dto.ts')).toBeDefined();
|
|
90
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-update.dto.ts')).toBeDefined();
|
|
91
|
+
// entity
|
|
92
|
+
expect(files.find((filename) => filename === '/src/foo/entity/foo-command.entity.ts')).toBeDefined();
|
|
93
|
+
expect(files.find((filename) => filename === '/src/foo/entity/foo-data-list.entity.ts')).toBeDefined();
|
|
94
|
+
expect(files.find((filename) => filename === '/src/foo/entity/foo-data.entity.ts')).toBeDefined();
|
|
95
|
+
// controller
|
|
96
|
+
expect(files.find((filename) => filename === '/src/foo/foo.controller.ts')).toBeDefined();
|
|
97
|
+
expect(files.find((filename) => filename === '/test/unit/foo/foo.controller.spec.ts')).toBeDefined();
|
|
98
|
+
// service
|
|
99
|
+
expect(files.find((filename) => filename === '/src/foo/foo.service.ts')).toBeDefined();
|
|
100
|
+
expect(files.find((filename) => filename === '/test/unit/foo/foo.service.spec.ts')).toBeDefined();
|
|
101
|
+
// handler
|
|
102
|
+
expect(files.find((filename) => filename === '/src/foo/handler/foo-rds.handler.ts')).not.toBeDefined();
|
|
103
|
+
// module
|
|
104
|
+
expect(files.find((filename) => filename === '/src/foo/foo.module.ts')).toBeDefined();
|
|
105
|
+
// Verify content of foo.service.ts
|
|
106
|
+
const serviceContent = tree.readContent('/src/foo/foo.service.ts');
|
|
107
|
+
// Check occurrences of specific strings
|
|
108
|
+
const publishPartialUpdateAsyncMatches = (serviceContent.match(/publishPartialUpdateAsync/g) || []).length;
|
|
109
|
+
const publishAsyncMatches = (serviceContent.match(/publishAsync/g) || [])
|
|
110
|
+
.length;
|
|
111
|
+
expect(publishPartialUpdateAsyncMatches).toBe(2);
|
|
112
|
+
expect(publishAsyncMatches).toBe(1);
|
|
113
|
+
});
|
|
114
|
+
it('should generate full sync template', async () => {
|
|
115
|
+
const options = {
|
|
116
|
+
name: 'foo',
|
|
117
|
+
mode: 'sync',
|
|
118
|
+
schema: true,
|
|
119
|
+
};
|
|
120
|
+
const tree = await runner.runSchematic('module', options);
|
|
121
|
+
const files = tree.files;
|
|
122
|
+
// dto
|
|
123
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-attributes.dto.ts')).toBeDefined();
|
|
124
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-command.dto.ts')).toBeDefined();
|
|
125
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-create.dto.ts')).toBeDefined();
|
|
126
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-search.dto.ts')).toBeDefined();
|
|
127
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-update.dto.ts')).toBeDefined();
|
|
128
|
+
// entity
|
|
129
|
+
expect(files.find((filename) => filename === '/src/foo/entity/foo-command.entity.ts')).toBeDefined();
|
|
130
|
+
expect(files.find((filename) => filename === '/src/foo/entity/foo-data-list.entity.ts')).toBeDefined();
|
|
131
|
+
expect(files.find((filename) => filename === '/src/foo/entity/foo-data.entity.ts')).toBeDefined();
|
|
132
|
+
// controller
|
|
133
|
+
expect(files.find((filename) => filename === '/src/foo/foo.controller.ts')).toBeDefined();
|
|
134
|
+
expect(files.find((filename) => filename === '/test/unit/foo/foo.controller.spec.ts')).toBeDefined();
|
|
135
|
+
// service
|
|
136
|
+
expect(files.find((filename) => filename === '/src/foo/foo.service.ts')).toBeDefined();
|
|
137
|
+
expect(files.find((filename) => filename === '/test/unit/foo/foo.service.spec.ts')).toBeDefined();
|
|
138
|
+
// handler
|
|
139
|
+
expect(files.find((filename) => filename === '/src/foo/handler/foo-rds.handler.ts')).toBeDefined();
|
|
140
|
+
// module
|
|
141
|
+
expect(files.find((filename) => filename === '/src/foo/foo.module.ts')).toBeDefined();
|
|
142
|
+
// Verify content of foo.service.ts
|
|
143
|
+
const serviceContent = tree.readContent('/src/foo/foo.service.ts');
|
|
144
|
+
// Check occurrences of specific strings
|
|
145
|
+
const publishPartialUpdateAsyncMatches = (serviceContent.match(/publishPartialUpdateSync/g) || []).length;
|
|
146
|
+
const publishAsyncMatches = (serviceContent.match(/publishSync/g) || [])
|
|
147
|
+
.length;
|
|
148
|
+
expect(publishPartialUpdateAsyncMatches).toBe(2);
|
|
149
|
+
expect(publishAsyncMatches).toBe(1);
|
|
150
|
+
});
|
|
151
|
+
it('should generate full sync template with no schema', async () => {
|
|
152
|
+
const options = {
|
|
153
|
+
name: 'foo',
|
|
154
|
+
mode: 'sync',
|
|
155
|
+
schema: false,
|
|
156
|
+
};
|
|
157
|
+
const tree = await runner.runSchematic('module', options);
|
|
158
|
+
const files = tree.files;
|
|
159
|
+
// dto
|
|
160
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-attributes.dto.ts')).toBeDefined();
|
|
161
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-command.dto.ts')).toBeDefined();
|
|
162
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-create.dto.ts')).toBeDefined();
|
|
163
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-search.dto.ts')).toBeDefined();
|
|
164
|
+
expect(files.find((filename) => filename === '/src/foo/dto/foo-update.dto.ts')).toBeDefined();
|
|
165
|
+
// entity
|
|
166
|
+
expect(files.find((filename) => filename === '/src/foo/entity/foo-command.entity.ts')).toBeDefined();
|
|
167
|
+
expect(files.find((filename) => filename === '/src/foo/entity/foo-data-list.entity.ts')).toBeDefined();
|
|
168
|
+
expect(files.find((filename) => filename === '/src/foo/entity/foo-data.entity.ts')).toBeDefined();
|
|
169
|
+
// controller
|
|
170
|
+
expect(files.find((filename) => filename === '/src/foo/foo.controller.ts')).toBeDefined();
|
|
171
|
+
expect(files.find((filename) => filename === '/test/unit/foo/foo.controller.spec.ts')).toBeDefined();
|
|
172
|
+
// service
|
|
173
|
+
expect(files.find((filename) => filename === '/src/foo/foo.service.ts')).toBeDefined();
|
|
174
|
+
expect(files.find((filename) => filename === '/test/unit/foo/foo.service.spec.ts')).toBeDefined();
|
|
175
|
+
// handler
|
|
176
|
+
expect(files.find((filename) => filename === '/src/foo/handler/foo-rds.handler.ts')).not.toBeDefined();
|
|
177
|
+
// module
|
|
178
|
+
expect(files.find((filename) => filename === '/src/foo/foo.module.ts')).toBeDefined();
|
|
179
|
+
// Verify content of foo.service.ts
|
|
180
|
+
const serviceContent = tree.readContent('/src/foo/foo.service.ts');
|
|
181
|
+
// Check occurrences of specific strings
|
|
182
|
+
const publishPartialUpdateAsyncMatches = (serviceContent.match(/publishPartialUpdateSync/g) || []).length;
|
|
183
|
+
const publishAsyncMatches = (serviceContent.match(/publishSync/g) || [])
|
|
184
|
+
.length;
|
|
185
|
+
expect(publishPartialUpdateAsyncMatches).toBe(2);
|
|
186
|
+
expect(publishAsyncMatches).toBe(1);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsMbcModule",
|
|
4
|
+
"title": "Mbc-cqrs-serverless Module Options Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the module.",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-prompt": "What name would you like to use for the module?"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"mode": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "Command processing mode (async,sync).",
|
|
20
|
+
"default": "async"
|
|
21
|
+
},
|
|
22
|
+
"schema": {
|
|
23
|
+
"type": "boolean",
|
|
24
|
+
"description": "Flag to indicate if prisma schema is created.",
|
|
25
|
+
"default": true
|
|
26
|
+
},
|
|
27
|
+
"required": ["name"]
|
|
28
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createMock } from '@golevelup/ts-jest'
|
|
2
|
+
import { Test, TestingModule } from '@nestjs/testing'
|
|
3
|
+
import { <%= classify(name) %>Controller } from 'src/<%= dasherize(name) %>/<%= dasherize(name) %>.controller'
|
|
4
|
+
|
|
5
|
+
describe('<%= classify(name) %>Controller', () => {
|
|
6
|
+
let controller: <%= classify(name) %>Controller
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
const module: TestingModule = await Test.createTestingModule({
|
|
10
|
+
controllers: [<%= classify(name) %>Controller],
|
|
11
|
+
}).useMocker(createMock).compile()
|
|
12
|
+
|
|
13
|
+
controller = module.get<<%= classify(name) %>Controller>(<%= classify(name) %>Controller)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('should be defined', () => {
|
|
17
|
+
expect(controller).toBeDefined()
|
|
18
|
+
})
|
|
19
|
+
})
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createMock } from '@golevelup/ts-jest'
|
|
2
|
+
import { Test, TestingModule } from '@nestjs/testing'
|
|
3
|
+
import { <%= classify(name) %>Service } from 'src/<%= dasherize(name) %>/<%= dasherize(name) %>.service'
|
|
4
|
+
|
|
5
|
+
describe('<%= classify(name) %>Service', () => {
|
|
6
|
+
let service: <%= classify(name) %>Service
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
const module: TestingModule = await Test.createTestingModule({
|
|
10
|
+
controllers: [<%= classify(name) %>Service],
|
|
11
|
+
}).useMocker(createMock).compile()
|
|
12
|
+
|
|
13
|
+
service = module.get<<%= classify(name) %>Service>(<%= classify(name) %>Service)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('should be defined', () => {
|
|
17
|
+
expect(service).toBeDefined()
|
|
18
|
+
})
|
|
19
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CommandService, DataService } from '@mbc-cqrs-serverless/core'
|
|
2
|
+
import { Injectable, Logger } from '@nestjs/common'
|
|
3
|
+
|
|
4
|
+
@Injectable()
|
|
5
|
+
export class <%= classify(name) %>Service {
|
|
6
|
+
private readonly logger = new Logger(<%= classify(name) %>Service.name)
|
|
7
|
+
|
|
8
|
+
constructor(
|
|
9
|
+
private readonly commandService: CommandService,
|
|
10
|
+
private readonly dataService: DataService,
|
|
11
|
+
) {}
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsMbcService",
|
|
4
|
+
"title": "Mbc-cqrs-serverless Service Options Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the service.",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-prompt": "What name would you like to use for the service?"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": ["name"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.main = main;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
function createService(options) {
|
|
7
|
+
return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
8
|
+
(0, schematics_1.template)({
|
|
9
|
+
...core_1.strings,
|
|
10
|
+
...options,
|
|
11
|
+
}),
|
|
12
|
+
(0, schematics_1.move)((0, core_1.normalize)(`/src/${core_1.strings.dasherize(options.name)}`)),
|
|
13
|
+
]));
|
|
14
|
+
}
|
|
15
|
+
function createUnitTest(options) {
|
|
16
|
+
return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./units'), [
|
|
17
|
+
(0, schematics_1.template)({
|
|
18
|
+
...core_1.strings,
|
|
19
|
+
...options,
|
|
20
|
+
specFileSuffix: 'spec',
|
|
21
|
+
}),
|
|
22
|
+
(0, schematics_1.move)((0, core_1.normalize)(`/test/unit/${core_1.strings.dasherize(options.name)}`)),
|
|
23
|
+
]));
|
|
24
|
+
}
|
|
25
|
+
function main(options) {
|
|
26
|
+
return (tree, _context) => {
|
|
27
|
+
const filePath = (0, core_1.normalize)(`/src/${core_1.strings.dasherize(options.name)}/${core_1.strings.dasherize(options.name)}.service.ts`);
|
|
28
|
+
const unitPath = (0, core_1.normalize)(`/test/unit/${core_1.strings.dasherize(options.name)}/${core_1.strings.dasherize(options.name)}.service.spec.ts`);
|
|
29
|
+
const isFileExists = tree.exists(filePath);
|
|
30
|
+
const isUnitExists = tree.exists(unitPath);
|
|
31
|
+
if (isFileExists || isUnitExists) {
|
|
32
|
+
if (isFileExists)
|
|
33
|
+
_context.logger.info(`Service file already exists at: ${filePath}`);
|
|
34
|
+
if (isUnitExists)
|
|
35
|
+
_context.logger.info(`Unit test file already exists at: ${unitPath}`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
return (0, schematics_1.chain)([createService(options), createUnitTest(options)]);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
describe('Service Factory', () => {
|
|
39
|
+
const runner = new testing_1.SchematicTestRunner('.', path.join(__dirname, '../../collection.json'));
|
|
40
|
+
it('should generate correct template', async () => {
|
|
41
|
+
const options = {
|
|
42
|
+
name: 'foo',
|
|
43
|
+
};
|
|
44
|
+
const tree = await runner.runSchematic('service', options);
|
|
45
|
+
const files = tree.files;
|
|
46
|
+
expect(files.find((filename) => filename === '/src/foo/foo.service.ts')).toBeDefined();
|
|
47
|
+
expect(files.find((filename) => filename === '/test/unit/foo/foo.service.spec.ts')).toBeDefined();
|
|
48
|
+
expect(tree.readContent('/src/foo/foo.service.ts')).toEqual("import { CommandService, DataService } from '@mbc-cqrs-serverless/core'\n" +
|
|
49
|
+
"import { Injectable, Logger } from '@nestjs/common'\n" +
|
|
50
|
+
'\n' +
|
|
51
|
+
'@Injectable()\n' +
|
|
52
|
+
'export class FooService {\n' +
|
|
53
|
+
' private readonly logger = new Logger(FooService.name)\n' +
|
|
54
|
+
'\n' +
|
|
55
|
+
' constructor(\n' +
|
|
56
|
+
' private readonly commandService: CommandService,\n' +
|
|
57
|
+
' private readonly dataService: DataService,\n' +
|
|
58
|
+
' ) {}\n' +
|
|
59
|
+
'}\n');
|
|
60
|
+
console.log(tree.readContent('/test/unit/foo/foo.service.spec.ts'));
|
|
61
|
+
expect(tree.readContent('/test/unit/foo/foo.service.spec.ts')).toEqual("import { createMock } from '@golevelup/ts-jest'\n" +
|
|
62
|
+
"import { Test, TestingModule } from '@nestjs/testing'\n" +
|
|
63
|
+
"import { FooService } from 'src/foo/foo.service'\n" +
|
|
64
|
+
'\n' +
|
|
65
|
+
"describe('FooService', () => {\n" +
|
|
66
|
+
' let service: FooService\n' +
|
|
67
|
+
'\n' +
|
|
68
|
+
' beforeEach(async () => {\n' +
|
|
69
|
+
' const module: TestingModule = await Test.createTestingModule({\n' +
|
|
70
|
+
' controllers: [FooService],\n' +
|
|
71
|
+
' }).useMocker(createMock).compile()\n' +
|
|
72
|
+
'\n' +
|
|
73
|
+
' service = module.get<FooService>(FooService)\n' +
|
|
74
|
+
' })\n' +
|
|
75
|
+
'\n' +
|
|
76
|
+
" it('should be defined', () => {\n" +
|
|
77
|
+
' expect(service).toBeDefined()\n' +
|
|
78
|
+
' })\n' +
|
|
79
|
+
'})\n');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createMock } from '@golevelup/ts-jest'
|
|
2
|
+
import { Test, TestingModule } from '@nestjs/testing'
|
|
3
|
+
import { <%= classify(name) %>Service } from 'src/<%= dasherize(name) %>/<%= dasherize(name) %>.service'
|
|
4
|
+
|
|
5
|
+
describe('<%= classify(name) %>Service', () => {
|
|
6
|
+
let service: <%= classify(name) %>Service
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
const module: TestingModule = await Test.createTestingModule({
|
|
10
|
+
controllers: [<%= classify(name) %>Service],
|
|
11
|
+
}).useMocker(createMock).compile()
|
|
12
|
+
|
|
13
|
+
service = module.get<<%= classify(name) %>Service>(<%= classify(name) %>Service)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('should be defined', () => {
|
|
17
|
+
expect(service).toBeDefined()
|
|
18
|
+
})
|
|
19
|
+
})
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.schematics = void 0;
|
|
7
|
+
exports.buildSchematicsListAsTable = buildSchematicsListAsTable;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
10
|
+
exports.schematics = [
|
|
11
|
+
{
|
|
12
|
+
name: 'module',
|
|
13
|
+
alias: 'mo',
|
|
14
|
+
description: 'Create a module.',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'controller',
|
|
18
|
+
alias: 'co',
|
|
19
|
+
description: 'Create a controller.',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'service',
|
|
23
|
+
alias: 'se',
|
|
24
|
+
description: 'Create a service.',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'entity',
|
|
28
|
+
alias: 'en',
|
|
29
|
+
description: 'Create a entity.',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'dto',
|
|
33
|
+
alias: 'dto',
|
|
34
|
+
description: 'Create a dto.',
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
function buildSchematicsListAsTable() {
|
|
38
|
+
const leftMargin = ' ';
|
|
39
|
+
const tableConfig = {
|
|
40
|
+
head: ['name', 'alias', 'description'],
|
|
41
|
+
chars: {
|
|
42
|
+
left: leftMargin.concat('│'),
|
|
43
|
+
'top-left': leftMargin.concat('┌'),
|
|
44
|
+
'bottom-left': leftMargin.concat('└'),
|
|
45
|
+
mid: '',
|
|
46
|
+
'left-mid': '',
|
|
47
|
+
'mid-mid': '',
|
|
48
|
+
'right-mid': '',
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
const table = new cli_table3_1.default(tableConfig);
|
|
52
|
+
for (const schematic of exports.schematics) {
|
|
53
|
+
table.push([
|
|
54
|
+
chalk_1.default.green(schematic.name),
|
|
55
|
+
chalk_1.default.cyan(schematic.alias),
|
|
56
|
+
schematic.description,
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
return table.toString();
|
|
60
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SchematicOption = void 0;
|
|
4
|
+
const formatting_1 = require("../utils/formatting");
|
|
5
|
+
class SchematicOption {
|
|
6
|
+
constructor(name, value) {
|
|
7
|
+
this.name = name;
|
|
8
|
+
this.value = value;
|
|
9
|
+
}
|
|
10
|
+
get normalizedName() {
|
|
11
|
+
return (0, formatting_1.normalizeToKebabOrSnakeCase)(this.name);
|
|
12
|
+
}
|
|
13
|
+
toCommandString() {
|
|
14
|
+
if (typeof this.value === 'string') {
|
|
15
|
+
if (this.name === 'name') {
|
|
16
|
+
return `--${this.normalizedName}=${this.format()}`;
|
|
17
|
+
}
|
|
18
|
+
else if (this.name === 'version' || this.name === 'path') {
|
|
19
|
+
return `--${this.normalizedName}=${this.value}`;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return `--${this.normalizedName}="${this.value}"`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else if (typeof this.value === 'boolean') {
|
|
26
|
+
const str = this.normalizedName;
|
|
27
|
+
return this.value ? `--${str}` : `--no-${str}`;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return `--${this.normalizedName}=${this.value}`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
format() {
|
|
34
|
+
return (0, formatting_1.normalizeToKebabOrSnakeCase)(this.value)
|
|
35
|
+
.split('')
|
|
36
|
+
.reduce((content, char) => {
|
|
37
|
+
if (char === '(' || char === ')' || char === '[' || char === ']') {
|
|
38
|
+
return `${content}\\${char}`;
|
|
39
|
+
}
|
|
40
|
+
return `${content}${char}`;
|
|
41
|
+
}, '');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.SchematicOption = SchematicOption;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkFilesExist = checkFilesExist;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
function checkFilesExist(tree, paths) {
|
|
6
|
+
for (const path of paths) {
|
|
7
|
+
const filePath = (0, core_1.normalize)(path);
|
|
8
|
+
if (tree.exists(filePath)) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./check-files-exist"), exports);
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./logger"), exports);
|
|
18
|
+
__exportStar(require("./message"), exports);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.logger = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const MAX_PREFIX_LENGTH = 8;
|
|
9
|
+
const badge = (text, bgColor, textColor = chalk_1.default.black) => {
|
|
10
|
+
const wrappedText = ` ${text} `;
|
|
11
|
+
const repeat = Math.max(0, MAX_PREFIX_LENGTH - wrappedText.length);
|
|
12
|
+
return ' '.repeat(repeat) + bgColor(textColor(wrappedText));
|
|
13
|
+
};
|
|
14
|
+
const textIndent = (text, indentFirst = true, indent = MAX_PREFIX_LENGTH + 2) => {
|
|
15
|
+
const parts = Array.isArray(text) ? text : [text];
|
|
16
|
+
return parts
|
|
17
|
+
.map((part, i) => {
|
|
18
|
+
if (i === 0 && !indentFirst) {
|
|
19
|
+
return part;
|
|
20
|
+
}
|
|
21
|
+
return ' '.repeat(indent) + part;
|
|
22
|
+
})
|
|
23
|
+
.join('\n');
|
|
24
|
+
};
|
|
25
|
+
exports.logger = {
|
|
26
|
+
log(message) {
|
|
27
|
+
console.log(textIndent(message));
|
|
28
|
+
},
|
|
29
|
+
title(title, message) {
|
|
30
|
+
const prefix = badge(title, chalk_1.default.bgBlueBright);
|
|
31
|
+
console.log(`\n${prefix} ${message}`);
|
|
32
|
+
},
|
|
33
|
+
info(message) {
|
|
34
|
+
console.log(`${' '.repeat(7)}${chalk_1.default.cyan('●')} ${message}`);
|
|
35
|
+
},
|
|
36
|
+
success(message) {
|
|
37
|
+
console.log(`\n${' '.repeat(7)}${chalk_1.default.green('✓')} ${chalk_1.default.green(message)}`);
|
|
38
|
+
},
|
|
39
|
+
fatal(message) {
|
|
40
|
+
const prefix = badge('Error', chalk_1.default.bgRed);
|
|
41
|
+
if (message) {
|
|
42
|
+
console.error(`\n${prefix} ${textIndent(message, false)}\n`);
|
|
43
|
+
}
|
|
44
|
+
process.exit(1);
|
|
45
|
+
},
|
|
46
|
+
error(message) {
|
|
47
|
+
const prefix = badge('Error', chalk_1.default.bgRed);
|
|
48
|
+
console.error(`\n${prefix} ${textIndent(message, false)}\n`);
|
|
49
|
+
},
|
|
50
|
+
warn(message) {
|
|
51
|
+
const prefix = badge('Warn', chalk_1.default.bgYellow);
|
|
52
|
+
console.warn(`\n${prefix} ${textIndent(message, false)}\n`);
|
|
53
|
+
},
|
|
54
|
+
};
|