@gapi/schematics 1.8.169 → 1.8.170
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/dist/lib/application/application.factory.js +5 -6
- package/dist/lib/application/application.factory.test.ts +5 -1
- package/dist/lib/application/application.factory.ts +1 -0
- package/dist/lib/application/files/ts/src/app.controller.spec.ts +1 -0
- package/dist/lib/application/files/ts/src/app.controller.ts +1 -0
- package/dist/lib/application/files/ts/src/app.module.ts +1 -0
- package/dist/lib/application/files/ts/src/main.ts +1 -0
- package/dist/lib/application/files/ts/test/app.e2e-spec.ts +1 -0
- package/dist/lib/class/class.factory.js +7 -8
- package/dist/lib/class/class.factory.test.ts +9 -6
- package/dist/lib/class/class.factory.ts +2 -1
- package/dist/lib/client-app/angular/angular.factory.js +12 -13
- package/dist/lib/client-app/angular/angular.factory.ts +5 -4
- package/dist/lib/client-app/angular/files/angular.module.ts +1 -0
- package/dist/lib/client-app/angular/files/angular.providers.ts +1 -0
- package/dist/lib/client-app/angular/files/loaders/abstract.loader.ts +1 -0
- package/dist/lib/client-app/angular/files/loaders/express.loader.ts +1 -0
- package/dist/lib/client-app/angular/files/loaders/fastify.loader.ts +1 -0
- package/dist/lib/client-app/angular/files/loaders/noop.loader.ts +1 -0
- package/dist/lib/component/component.factory.js +9 -10
- package/dist/lib/component/component.factory.test.ts +13 -12
- package/dist/lib/component/component.factory.ts +2 -1
- package/dist/lib/configuration/configuration.factory.js +5 -6
- package/dist/lib/configuration/configuration.factory.test.ts +4 -3
- package/dist/lib/configuration/configuration.factory.ts +1 -0
- package/dist/lib/controller/controller.factory.js +9 -10
- package/dist/lib/controller/controller.factory.test.ts +13 -12
- package/dist/lib/controller/controller.factory.ts +2 -1
- package/dist/lib/decorator/decorator.factory.js +6 -7
- package/dist/lib/decorator/decorator.factory.test.ts +7 -6
- package/dist/lib/decorator/decorator.factory.ts +1 -0
- package/dist/lib/effect/effect.factory.js +10 -12
- package/dist/lib/effect/effect.factory.test.ts +12 -11
- package/dist/lib/effect/effect.factory.ts +3 -3
- package/dist/lib/filter/filter.factory.js +7 -8
- package/dist/lib/filter/filter.factory.test.ts +12 -7
- package/dist/lib/filter/filter.factory.ts +2 -1
- package/dist/lib/gateway/gateway.factory.js +9 -10
- package/dist/lib/gateway/gateway.factory.test.ts +7 -6
- package/dist/lib/gateway/gateway.factory.ts +2 -1
- package/dist/lib/guard/guard.factory.js +7 -8
- package/dist/lib/guard/guard.factory.test.ts +7 -6
- package/dist/lib/guard/guard.factory.ts +2 -1
- package/dist/lib/interceptor/interceptor.factory.js +7 -8
- package/dist/lib/interceptor/interceptor.factory.test.ts +7 -6
- package/dist/lib/interceptor/interceptor.factory.ts +2 -1
- package/dist/lib/interface/interface.factory.js +6 -7
- package/dist/lib/interface/interface.factory.test.ts +6 -5
- package/dist/lib/interface/interface.factory.ts +1 -0
- package/dist/lib/library/library.factory.js +13 -14
- package/dist/lib/library/library.factory.test.ts +1 -0
- package/dist/lib/library/library.factory.ts +2 -1
- package/dist/lib/module/module.factory.js +8 -9
- package/dist/lib/module/module.factory.test.ts +7 -6
- package/dist/lib/module/module.factory.ts +1 -0
- package/dist/lib/pipe/pipe.factory.js +7 -8
- package/dist/lib/pipe/pipe.factory.test.ts +7 -6
- package/dist/lib/pipe/pipe.factory.ts +2 -1
- package/dist/lib/plugin/plugin.factory.d.ts +1 -0
- package/dist/lib/plugin/plugin.factory.test.ts +13 -12
- package/dist/lib/plugin/plugin.factory.ts +2 -1
- package/dist/lib/provider/provider.factory.d.ts +1 -0
- package/dist/lib/provider/provider.factory.test.ts +11 -10
- package/dist/lib/provider/provider.factory.ts +2 -1
- package/dist/lib/resolver/resolver.factory.js +9 -10
- package/dist/lib/resolver/resolver.factory.test.ts +13 -12
- package/dist/lib/resolver/resolver.factory.ts +2 -1
- package/dist/lib/service/service.factory.js +10 -12
- package/dist/lib/service/service.factory.test.ts +12 -11
- package/dist/lib/service/service.factory.ts +3 -3
- package/dist/lib/type/type.factory.d.ts +1 -0
- package/dist/lib/type/type.factory.test.ts +13 -12
- package/dist/lib/type/type.factory.ts +2 -1
- package/dist/utils/metadata.manager.js +9 -9
- package/dist/utils/metadata.manager.ts +13 -10
- package/dist/utils/module-import.declarator.js +4 -4
- package/dist/utils/module-import.declarator.ts +3 -2
- package/dist/utils/module.declarator.js +2 -2
- package/dist/utils/module.declarator.ts +2 -0
- package/dist/utils/module.finder.js +2 -2
- package/dist/utils/module.finder.ts +1 -1
- package/dist/utils/name.parser.js +3 -5
- package/dist/utils/name.parser.ts +5 -6
- package/dist/utils/path.solver.js +2 -4
- package/dist/utils/path.solver.ts +2 -3
- package/dist/utils/source-root.helpers.js +6 -6
- package/dist/utils/source-root.helpers.ts +4 -2
- package/eslint.config.mjs +38 -0
- package/package.json +2 -2
- package/src/lib/application/application.factory.test.ts +5 -1
- package/src/lib/application/application.factory.ts +1 -0
- package/src/lib/application/files/ts/src/app.controller.spec.ts +1 -0
- package/src/lib/application/files/ts/src/app.controller.ts +1 -0
- package/src/lib/application/files/ts/src/app.module.ts +1 -0
- package/src/lib/application/files/ts/src/main.ts +1 -0
- package/src/lib/application/files/ts/test/app.e2e-spec.ts +1 -0
- package/src/lib/class/class.factory.test.ts +9 -6
- package/src/lib/class/class.factory.ts +2 -1
- package/src/lib/client-app/angular/angular.factory.ts +5 -4
- package/src/lib/client-app/angular/files/angular.module.ts +1 -0
- package/src/lib/client-app/angular/files/angular.providers.ts +1 -0
- package/src/lib/client-app/angular/files/loaders/abstract.loader.ts +1 -0
- package/src/lib/client-app/angular/files/loaders/express.loader.ts +1 -0
- package/src/lib/client-app/angular/files/loaders/fastify.loader.ts +1 -0
- package/src/lib/client-app/angular/files/loaders/noop.loader.ts +1 -0
- package/src/lib/component/component.factory.test.ts +13 -12
- package/src/lib/component/component.factory.ts +2 -1
- package/src/lib/configuration/configuration.factory.test.ts +4 -3
- package/src/lib/configuration/configuration.factory.ts +1 -0
- package/src/lib/controller/controller.factory.test.ts +13 -12
- package/src/lib/controller/controller.factory.ts +2 -1
- package/src/lib/decorator/decorator.factory.test.ts +7 -6
- package/src/lib/decorator/decorator.factory.ts +1 -0
- package/src/lib/effect/effect.factory.test.ts +12 -11
- package/src/lib/effect/effect.factory.ts +3 -3
- package/src/lib/filter/filter.factory.test.ts +12 -7
- package/src/lib/filter/filter.factory.ts +2 -1
- package/src/lib/gateway/gateway.factory.test.ts +7 -6
- package/src/lib/gateway/gateway.factory.ts +2 -1
- package/src/lib/guard/guard.factory.test.ts +7 -6
- package/src/lib/guard/guard.factory.ts +2 -1
- package/src/lib/interceptor/interceptor.factory.test.ts +7 -6
- package/src/lib/interceptor/interceptor.factory.ts +2 -1
- package/src/lib/interface/interface.factory.test.ts +6 -5
- package/src/lib/interface/interface.factory.ts +1 -0
- package/src/lib/library/library.factory.test.ts +1 -0
- package/src/lib/library/library.factory.ts +2 -1
- package/src/lib/module/module.factory.test.ts +7 -6
- package/src/lib/module/module.factory.ts +1 -0
- package/src/lib/pipe/pipe.factory.test.ts +7 -6
- package/src/lib/pipe/pipe.factory.ts +2 -1
- package/src/lib/plugin/plugin.factory.d.ts +1 -0
- package/src/lib/plugin/plugin.factory.test.ts +13 -12
- package/src/lib/plugin/plugin.factory.ts +2 -1
- package/src/lib/provider/provider.factory.d.ts +1 -0
- package/src/lib/provider/provider.factory.test.ts +11 -10
- package/src/lib/provider/provider.factory.ts +2 -1
- package/src/lib/resolver/resolver.factory.test.ts +13 -12
- package/src/lib/resolver/resolver.factory.ts +2 -1
- package/src/lib/service/service.factory.test.ts +12 -11
- package/src/lib/service/service.factory.ts +3 -3
- package/src/lib/type/type.factory.d.ts +1 -0
- package/src/lib/type/type.factory.test.ts +13 -12
- package/src/lib/type/type.factory.ts +2 -1
- package/src/utils/metadata.manager.ts +13 -10
- package/src/utils/module-import.declarator.ts +3 -2
- package/src/utils/module.declarator.ts +2 -0
- package/src/utils/module.finder.ts +1 -1
- package/src/utils/name.parser.ts +5 -6
- package/src/utils/path.solver.ts +2 -3
- package/src/utils/source-root.helpers.ts +4 -2
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
UnitTestTree,
|
|
5
5
|
} from '@angular-devkit/schematics/testing';
|
|
6
6
|
import * as path from 'path';
|
|
7
|
+
|
|
7
8
|
import { ApplicationOptions } from '../application/application.schema';
|
|
8
9
|
import { ModuleOptions } from '../module/module.schema';
|
|
9
10
|
import { ControllerOptions } from './controller.schema';
|
|
@@ -24,10 +25,10 @@ describe('Controller Factory', () => {
|
|
|
24
25
|
const files: string[] = tree.files;
|
|
25
26
|
|
|
26
27
|
expect(
|
|
27
|
-
files.find(filename => filename === '/foo/foo.controller.ts'),
|
|
28
|
+
files.find((filename) => filename === '/foo/foo.controller.ts'),
|
|
28
29
|
).toBeDefined();
|
|
29
30
|
expect(
|
|
30
|
-
files.find(filename => filename === '/foo/foo.controller.spec.ts'),
|
|
31
|
+
files.find((filename) => filename === '/foo/foo.controller.spec.ts'),
|
|
31
32
|
).not.toBeDefined();
|
|
32
33
|
expect(tree.readContent('/foo/foo.controller.ts')).toEqual(
|
|
33
34
|
"import { Controller } from '@nestjs/common';\n" +
|
|
@@ -44,10 +45,10 @@ describe('Controller Factory', () => {
|
|
|
44
45
|
const tree: UnitTestTree = runner.runSchematic('controller', options);
|
|
45
46
|
const files: string[] = tree.files;
|
|
46
47
|
expect(
|
|
47
|
-
files.find(filename => filename === '/bar/foo/foo.controller.ts'),
|
|
48
|
+
files.find((filename) => filename === '/bar/foo/foo.controller.ts'),
|
|
48
49
|
).toBeDefined();
|
|
49
50
|
expect(
|
|
50
|
-
files.find(filename => filename === '/bar/foo/foo.controller.spec.ts'),
|
|
51
|
+
files.find((filename) => filename === '/bar/foo/foo.controller.spec.ts'),
|
|
51
52
|
).toBeDefined();
|
|
52
53
|
expect(tree.readContent('/bar/foo/foo.controller.ts')).toEqual(
|
|
53
54
|
"import { Controller } from '@nestjs/common';\n" +
|
|
@@ -65,10 +66,10 @@ describe('Controller Factory', () => {
|
|
|
65
66
|
const tree: UnitTestTree = runner.runSchematic('controller', options);
|
|
66
67
|
const files: string[] = tree.files;
|
|
67
68
|
expect(
|
|
68
|
-
files.find(filename => filename === '/bar/foo/foo.controller.ts'),
|
|
69
|
+
files.find((filename) => filename === '/bar/foo/foo.controller.ts'),
|
|
69
70
|
).toBeDefined();
|
|
70
71
|
expect(
|
|
71
|
-
files.find(filename => filename === '/bar/foo/foo.controller.spec.ts'),
|
|
72
|
+
files.find((filename) => filename === '/bar/foo/foo.controller.spec.ts'),
|
|
72
73
|
).toBeDefined();
|
|
73
74
|
expect(tree.readContent('/bar/foo/foo.controller.ts')).toEqual(
|
|
74
75
|
"import { Controller } from '@nestjs/common';\n" +
|
|
@@ -85,11 +86,11 @@ describe('Controller Factory', () => {
|
|
|
85
86
|
const tree: UnitTestTree = runner.runSchematic('controller', options);
|
|
86
87
|
const files: string[] = tree.files;
|
|
87
88
|
expect(
|
|
88
|
-
files.find(filename => filename === '/foo-bar/foo-bar.controller.ts'),
|
|
89
|
+
files.find((filename) => filename === '/foo-bar/foo-bar.controller.ts'),
|
|
89
90
|
).toBeDefined();
|
|
90
91
|
expect(
|
|
91
92
|
files.find(
|
|
92
|
-
filename => filename === '/foo-bar/foo-bar.controller.spec.ts',
|
|
93
|
+
(filename) => filename === '/foo-bar/foo-bar.controller.spec.ts',
|
|
93
94
|
),
|
|
94
95
|
).toBeDefined();
|
|
95
96
|
expect(tree.readContent('/foo-bar/foo-bar.controller.ts')).toEqual(
|
|
@@ -107,11 +108,11 @@ describe('Controller Factory', () => {
|
|
|
107
108
|
const tree: UnitTestTree = runner.runSchematic('controller', options);
|
|
108
109
|
const files: string[] = tree.files;
|
|
109
110
|
expect(
|
|
110
|
-
files.find(filename => filename === '/bar-baz/foo/foo.controller.ts'),
|
|
111
|
+
files.find((filename) => filename === '/bar-baz/foo/foo.controller.ts'),
|
|
111
112
|
).toBeDefined();
|
|
112
113
|
expect(
|
|
113
114
|
files.find(
|
|
114
|
-
filename => filename === '/bar-baz/foo/foo.controller.spec.ts',
|
|
115
|
+
(filename) => filename === '/bar-baz/foo/foo.controller.spec.ts',
|
|
115
116
|
),
|
|
116
117
|
).toBeDefined();
|
|
117
118
|
expect(tree.readContent('/bar-baz/foo/foo.controller.ts')).toEqual(
|
|
@@ -130,10 +131,10 @@ describe('Controller Factory', () => {
|
|
|
130
131
|
const tree: UnitTestTree = runner.runSchematic('controller', options);
|
|
131
132
|
const files: string[] = tree.files;
|
|
132
133
|
expect(
|
|
133
|
-
files.find(filename => filename === '/foo/foo.controller.js'),
|
|
134
|
+
files.find((filename) => filename === '/foo/foo.controller.js'),
|
|
134
135
|
).toBeDefined();
|
|
135
136
|
expect(
|
|
136
|
-
files.find(filename => filename === '/foo/foo.controller.spec.js'),
|
|
137
|
+
files.find((filename) => filename === '/foo/foo.controller.spec.js'),
|
|
137
138
|
).toBeDefined();
|
|
138
139
|
expect(tree.readContent('/foo/foo.controller.js')).toEqual(
|
|
139
140
|
"import { Controller } from '@nestjs/common';\n" +
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
Tree,
|
|
14
14
|
url,
|
|
15
15
|
} from '@angular-devkit/schematics';
|
|
16
|
+
|
|
16
17
|
import {
|
|
17
18
|
DeclarationOptions,
|
|
18
19
|
ModuleDeclarator,
|
|
@@ -59,7 +60,7 @@ function transform(source: ControllerOptions): ControllerOptions {
|
|
|
59
60
|
function generate(options: ControllerOptions) {
|
|
60
61
|
return (context: SchematicContext) =>
|
|
61
62
|
apply(url(join('./files' as Path, options.language)), [
|
|
62
|
-
options.spec ? noop() : filter(path => !path.endsWith('.spec.ts')),
|
|
63
|
+
options.spec ? noop() : filter((path) => !path.endsWith('.spec.ts')),
|
|
63
64
|
template({
|
|
64
65
|
...strings,
|
|
65
66
|
...options,
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.main =
|
|
3
|
+
exports.main = main;
|
|
4
4
|
const core_1 = require("@angular-devkit/core");
|
|
5
5
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
6
|
const name_parser_1 = require("../../utils/name.parser");
|
|
7
7
|
const source_root_helpers_1 = require("../../utils/source-root.helpers");
|
|
8
8
|
function main(options) {
|
|
9
9
|
options = transform(options);
|
|
10
|
-
return schematics_1.chain([source_root_helpers_1.mergeSourceRoot(options), schematics_1.mergeWith(generate(options))]);
|
|
10
|
+
return (0, schematics_1.chain)([(0, source_root_helpers_1.mergeSourceRoot)(options), (0, schematics_1.mergeWith)(generate(options))]);
|
|
11
11
|
}
|
|
12
|
-
exports.main = main;
|
|
13
12
|
function transform(options) {
|
|
14
13
|
const target = Object.assign({}, options);
|
|
15
14
|
if (!target.name) {
|
|
@@ -21,12 +20,12 @@ function transform(options) {
|
|
|
21
20
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
22
21
|
target.path = target.flat
|
|
23
22
|
? target.path
|
|
24
|
-
: core_1.join(target.path, target.name);
|
|
23
|
+
: (0, core_1.join)(target.path, target.name);
|
|
25
24
|
return target;
|
|
26
25
|
}
|
|
27
26
|
function generate(options) {
|
|
28
|
-
return (context) => schematics_1.apply(schematics_1.url(core_1.join('./files', options.language)), [
|
|
29
|
-
schematics_1.template(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
30
|
-
schematics_1.move(options.path),
|
|
27
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
28
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
29
|
+
(0, schematics_1.move)(options.path),
|
|
31
30
|
])(context);
|
|
32
31
|
}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
UnitTestTree,
|
|
4
4
|
} from '@angular-devkit/schematics/testing';
|
|
5
5
|
import * as path from 'path';
|
|
6
|
+
|
|
6
7
|
import { DecoratorOptions } from './decorator.schema';
|
|
7
8
|
|
|
8
9
|
describe('Decorator Factory', () => {
|
|
@@ -18,7 +19,7 @@ describe('Decorator Factory', () => {
|
|
|
18
19
|
const tree: UnitTestTree = runner.runSchematic('decorator', options);
|
|
19
20
|
const files: string[] = tree.files;
|
|
20
21
|
expect(
|
|
21
|
-
files.find(filename => filename === '/foo/foo.decorator.ts'),
|
|
22
|
+
files.find((filename) => filename === '/foo/foo.decorator.ts'),
|
|
22
23
|
).not.toBeUndefined();
|
|
23
24
|
expect(tree.readContent('/foo/foo.decorator.ts')).toEqual(
|
|
24
25
|
"import { ReflectMetadata } from '@nestjs/common';\n" +
|
|
@@ -34,7 +35,7 @@ describe('Decorator Factory', () => {
|
|
|
34
35
|
const tree: UnitTestTree = runner.runSchematic('decorator', options);
|
|
35
36
|
const files: string[] = tree.files;
|
|
36
37
|
expect(
|
|
37
|
-
files.find(filename => filename === '/bar/foo/foo.decorator.ts'),
|
|
38
|
+
files.find((filename) => filename === '/bar/foo/foo.decorator.ts'),
|
|
38
39
|
).not.toBeUndefined();
|
|
39
40
|
expect(tree.readContent('/bar/foo/foo.decorator.ts')).toEqual(
|
|
40
41
|
"import { ReflectMetadata } from '@nestjs/common';\n" +
|
|
@@ -51,7 +52,7 @@ describe('Decorator Factory', () => {
|
|
|
51
52
|
const tree: UnitTestTree = runner.runSchematic('decorator', options);
|
|
52
53
|
const files: string[] = tree.files;
|
|
53
54
|
expect(
|
|
54
|
-
files.find(filename => filename === '/baz/foo/foo.decorator.ts'),
|
|
55
|
+
files.find((filename) => filename === '/baz/foo/foo.decorator.ts'),
|
|
55
56
|
).not.toBeUndefined();
|
|
56
57
|
expect(tree.readContent('/baz/foo/foo.decorator.ts')).toEqual(
|
|
57
58
|
"import { ReflectMetadata } from '@nestjs/common';\n" +
|
|
@@ -67,7 +68,7 @@ describe('Decorator Factory', () => {
|
|
|
67
68
|
const tree: UnitTestTree = runner.runSchematic('decorator', options);
|
|
68
69
|
const files: string[] = tree.files;
|
|
69
70
|
expect(
|
|
70
|
-
files.find(filename => filename === '/foo-bar/foo-bar.decorator.ts'),
|
|
71
|
+
files.find((filename) => filename === '/foo-bar/foo-bar.decorator.ts'),
|
|
71
72
|
).not.toBeUndefined();
|
|
72
73
|
expect(tree.readContent('/foo-bar/foo-bar.decorator.ts')).toEqual(
|
|
73
74
|
"import { ReflectMetadata } from '@nestjs/common';\n" +
|
|
@@ -83,7 +84,7 @@ describe('Decorator Factory', () => {
|
|
|
83
84
|
const tree: UnitTestTree = runner.runSchematic('decorator', options);
|
|
84
85
|
const files: string[] = tree.files;
|
|
85
86
|
expect(
|
|
86
|
-
files.find(filename => filename === '/bar-baz/foo/foo.decorator.ts'),
|
|
87
|
+
files.find((filename) => filename === '/bar-baz/foo/foo.decorator.ts'),
|
|
87
88
|
).not.toBeUndefined();
|
|
88
89
|
expect(tree.readContent('/bar-baz/foo/foo.decorator.ts')).toEqual(
|
|
89
90
|
"import { ReflectMetadata } from '@nestjs/common';\n" +
|
|
@@ -100,7 +101,7 @@ describe('Decorator Factory', () => {
|
|
|
100
101
|
const tree: UnitTestTree = runner.runSchematic('decorator', options);
|
|
101
102
|
const files: string[] = tree.files;
|
|
102
103
|
expect(
|
|
103
|
-
files.find(filename => filename === '/foo/foo.decorator.js'),
|
|
104
|
+
files.find((filename) => filename === '/foo/foo.decorator.js'),
|
|
104
105
|
).not.toBeUndefined();
|
|
105
106
|
expect(tree.readContent('/foo/foo.decorator.js')).toEqual(
|
|
106
107
|
"import { ReflectMetadata } from '@nestjs/common';\n" +
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
template,
|
|
12
12
|
url,
|
|
13
13
|
} from '@angular-devkit/schematics';
|
|
14
|
+
|
|
14
15
|
import { Location, NameParser } from '../../utils/name.parser';
|
|
15
16
|
import { mergeSourceRoot } from '../../utils/source-root.helpers';
|
|
16
17
|
import { DecoratorOptions } from './decorator.schema';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.main =
|
|
3
|
+
exports.main = main;
|
|
4
4
|
const core_1 = require("@angular-devkit/core");
|
|
5
5
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
-
const util_1 = require("util");
|
|
7
6
|
const module_declarator_1 = require("../../utils/module.declarator");
|
|
8
7
|
const module_finder_1 = require("../../utils/module.finder");
|
|
9
8
|
const name_parser_1 = require("../../utils/name.parser");
|
|
@@ -11,19 +10,18 @@ const source_root_helpers_1 = require("../../utils/source-root.helpers");
|
|
|
11
10
|
function main(options) {
|
|
12
11
|
options = transform(options);
|
|
13
12
|
return (tree, context) => {
|
|
14
|
-
return schematics_1.branchAndMerge(schematics_1.chain([
|
|
15
|
-
source_root_helpers_1.mergeSourceRoot(options),
|
|
13
|
+
return (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
|
|
14
|
+
(0, source_root_helpers_1.mergeSourceRoot)(options),
|
|
16
15
|
addDeclarationToModule(options),
|
|
17
|
-
schematics_1.mergeWith(generate(options)),
|
|
16
|
+
(0, schematics_1.mergeWith)(generate(options)),
|
|
18
17
|
]))(tree, context);
|
|
19
18
|
};
|
|
20
19
|
}
|
|
21
|
-
exports.main = main;
|
|
22
20
|
function transform(source) {
|
|
23
21
|
const target = Object.assign({}, source);
|
|
24
22
|
target.metadata = 'effects';
|
|
25
23
|
target.type = 'effect';
|
|
26
|
-
if (
|
|
24
|
+
if (target.name === null || target.name === undefined) {
|
|
27
25
|
throw new schematics_1.SchematicsException('Option (name) is required.');
|
|
28
26
|
}
|
|
29
27
|
const location = new name_parser_1.NameParser().parse(target);
|
|
@@ -32,14 +30,14 @@ function transform(source) {
|
|
|
32
30
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
33
31
|
target.path = target.flat
|
|
34
32
|
? target.path
|
|
35
|
-
: core_1.join(target.path, target.name);
|
|
33
|
+
: (0, core_1.join)(target.path, target.name);
|
|
36
34
|
return target;
|
|
37
35
|
}
|
|
38
36
|
function generate(options) {
|
|
39
|
-
return (context) => schematics_1.apply(schematics_1.url(core_1.join('./files', options.language)), [
|
|
40
|
-
options.spec ? schematics_1.noop() : schematics_1.filter(path => !path.endsWith('.spec.ts')),
|
|
41
|
-
schematics_1.template(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
42
|
-
schematics_1.move(options.path),
|
|
37
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
38
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts')),
|
|
39
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
40
|
+
(0, schematics_1.move)(options.path),
|
|
43
41
|
])(context);
|
|
44
42
|
}
|
|
45
43
|
function addDeclarationToModule(options) {
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
UnitTestTree,
|
|
5
5
|
} from '@angular-devkit/schematics/testing';
|
|
6
6
|
import * as path from 'path';
|
|
7
|
+
|
|
7
8
|
import { ApplicationOptions } from '../application/application.schema';
|
|
8
9
|
import { ModuleOptions } from '../module/module.schema';
|
|
9
10
|
import { ServiceOptions } from './service.schema';
|
|
@@ -22,10 +23,10 @@ describe('Service Factory', () => {
|
|
|
22
23
|
const tree: UnitTestTree = runner.runSchematic('service', options);
|
|
23
24
|
const files: string[] = tree.files;
|
|
24
25
|
expect(
|
|
25
|
-
files.find(filename => filename === '/foo.service.ts'),
|
|
26
|
+
files.find((filename) => filename === '/foo.service.ts'),
|
|
26
27
|
).toBeDefined();
|
|
27
28
|
expect(
|
|
28
|
-
files.find(filename => filename === '/foo.service.spec.ts'),
|
|
29
|
+
files.find((filename) => filename === '/foo.service.spec.ts'),
|
|
29
30
|
).toBeDefined();
|
|
30
31
|
expect(tree.readContent('/foo.service.ts')).toEqual(
|
|
31
32
|
"import { Injectable } from '@nestjs/common';\n" +
|
|
@@ -43,10 +44,10 @@ describe('Service Factory', () => {
|
|
|
43
44
|
const tree: UnitTestTree = runner.runSchematic('service', options);
|
|
44
45
|
const files: string[] = tree.files;
|
|
45
46
|
expect(
|
|
46
|
-
files.find(filename => filename === '/bar/foo.service.ts'),
|
|
47
|
+
files.find((filename) => filename === '/bar/foo.service.ts'),
|
|
47
48
|
).toBeDefined();
|
|
48
49
|
expect(
|
|
49
|
-
files.find(filename => filename === '/bar/foo.service.spec.ts'),
|
|
50
|
+
files.find((filename) => filename === '/bar/foo.service.spec.ts'),
|
|
50
51
|
).toBeDefined();
|
|
51
52
|
expect(tree.readContent('/bar/foo.service.ts')).toEqual(
|
|
52
53
|
"import { Injectable } from '@nestjs/common';\n" +
|
|
@@ -65,10 +66,10 @@ describe('Service Factory', () => {
|
|
|
65
66
|
const tree: UnitTestTree = runner.runSchematic('service', options);
|
|
66
67
|
const files: string[] = tree.files;
|
|
67
68
|
expect(
|
|
68
|
-
files.find(filename => filename === '/bar/foo.service.ts'),
|
|
69
|
+
files.find((filename) => filename === '/bar/foo.service.ts'),
|
|
69
70
|
).toBeDefined();
|
|
70
71
|
expect(
|
|
71
|
-
files.find(filename => filename === '/bar/foo.service.spec.ts'),
|
|
72
|
+
files.find((filename) => filename === '/bar/foo.service.spec.ts'),
|
|
72
73
|
).toBeDefined();
|
|
73
74
|
expect(tree.readContent('/bar/foo.service.ts')).toEqual(
|
|
74
75
|
"import { Injectable } from '@nestjs/common';\n" +
|
|
@@ -86,7 +87,7 @@ describe('Service Factory', () => {
|
|
|
86
87
|
const tree: UnitTestTree = runner.runSchematic('service', options);
|
|
87
88
|
const files: string[] = tree.files;
|
|
88
89
|
expect(
|
|
89
|
-
files.find(filename => filename === '/foo-bar.service.ts'),
|
|
90
|
+
files.find((filename) => filename === '/foo-bar.service.ts'),
|
|
90
91
|
).toBeDefined();
|
|
91
92
|
expect(tree.readContent('/foo-bar.service.ts')).toEqual(
|
|
92
93
|
"import { Injectable } from '@nestjs/common';\n" +
|
|
@@ -104,10 +105,10 @@ describe('Service Factory', () => {
|
|
|
104
105
|
const tree: UnitTestTree = runner.runSchematic('service', options);
|
|
105
106
|
const files: string[] = tree.files;
|
|
106
107
|
expect(
|
|
107
|
-
files.find(filename => filename === '/bar-baz/foo.service.ts'),
|
|
108
|
+
files.find((filename) => filename === '/bar-baz/foo.service.ts'),
|
|
108
109
|
).toBeDefined();
|
|
109
110
|
expect(
|
|
110
|
-
files.find(filename => filename === '/bar-baz/foo.service.spec.ts'),
|
|
111
|
+
files.find((filename) => filename === '/bar-baz/foo.service.spec.ts'),
|
|
111
112
|
).toBeDefined();
|
|
112
113
|
expect(tree.readContent('/bar-baz/foo.service.ts')).toEqual(
|
|
113
114
|
"import { Injectable } from '@nestjs/common';\n" +
|
|
@@ -126,10 +127,10 @@ describe('Service Factory', () => {
|
|
|
126
127
|
const tree: UnitTestTree = runner.runSchematic('service', options);
|
|
127
128
|
const files: string[] = tree.files;
|
|
128
129
|
expect(
|
|
129
|
-
files.find(filename => filename === '/foo.service.js'),
|
|
130
|
+
files.find((filename) => filename === '/foo.service.js'),
|
|
130
131
|
).toBeDefined();
|
|
131
132
|
expect(
|
|
132
|
-
files.find(filename => filename === '/foo.service.spec.js'),
|
|
133
|
+
files.find((filename) => filename === '/foo.service.spec.js'),
|
|
133
134
|
).toBeDefined();
|
|
134
135
|
expect(tree.readContent('/foo.service.js')).toEqual(
|
|
135
136
|
"import { Injectable } from '@nestjs/common';\n" +
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
Tree,
|
|
15
15
|
url,
|
|
16
16
|
} from '@angular-devkit/schematics';
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
import {
|
|
19
19
|
DeclarationOptions,
|
|
20
20
|
ModuleDeclarator,
|
|
@@ -42,7 +42,7 @@ function transform(source: ServiceOptions): ServiceOptions {
|
|
|
42
42
|
target.metadata = 'effects';
|
|
43
43
|
target.type = 'effect';
|
|
44
44
|
|
|
45
|
-
if (
|
|
45
|
+
if (target.name === null || target.name === undefined) {
|
|
46
46
|
throw new SchematicsException('Option (name) is required.');
|
|
47
47
|
}
|
|
48
48
|
const location: Location = new NameParser().parse(target);
|
|
@@ -59,7 +59,7 @@ function transform(source: ServiceOptions): ServiceOptions {
|
|
|
59
59
|
function generate(options: ServiceOptions) {
|
|
60
60
|
return (context: SchematicContext) =>
|
|
61
61
|
apply(url(join('./files' as Path, options.language)), [
|
|
62
|
-
options.spec ? noop() : filter(path => !path.endsWith('.spec.ts')),
|
|
62
|
+
options.spec ? noop() : filter((path) => !path.endsWith('.spec.ts')),
|
|
63
63
|
template({
|
|
64
64
|
...strings,
|
|
65
65
|
...options,
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.main =
|
|
3
|
+
exports.main = main;
|
|
4
4
|
const core_1 = require("@angular-devkit/core");
|
|
5
5
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
6
|
const name_parser_1 = require("../../utils/name.parser");
|
|
7
7
|
const source_root_helpers_1 = require("../../utils/source-root.helpers");
|
|
8
8
|
function main(options) {
|
|
9
9
|
options = transform(options);
|
|
10
|
-
return schematics_1.chain([source_root_helpers_1.mergeSourceRoot(options), schematics_1.mergeWith(generate(options))]);
|
|
10
|
+
return (0, schematics_1.chain)([(0, source_root_helpers_1.mergeSourceRoot)(options), (0, schematics_1.mergeWith)(generate(options))]);
|
|
11
11
|
}
|
|
12
|
-
exports.main = main;
|
|
13
12
|
function transform(options) {
|
|
14
13
|
const target = Object.assign({}, options);
|
|
15
14
|
if (!target.name) {
|
|
@@ -21,13 +20,13 @@ function transform(options) {
|
|
|
21
20
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
22
21
|
target.path = target.flat
|
|
23
22
|
? target.path
|
|
24
|
-
: core_1.join(target.path, target.name);
|
|
23
|
+
: (0, core_1.join)(target.path, target.name);
|
|
25
24
|
return target;
|
|
26
25
|
}
|
|
27
26
|
function generate(options) {
|
|
28
|
-
return (context) => schematics_1.apply(schematics_1.url(core_1.join('./files', options.language)), [
|
|
29
|
-
options.spec ? schematics_1.noop() : schematics_1.filter(path => !path.endsWith('.spec.ts')),
|
|
30
|
-
schematics_1.template(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
31
|
-
schematics_1.move(options.path),
|
|
27
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
28
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts')),
|
|
29
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
30
|
+
(0, schematics_1.move)(options.path),
|
|
32
31
|
])(context);
|
|
33
32
|
}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
UnitTestTree,
|
|
4
4
|
} from '@angular-devkit/schematics/testing';
|
|
5
5
|
import * as path from 'path';
|
|
6
|
+
|
|
6
7
|
import { FilterOptions } from './filter.schema';
|
|
7
8
|
|
|
8
9
|
describe('Filter Factory', () => {
|
|
@@ -17,7 +18,9 @@ describe('Filter Factory', () => {
|
|
|
17
18
|
};
|
|
18
19
|
const tree: UnitTestTree = runner.runSchematic('filter', options);
|
|
19
20
|
const files: string[] = tree.files;
|
|
20
|
-
expect(
|
|
21
|
+
expect(
|
|
22
|
+
files.find((filename) => filename === '/foo.filter.ts'),
|
|
23
|
+
).toBeDefined();
|
|
21
24
|
expect(tree.readContent('/foo.filter.ts')).toEqual(
|
|
22
25
|
"import { ArgumentsHost, Catch, ExceptionFilter } from '@nestjs/common';\n" +
|
|
23
26
|
'\n' +
|
|
@@ -35,7 +38,7 @@ describe('Filter Factory', () => {
|
|
|
35
38
|
const tree: UnitTestTree = runner.runSchematic('filter', options);
|
|
36
39
|
const files: string[] = tree.files;
|
|
37
40
|
expect(
|
|
38
|
-
files.find(filename => filename === '/bar/foo.filter.ts'),
|
|
41
|
+
files.find((filename) => filename === '/bar/foo.filter.ts'),
|
|
39
42
|
).toBeDefined();
|
|
40
43
|
expect(tree.readContent('/bar/foo.filter.ts')).toEqual(
|
|
41
44
|
"import { ArgumentsHost, Catch, ExceptionFilter } from '@nestjs/common';\n" +
|
|
@@ -55,7 +58,7 @@ describe('Filter Factory', () => {
|
|
|
55
58
|
const tree: UnitTestTree = runner.runSchematic('filter', options);
|
|
56
59
|
const files: string[] = tree.files;
|
|
57
60
|
expect(
|
|
58
|
-
files.find(filename => filename === '/baz/foo.filter.ts'),
|
|
61
|
+
files.find((filename) => filename === '/baz/foo.filter.ts'),
|
|
59
62
|
).toBeDefined();
|
|
60
63
|
expect(tree.readContent('/baz/foo.filter.ts')).toEqual(
|
|
61
64
|
"import { ArgumentsHost, Catch, ExceptionFilter } from '@nestjs/common';\n" +
|
|
@@ -74,7 +77,7 @@ describe('Filter Factory', () => {
|
|
|
74
77
|
const tree: UnitTestTree = runner.runSchematic('filter', options);
|
|
75
78
|
const files: string[] = tree.files;
|
|
76
79
|
expect(
|
|
77
|
-
files.find(filename => filename === '/foo-bar.filter.ts'),
|
|
80
|
+
files.find((filename) => filename === '/foo-bar.filter.ts'),
|
|
78
81
|
).toBeDefined();
|
|
79
82
|
expect(tree.readContent('/foo-bar.filter.ts')).toEqual(
|
|
80
83
|
"import { ArgumentsHost, Catch, ExceptionFilter } from '@nestjs/common';\n" +
|
|
@@ -93,7 +96,7 @@ describe('Filter Factory', () => {
|
|
|
93
96
|
const tree: UnitTestTree = runner.runSchematic('filter', options);
|
|
94
97
|
const files: string[] = tree.files;
|
|
95
98
|
expect(
|
|
96
|
-
files.find(filename => filename === '/bar-baz/foo.filter.ts'),
|
|
99
|
+
files.find((filename) => filename === '/bar-baz/foo.filter.ts'),
|
|
97
100
|
).toBeDefined();
|
|
98
101
|
expect(tree.readContent('/bar-baz/foo.filter.ts')).toEqual(
|
|
99
102
|
"import { ArgumentsHost, Catch, ExceptionFilter } from '@nestjs/common';\n" +
|
|
@@ -112,7 +115,9 @@ describe('Filter Factory', () => {
|
|
|
112
115
|
};
|
|
113
116
|
const tree: UnitTestTree = runner.runSchematic('filter', options);
|
|
114
117
|
const files: string[] = tree.files;
|
|
115
|
-
expect(
|
|
118
|
+
expect(
|
|
119
|
+
files.find((filename) => filename === '/foo.filter.js'),
|
|
120
|
+
).toBeDefined();
|
|
116
121
|
expect(tree.readContent('/foo.filter.js')).toEqual(
|
|
117
122
|
"import { Catch } from '@nestjs/common';\n" +
|
|
118
123
|
'\n' +
|
|
@@ -133,7 +138,7 @@ describe('Filter Factory', () => {
|
|
|
133
138
|
|
|
134
139
|
const files: string[] = tree.files;
|
|
135
140
|
expect(
|
|
136
|
-
files.find(filename => filename === '/src/foo.filter.js'),
|
|
141
|
+
files.find((filename) => filename === '/src/foo.filter.js'),
|
|
137
142
|
).toBeDefined();
|
|
138
143
|
expect(tree.readContent('/src/foo.filter.js')).toEqual(
|
|
139
144
|
"import { Catch } from '@nestjs/common';\n" +
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
template,
|
|
14
14
|
url,
|
|
15
15
|
} from '@angular-devkit/schematics';
|
|
16
|
+
|
|
16
17
|
import { Location, NameParser } from '../../utils/name.parser';
|
|
17
18
|
import { mergeSourceRoot } from '../../utils/source-root.helpers';
|
|
18
19
|
import { FilterOptions } from './filter.schema';
|
|
@@ -41,7 +42,7 @@ function transform(options: FilterOptions): FilterOptions {
|
|
|
41
42
|
function generate(options: FilterOptions): Source {
|
|
42
43
|
return (context: SchematicContext) =>
|
|
43
44
|
apply(url(join('./files' as Path, options.language)), [
|
|
44
|
-
options.spec ? noop() : filter(path => !path.endsWith('.spec.ts')),
|
|
45
|
+
options.spec ? noop() : filter((path) => !path.endsWith('.spec.ts')),
|
|
45
46
|
template({
|
|
46
47
|
...strings,
|
|
47
48
|
...options,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.main =
|
|
3
|
+
exports.main = main;
|
|
4
4
|
const core_1 = require("@angular-devkit/core");
|
|
5
5
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
6
|
const module_declarator_1 = require("../../utils/module.declarator");
|
|
@@ -10,14 +10,13 @@ const source_root_helpers_1 = require("../../utils/source-root.helpers");
|
|
|
10
10
|
function main(options) {
|
|
11
11
|
options = transform(options);
|
|
12
12
|
return (tree, context) => {
|
|
13
|
-
return schematics_1.branchAndMerge(schematics_1.chain([
|
|
14
|
-
source_root_helpers_1.mergeSourceRoot(options),
|
|
13
|
+
return (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
|
|
14
|
+
(0, source_root_helpers_1.mergeSourceRoot)(options),
|
|
15
15
|
addDeclarationToModule(options),
|
|
16
|
-
schematics_1.mergeWith(generate(options)),
|
|
16
|
+
(0, schematics_1.mergeWith)(generate(options)),
|
|
17
17
|
]))(tree, context);
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
exports.main = main;
|
|
21
20
|
function transform(options) {
|
|
22
21
|
const target = Object.assign({}, options);
|
|
23
22
|
if (!target.name) {
|
|
@@ -31,14 +30,14 @@ function transform(options) {
|
|
|
31
30
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
32
31
|
target.path = target.flat
|
|
33
32
|
? target.path
|
|
34
|
-
: core_1.join(target.path, target.name);
|
|
33
|
+
: (0, core_1.join)(target.path, target.name);
|
|
35
34
|
return target;
|
|
36
35
|
}
|
|
37
36
|
function generate(options) {
|
|
38
|
-
return (context) => schematics_1.apply(schematics_1.url(core_1.join('./files', options.language)), [
|
|
39
|
-
options.spec ? schematics_1.noop() : schematics_1.filter(path => !path.endsWith('.spec.ts')),
|
|
40
|
-
schematics_1.template(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
41
|
-
schematics_1.move(options.path),
|
|
37
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
38
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts')),
|
|
39
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
40
|
+
(0, schematics_1.move)(options.path),
|
|
42
41
|
])(context);
|
|
43
42
|
}
|
|
44
43
|
function addDeclarationToModule(options) {
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
UnitTestTree,
|
|
4
4
|
} from '@angular-devkit/schematics/testing';
|
|
5
5
|
import * as path from 'path';
|
|
6
|
+
|
|
6
7
|
import { GatewayOptions } from './gateway.schema';
|
|
7
8
|
|
|
8
9
|
describe('Gateway Factory', () => {
|
|
@@ -18,7 +19,7 @@ describe('Gateway Factory', () => {
|
|
|
18
19
|
const tree: UnitTestTree = runner.runSchematic('gateway', options);
|
|
19
20
|
const files: string[] = tree.files;
|
|
20
21
|
expect(
|
|
21
|
-
files.find(filename => filename === '/foo/foo.gateway.ts'),
|
|
22
|
+
files.find((filename) => filename === '/foo/foo.gateway.ts'),
|
|
22
23
|
).not.toBeUndefined();
|
|
23
24
|
expect(tree.readContent('/foo/foo.gateway.ts')).toEqual(
|
|
24
25
|
"import { SubscribeMessage, WebSocketGateway } from '@nestjs/websockets';\n" +
|
|
@@ -40,7 +41,7 @@ describe('Gateway Factory', () => {
|
|
|
40
41
|
const tree: UnitTestTree = runner.runSchematic('gateway', options);
|
|
41
42
|
const files: string[] = tree.files;
|
|
42
43
|
expect(
|
|
43
|
-
files.find(filename => filename === '/bar/foo/foo.gateway.ts'),
|
|
44
|
+
files.find((filename) => filename === '/bar/foo/foo.gateway.ts'),
|
|
44
45
|
).not.toBeUndefined();
|
|
45
46
|
expect(tree.readContent('/bar/foo/foo.gateway.ts')).toEqual(
|
|
46
47
|
"import { SubscribeMessage, WebSocketGateway } from '@nestjs/websockets';\n" +
|
|
@@ -63,7 +64,7 @@ describe('Gateway Factory', () => {
|
|
|
63
64
|
const tree: UnitTestTree = runner.runSchematic('gateway', options);
|
|
64
65
|
const files: string[] = tree.files;
|
|
65
66
|
expect(
|
|
66
|
-
files.find(filename => filename === '/baz/foo/foo.gateway.ts'),
|
|
67
|
+
files.find((filename) => filename === '/baz/foo/foo.gateway.ts'),
|
|
67
68
|
).not.toBeUndefined();
|
|
68
69
|
expect(tree.readContent('/baz/foo/foo.gateway.ts')).toEqual(
|
|
69
70
|
"import { SubscribeMessage, WebSocketGateway } from '@nestjs/websockets';\n" +
|
|
@@ -85,7 +86,7 @@ describe('Gateway Factory', () => {
|
|
|
85
86
|
const tree: UnitTestTree = runner.runSchematic('gateway', options);
|
|
86
87
|
const files: string[] = tree.files;
|
|
87
88
|
expect(
|
|
88
|
-
files.find(filename => filename === '/foo-bar/foo-bar.gateway.ts'),
|
|
89
|
+
files.find((filename) => filename === '/foo-bar/foo-bar.gateway.ts'),
|
|
89
90
|
).not.toBeUndefined();
|
|
90
91
|
expect(tree.readContent('/foo-bar/foo-bar.gateway.ts')).toEqual(
|
|
91
92
|
"import { SubscribeMessage, WebSocketGateway } from '@nestjs/websockets';\n" +
|
|
@@ -107,7 +108,7 @@ describe('Gateway Factory', () => {
|
|
|
107
108
|
const tree: UnitTestTree = runner.runSchematic('gateway', options);
|
|
108
109
|
const files: string[] = tree.files;
|
|
109
110
|
expect(
|
|
110
|
-
files.find(filename => filename === '/bar-baz/foo/foo.gateway.ts'),
|
|
111
|
+
files.find((filename) => filename === '/bar-baz/foo/foo.gateway.ts'),
|
|
111
112
|
).not.toBeUndefined();
|
|
112
113
|
expect(tree.readContent('/bar-baz/foo/foo.gateway.ts')).toEqual(
|
|
113
114
|
"import { SubscribeMessage, WebSocketGateway } from '@nestjs/websockets';\n" +
|
|
@@ -130,7 +131,7 @@ describe('Gateway Factory', () => {
|
|
|
130
131
|
const tree: UnitTestTree = runner.runSchematic('gateway', options);
|
|
131
132
|
const files: string[] = tree.files;
|
|
132
133
|
expect(
|
|
133
|
-
files.find(filename => filename === '/foo/foo.gateway.js'),
|
|
134
|
+
files.find((filename) => filename === '/foo/foo.gateway.js'),
|
|
134
135
|
).not.toBeUndefined();
|
|
135
136
|
expect(tree.readContent('/foo/foo.gateway.js')).toEqual(
|
|
136
137
|
"import { SubscribeMessage, WebSocketGateway } from '@nestjs/websockets';\n" +
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
Tree,
|
|
16
16
|
url,
|
|
17
17
|
} from '@angular-devkit/schematics';
|
|
18
|
+
|
|
18
19
|
import {
|
|
19
20
|
DeclarationOptions,
|
|
20
21
|
ModuleDeclarator,
|
|
@@ -60,7 +61,7 @@ function transform(options: GatewayOptions): GatewayOptions {
|
|
|
60
61
|
function generate(options: GatewayOptions): Source {
|
|
61
62
|
return (context: SchematicContext) =>
|
|
62
63
|
apply(url(join('./files' as Path, options.language)), [
|
|
63
|
-
options.spec ? noop() : filter(path => !path.endsWith('.spec.ts')),
|
|
64
|
+
options.spec ? noop() : filter((path) => !path.endsWith('.spec.ts')),
|
|
64
65
|
template({
|
|
65
66
|
...strings,
|
|
66
67
|
...options,
|