@nestjs/schematics 8.0.10 → 9.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.
- package/dist/collection.json +3 -2
- package/dist/lib/application/application.factory.js +2 -2
- package/dist/lib/application/files/js/package.json +15 -15
- package/dist/lib/application/files/ts/package.json +10 -10
- package/dist/lib/application/schema.json +4 -1
- package/dist/lib/class/class.factory.js +8 -1
- package/dist/lib/class/files/js/{__name__.spec.js → __name__.__specFileSuffix__.js} +0 -0
- package/dist/lib/class/files/ts/{__name__.spec.ts → __name__.__specFileSuffix__.ts} +0 -0
- package/dist/lib/class/schema.json +5 -0
- package/dist/lib/controller/controller.factory.js +8 -1
- package/dist/lib/controller/files/js/{__name__.controller.spec.js → __name__.controller.__specFileSuffix__.js} +0 -0
- package/dist/lib/controller/files/ts/{__name__.controller.spec.ts → __name__.controller.__specFileSuffix__.ts} +0 -0
- package/dist/lib/controller/schema.json +5 -0
- package/dist/lib/filter/files/js/{__name__.filter.spec.js → __name__.filter.__specFileSuffix__.js} +0 -0
- package/dist/lib/filter/files/ts/{__name__.filter.spec.ts → __name__.filter.__specFileSuffix__.ts} +0 -0
- package/dist/lib/filter/filter.factory.js +8 -1
- package/dist/lib/filter/schema.json +5 -0
- package/dist/lib/gateway/files/js/{__name__.gateway.spec.js → __name__.gateway.__specFileSuffix__.js} +0 -0
- package/dist/lib/gateway/files/ts/{__name__.gateway.spec.ts → __name__.gateway.__specFileSuffix__.ts} +0 -0
- package/dist/lib/gateway/gateway.factory.js +8 -0
- package/dist/lib/gateway/schema.json +5 -0
- package/dist/lib/guard/files/js/{__name__.guard.spec.js → __name__.guard.__specFileSuffix__.js} +0 -0
- package/dist/lib/guard/files/ts/{__name__.guard.spec.ts → __name__.guard.__specFileSuffix__.ts} +0 -0
- package/dist/lib/guard/guard.factory.js +8 -1
- package/dist/lib/guard/schema.json +5 -0
- package/dist/lib/interceptor/files/js/{__name__.interceptor.spec.js → __name__.interceptor.__specFileSuffix__.js} +0 -0
- package/dist/lib/interceptor/files/ts/{__name__.interceptor.spec.ts → __name__.interceptor.__specFileSuffix__.ts} +0 -0
- package/dist/lib/interceptor/interceptor.factory.js +8 -0
- package/dist/lib/interceptor/schema.json +5 -0
- package/dist/lib/middleware/files/js/{__name__.middleware.spec.js → __name__.middleware.__specFileSuffix__.js} +0 -0
- package/dist/lib/middleware/files/ts/{__name__.middleware.spec.ts → __name__.middleware.__specFileSuffix__.ts} +0 -0
- package/dist/lib/middleware/middleware.factory.js +8 -1
- package/dist/lib/middleware/schema.json +5 -0
- package/dist/lib/pipe/files/js/{__name__.pipe.spec.js → __name__.pipe.__specFileSuffix__.js} +0 -0
- package/dist/lib/pipe/files/ts/{__name__.pipe.spec.ts → __name__.pipe.__specFileSuffix__.ts} +0 -0
- package/dist/lib/pipe/pipe.factory.js +8 -0
- package/dist/lib/pipe/schema.json +5 -0
- package/dist/lib/provider/files/js/{__name__.spec.js → __name__.__specFileSuffix__.js} +0 -0
- package/dist/lib/provider/files/ts/{__name__.spec.ts → __name__.__specFileSuffix__.ts} +0 -0
- package/dist/lib/provider/provider.factory.js +8 -1
- package/dist/lib/provider/schema.json +5 -0
- package/dist/lib/resolver/files/js/{__name__.resolver.spec.js → __name__.resolver.__specFileSuffix__.js} +0 -0
- package/dist/lib/resolver/files/ts/{__name__.resolver.spec.ts → __name__.resolver.__specFileSuffix__.ts} +0 -0
- package/dist/lib/resolver/resolver.factory.js +8 -1
- package/dist/lib/resolver/schema.json +5 -0
- package/dist/lib/resource/files/ts/{__name__.controller.spec.ts → __name__.controller.__specFileSuffix__.ts} +0 -0
- package/dist/lib/resource/files/ts/{__name__.gateway.spec.ts → __name__.gateway.__specFileSuffix__.ts} +0 -0
- package/dist/lib/resource/files/ts/{__name__.resolver.spec.ts → __name__.resolver.__specFileSuffix__.ts} +0 -0
- package/dist/lib/resource/files/ts/{__name__.service.spec.ts → __name__.service.__specFileSuffix__.ts} +0 -0
- package/dist/lib/resource/resource.factory.js +10 -4
- package/dist/lib/resource/schema.json +5 -0
- package/dist/lib/service/files/js/{__name__.service.spec.js → __name__.service.__specFileSuffix__.js} +0 -0
- package/dist/lib/service/files/ts/{__name__.service.spec.ts → __name__.service.__specFileSuffix__.ts} +0 -0
- package/dist/lib/service/schema.json +5 -0
- package/dist/lib/service/service.factory.js +8 -1
- package/dist/lib/sub-app/files/js/src/{app.controller.spec.js → app.controller.__specFileSuffix__.js} +0 -0
- package/dist/lib/sub-app/files/js/test/{app.e2e-spec.js → app.e2e-__specFileSuffix__.js} +0 -0
- package/dist/lib/sub-app/files/ts/src/{__name__.controller.spec.ts → __name__.controller.__specFileSuffix__.ts} +0 -0
- package/dist/lib/sub-app/files/ts/test/{app.e2e-spec.ts → app.e2e-__specFileSuffix__.ts} +0 -0
- package/dist/lib/sub-app/files/ts/tsconfig.app.json +1 -1
- package/dist/lib/sub-app/schema.json +5 -0
- package/dist/lib/sub-app/workspace/ts/tsconfig.app.json +1 -1
- package/dist/utils/metadata.manager.js +4 -6
- package/package.json +23 -24
package/dist/collection.json
CHANGED
|
@@ -51,12 +51,13 @@
|
|
|
51
51
|
"factory": "./lib/interceptor/interceptor.factory#main",
|
|
52
52
|
"description": "Create a Nest interceptor.",
|
|
53
53
|
"schema": "./lib/interceptor/schema.json",
|
|
54
|
-
"aliases": ["
|
|
54
|
+
"aliases": ["itc"]
|
|
55
55
|
},
|
|
56
56
|
"interface": {
|
|
57
57
|
"factory": "./lib/interface/interface.factory#main",
|
|
58
58
|
"description": "Create a Nest interface.",
|
|
59
|
-
"schema": "./lib/interface/schema.json"
|
|
59
|
+
"schema": "./lib/interface/schema.json",
|
|
60
|
+
"aliases": ["itf"]
|
|
60
61
|
},
|
|
61
62
|
"middleware": {
|
|
62
63
|
"factory": "./lib/middleware/middleware.factory#main",
|
|
@@ -7,7 +7,7 @@ const path_1 = require("path");
|
|
|
7
7
|
const formatting_1 = require("../../utils/formatting");
|
|
8
8
|
const defaults_1 = require("../defaults");
|
|
9
9
|
function main(options) {
|
|
10
|
-
options.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.name);
|
|
10
|
+
options.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.name.toString());
|
|
11
11
|
const path = !options.directory || options.directory === 'undefined'
|
|
12
12
|
? options.name
|
|
13
13
|
: options.directory;
|
|
@@ -22,7 +22,7 @@ function transform(options) {
|
|
|
22
22
|
? target.description
|
|
23
23
|
: defaults_1.DEFAULT_DESCRIPTION;
|
|
24
24
|
target.language = !!target.language ? target.language : defaults_1.DEFAULT_LANGUAGE;
|
|
25
|
-
target.name = resolvePackageName(target.name);
|
|
25
|
+
target.name = resolvePackageName(target.name.toString());
|
|
26
26
|
target.version = !!target.version ? target.version : defaults_1.DEFAULT_VERSION;
|
|
27
27
|
target.packageManager =
|
|
28
28
|
!target.packageManager || target.packageManager === 'undefined'
|
|
@@ -14,25 +14,25 @@
|
|
|
14
14
|
"test:e2e": "jest --config ./test/jest-e2e.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@nestjs/common": "^
|
|
18
|
-
"@nestjs/core": "^
|
|
19
|
-
"@nestjs/platform-express": "^
|
|
17
|
+
"@nestjs/common": "^9.0.0",
|
|
18
|
+
"@nestjs/core": "^9.0.0",
|
|
19
|
+
"@nestjs/platform-express": "^9.0.0",
|
|
20
20
|
"reflect-metadata": "^0.1.13",
|
|
21
21
|
"rxjs": "^7.2.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@nestjs/testing": "^
|
|
25
|
-
"@babel/core": "7.
|
|
26
|
-
"@babel/node": "7.
|
|
27
|
-
"@babel/plugin-proposal-decorators": "7.
|
|
28
|
-
"@babel/plugin-transform-runtime": "7.
|
|
29
|
-
"@babel/preset-env": "7.
|
|
30
|
-
"@babel/register": "7.
|
|
31
|
-
"@babel/runtime": "7.
|
|
32
|
-
"jest": "
|
|
33
|
-
"nodemon": "2.0.
|
|
34
|
-
"prettier": "2.
|
|
35
|
-
"supertest": "6.2.
|
|
24
|
+
"@nestjs/testing": "^9.0.0",
|
|
25
|
+
"@babel/core": "7.18.6",
|
|
26
|
+
"@babel/node": "7.18.6",
|
|
27
|
+
"@babel/plugin-proposal-decorators": "7.18.6",
|
|
28
|
+
"@babel/plugin-transform-runtime": "7.18.6",
|
|
29
|
+
"@babel/preset-env": "7.18.6",
|
|
30
|
+
"@babel/register": "7.18.6",
|
|
31
|
+
"@babel/runtime": "7.18.6",
|
|
32
|
+
"jest": "28.1.2",
|
|
33
|
+
"nodemon": "2.0.19",
|
|
34
|
+
"prettier": "2.7.1",
|
|
35
|
+
"supertest": "6.2.4"
|
|
36
36
|
},
|
|
37
37
|
"jest": {
|
|
38
38
|
"moduleFileExtensions": [
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
"test:e2e": "jest --config ./test/jest-e2e.json"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@nestjs/common": "^
|
|
25
|
-
"@nestjs/core": "^
|
|
26
|
-
"@nestjs/platform-express": "^
|
|
24
|
+
"@nestjs/common": "^9.0.0",
|
|
25
|
+
"@nestjs/core": "^9.0.0",
|
|
26
|
+
"@nestjs/platform-express": "^9.0.0",
|
|
27
27
|
"reflect-metadata": "^0.1.13",
|
|
28
28
|
"rimraf": "^3.0.2",
|
|
29
29
|
"rxjs": "^7.2.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@nestjs/cli": "^
|
|
33
|
-
"@nestjs/schematics": "^
|
|
34
|
-
"@nestjs/testing": "^
|
|
32
|
+
"@nestjs/cli": "^9.0.0",
|
|
33
|
+
"@nestjs/schematics": "^9.0.0",
|
|
34
|
+
"@nestjs/testing": "^9.0.0",
|
|
35
35
|
"@types/express": "^4.17.13",
|
|
36
|
-
"@types/jest": "
|
|
36
|
+
"@types/jest": "28.1.4",
|
|
37
37
|
"@types/node": "^16.0.0",
|
|
38
38
|
"@types/supertest": "^2.0.11",
|
|
39
39
|
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"eslint": "^8.0.1",
|
|
42
42
|
"eslint-config-prettier": "^8.3.0",
|
|
43
43
|
"eslint-plugin-prettier": "^4.0.0",
|
|
44
|
-
"jest": "
|
|
44
|
+
"jest": "28.1.2",
|
|
45
45
|
"prettier": "^2.3.2",
|
|
46
46
|
"source-map-support": "^0.5.20",
|
|
47
47
|
"supertest": "^6.1.3",
|
|
48
|
-
"ts-jest": "
|
|
48
|
+
"ts-jest": "28.0.5",
|
|
49
49
|
"ts-loader": "^9.2.3",
|
|
50
50
|
"ts-node": "^10.0.0",
|
|
51
|
-
"tsconfig-paths": "
|
|
51
|
+
"tsconfig-paths": "4.0.0",
|
|
52
52
|
"typescript": "^4.3.5"
|
|
53
53
|
},
|
|
54
54
|
"jest": {
|
|
@@ -19,6 +19,7 @@ function transform(options) {
|
|
|
19
19
|
}
|
|
20
20
|
const location = new name_parser_1.NameParser().parse(target);
|
|
21
21
|
target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
|
|
22
|
+
target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
|
|
22
23
|
if (target.name.includes('.')) {
|
|
23
24
|
target.className = core_1.strings.classify(target.name).replace('.', '');
|
|
24
25
|
}
|
|
@@ -35,7 +36,13 @@ function transform(options) {
|
|
|
35
36
|
}
|
|
36
37
|
function generate(options) {
|
|
37
38
|
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
38
|
-
options.spec
|
|
39
|
+
options.spec
|
|
40
|
+
? (0, schematics_1.noop)()
|
|
41
|
+
: (0, schematics_1.filter)((path) => {
|
|
42
|
+
const languageExtension = options.language || 'ts';
|
|
43
|
+
const suffix = `.__specFileSuffix__.${languageExtension}`;
|
|
44
|
+
return !path.endsWith(suffix);
|
|
45
|
+
}),
|
|
39
46
|
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
40
47
|
(0, schematics_1.move)(options.path),
|
|
41
48
|
])(context);
|
|
File without changes
|
|
File without changes
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
"default": true,
|
|
24
24
|
"description": "Specifies if a spec file is generated."
|
|
25
25
|
},
|
|
26
|
+
"specFileSuffix": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"default": "spec",
|
|
29
|
+
"description": "Specifies the file suffix of spec files."
|
|
30
|
+
},
|
|
26
31
|
"path": {
|
|
27
32
|
"type": "string",
|
|
28
33
|
"format": "path",
|
|
@@ -31,6 +31,7 @@ function transform(source) {
|
|
|
31
31
|
target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
|
|
32
32
|
target.language =
|
|
33
33
|
target.language !== undefined ? target.language : defaults_1.DEFAULT_LANGUAGE;
|
|
34
|
+
target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(source.specFileSuffix || 'spec');
|
|
34
35
|
target.path = target.flat
|
|
35
36
|
? target.path
|
|
36
37
|
: (0, core_1.join)(target.path, target.name);
|
|
@@ -38,7 +39,13 @@ function transform(source) {
|
|
|
38
39
|
}
|
|
39
40
|
function generate(options) {
|
|
40
41
|
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
41
|
-
options.spec
|
|
42
|
+
options.spec
|
|
43
|
+
? (0, schematics_1.noop)()
|
|
44
|
+
: (0, schematics_1.filter)((path) => {
|
|
45
|
+
const languageExtension = options.language || 'ts';
|
|
46
|
+
const suffix = `.__specFileSuffix__.${languageExtension}`;
|
|
47
|
+
return !path.endsWith(suffix);
|
|
48
|
+
}),
|
|
42
49
|
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
43
50
|
(0, schematics_1.move)(options.path),
|
|
44
51
|
])(context);
|
|
File without changes
|
|
File without changes
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
"type": "boolean",
|
|
45
45
|
"default": true,
|
|
46
46
|
"description": "Specifies if a spec file is generated."
|
|
47
|
+
},
|
|
48
|
+
"specFileSuffix": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"default": "spec",
|
|
51
|
+
"description": "Specifies the file suffix of spec files."
|
|
47
52
|
}
|
|
48
53
|
},
|
|
49
54
|
"required": ["name"]
|
package/dist/lib/filter/files/js/{__name__.filter.spec.js → __name__.filter.__specFileSuffix__.js}
RENAMED
|
File without changes
|
package/dist/lib/filter/files/ts/{__name__.filter.spec.ts → __name__.filter.__specFileSuffix__.ts}
RENAMED
|
File without changes
|
|
@@ -20,6 +20,7 @@ function transform(options) {
|
|
|
20
20
|
target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
|
|
21
21
|
target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
|
|
22
22
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
23
|
+
target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
|
|
23
24
|
target.path = target.flat
|
|
24
25
|
? target.path
|
|
25
26
|
: (0, core_1.join)(target.path, target.name);
|
|
@@ -27,7 +28,13 @@ function transform(options) {
|
|
|
27
28
|
}
|
|
28
29
|
function generate(options) {
|
|
29
30
|
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
30
|
-
options.spec
|
|
31
|
+
options.spec
|
|
32
|
+
? (0, schematics_1.noop)()
|
|
33
|
+
: (0, schematics_1.filter)((path) => {
|
|
34
|
+
const languageExtension = options.language || 'ts';
|
|
35
|
+
const suffix = `.__specFileSuffix__.${languageExtension}`;
|
|
36
|
+
return !path.endsWith(suffix);
|
|
37
|
+
}),
|
|
31
38
|
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
32
39
|
(0, schematics_1.move)(options.path),
|
|
33
40
|
])(context);
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
"type": "boolean",
|
|
36
36
|
"default": true,
|
|
37
37
|
"description": "Specifies if a spec file is generated."
|
|
38
|
+
},
|
|
39
|
+
"specFileSuffix": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"default": "spec",
|
|
42
|
+
"description": "Specifies the file suffix of spec files."
|
|
38
43
|
}
|
|
39
44
|
},
|
|
40
45
|
"required": ["name"]
|
|
File without changes
|
|
File without changes
|
|
@@ -26,6 +26,7 @@ function transform(options) {
|
|
|
26
26
|
}
|
|
27
27
|
target.metadata = 'providers';
|
|
28
28
|
target.type = 'gateway';
|
|
29
|
+
target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
|
|
29
30
|
const location = new name_parser_1.NameParser().parse(target);
|
|
30
31
|
target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
|
|
31
32
|
target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
|
|
@@ -38,6 +39,13 @@ function transform(options) {
|
|
|
38
39
|
function generate(options) {
|
|
39
40
|
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
40
41
|
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts')),
|
|
42
|
+
options.spec
|
|
43
|
+
? (0, schematics_1.noop)()
|
|
44
|
+
: (0, schematics_1.filter)((path) => {
|
|
45
|
+
const languageExtension = options.language || 'ts';
|
|
46
|
+
const suffix = `.__specFileSuffix__.${languageExtension}`;
|
|
47
|
+
return !path.endsWith(suffix);
|
|
48
|
+
}),
|
|
41
49
|
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
42
50
|
(0, schematics_1.move)(options.path),
|
|
43
51
|
])(context);
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
"type": "boolean",
|
|
36
36
|
"default": true,
|
|
37
37
|
"description": "Specifies if a spec file is generated."
|
|
38
|
+
},
|
|
39
|
+
"specFileSuffix": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"default": "spec",
|
|
42
|
+
"description": "Specifies the file suffix of spec files."
|
|
38
43
|
}
|
|
39
44
|
},
|
|
40
45
|
"required": ["name"]
|
package/dist/lib/guard/files/js/{__name__.guard.spec.js → __name__.guard.__specFileSuffix__.js}
RENAMED
|
File without changes
|
package/dist/lib/guard/files/ts/{__name__.guard.spec.ts → __name__.guard.__specFileSuffix__.ts}
RENAMED
|
File without changes
|
|
@@ -20,6 +20,7 @@ function transform(options) {
|
|
|
20
20
|
target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
|
|
21
21
|
target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
|
|
22
22
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
23
|
+
target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
|
|
23
24
|
target.path = target.flat
|
|
24
25
|
? target.path
|
|
25
26
|
: (0, core_1.join)(target.path, target.name);
|
|
@@ -27,7 +28,13 @@ function transform(options) {
|
|
|
27
28
|
}
|
|
28
29
|
function generate(options) {
|
|
29
30
|
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
30
|
-
options.spec
|
|
31
|
+
options.spec
|
|
32
|
+
? (0, schematics_1.noop)()
|
|
33
|
+
: (0, schematics_1.filter)((path) => {
|
|
34
|
+
const languageExtension = options.language || 'ts';
|
|
35
|
+
const suffix = `.__specFileSuffix__.${languageExtension}`;
|
|
36
|
+
return !path.endsWith(suffix);
|
|
37
|
+
}),
|
|
31
38
|
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
32
39
|
(0, schematics_1.move)(options.path),
|
|
33
40
|
])(context);
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
"type": "boolean",
|
|
36
36
|
"default": true,
|
|
37
37
|
"description": "Specifies if a spec file is generated."
|
|
38
|
+
},
|
|
39
|
+
"specFileSuffix": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"default": "spec",
|
|
42
|
+
"description": "Specifies the file suffix of spec files."
|
|
38
43
|
}
|
|
39
44
|
},
|
|
40
45
|
"required": ["name"]
|
|
File without changes
|
|
File without changes
|
|
@@ -20,6 +20,7 @@ function transform(options) {
|
|
|
20
20
|
target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
|
|
21
21
|
target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
|
|
22
22
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
23
|
+
target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
|
|
23
24
|
target.path = target.flat
|
|
24
25
|
? target.path
|
|
25
26
|
: (0, core_1.join)(target.path, target.name);
|
|
@@ -28,6 +29,13 @@ function transform(options) {
|
|
|
28
29
|
function generate(options) {
|
|
29
30
|
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
30
31
|
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts')),
|
|
32
|
+
options.spec
|
|
33
|
+
? (0, schematics_1.noop)()
|
|
34
|
+
: (0, schematics_1.filter)((path) => {
|
|
35
|
+
const languageExtension = options.language || 'ts';
|
|
36
|
+
const suffix = `.__specFileSuffix__.${languageExtension}`;
|
|
37
|
+
return !path.endsWith(suffix);
|
|
38
|
+
}),
|
|
31
39
|
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
32
40
|
(0, schematics_1.move)(options.path),
|
|
33
41
|
])(context);
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
"type": "boolean",
|
|
36
36
|
"default": true,
|
|
37
37
|
"description": "Specifies if a spec file is generated."
|
|
38
|
+
},
|
|
39
|
+
"specFileSuffix": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"default": "spec",
|
|
42
|
+
"description": "Specifies the file suffix of spec files."
|
|
38
43
|
}
|
|
39
44
|
},
|
|
40
45
|
"required": ["name"]
|
|
File without changes
|
|
File without changes
|
|
@@ -20,6 +20,7 @@ function transform(options) {
|
|
|
20
20
|
target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
|
|
21
21
|
target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
|
|
22
22
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
23
|
+
target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
|
|
23
24
|
target.path = target.flat
|
|
24
25
|
? target.path
|
|
25
26
|
: (0, core_1.join)(target.path, target.name);
|
|
@@ -27,7 +28,13 @@ function transform(options) {
|
|
|
27
28
|
}
|
|
28
29
|
function generate(options) {
|
|
29
30
|
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
30
|
-
options.spec
|
|
31
|
+
options.spec
|
|
32
|
+
? (0, schematics_1.noop)()
|
|
33
|
+
: (0, schematics_1.filter)((path) => {
|
|
34
|
+
const languageExtension = options.language || 'ts';
|
|
35
|
+
const suffix = `.__specFileSuffix__.${languageExtension}`;
|
|
36
|
+
return !path.endsWith(suffix);
|
|
37
|
+
}),
|
|
31
38
|
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
32
39
|
(0, schematics_1.move)(options.path),
|
|
33
40
|
])(context);
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
"type": "boolean",
|
|
36
36
|
"default": true,
|
|
37
37
|
"description": "Specifies if a spec file is generated."
|
|
38
|
+
},
|
|
39
|
+
"specFileSuffix": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"default": "spec",
|
|
42
|
+
"description": "Specifies the file suffix of spec files."
|
|
38
43
|
}
|
|
39
44
|
},
|
|
40
45
|
"required": ["name"]
|
package/dist/lib/pipe/files/js/{__name__.pipe.spec.js → __name__.pipe.__specFileSuffix__.js}
RENAMED
|
File without changes
|
package/dist/lib/pipe/files/ts/{__name__.pipe.spec.ts → __name__.pipe.__specFileSuffix__.ts}
RENAMED
|
File without changes
|
|
@@ -20,6 +20,7 @@ function transform(options) {
|
|
|
20
20
|
target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
|
|
21
21
|
target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
|
|
22
22
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
23
|
+
target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
|
|
23
24
|
target.path = target.flat
|
|
24
25
|
? target.path
|
|
25
26
|
: (0, core_1.join)(target.path, target.name);
|
|
@@ -28,6 +29,13 @@ function transform(options) {
|
|
|
28
29
|
function generate(options) {
|
|
29
30
|
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
30
31
|
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts')),
|
|
32
|
+
options.spec
|
|
33
|
+
? (0, schematics_1.noop)()
|
|
34
|
+
: (0, schematics_1.filter)((path) => {
|
|
35
|
+
const languageExtension = options.language || 'ts';
|
|
36
|
+
const suffix = `.__specFileSuffix__.${languageExtension}`;
|
|
37
|
+
return !path.endsWith(suffix);
|
|
38
|
+
}),
|
|
31
39
|
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
32
40
|
(0, schematics_1.move)(options.path),
|
|
33
41
|
])(context);
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
"type": "boolean",
|
|
36
36
|
"default": true,
|
|
37
37
|
"description": "Specifies if a spec file is generated."
|
|
38
|
+
},
|
|
39
|
+
"specFileSuffix": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"default": "spec",
|
|
42
|
+
"description": "Specifies the file suffix of spec files."
|
|
38
43
|
}
|
|
39
44
|
},
|
|
40
45
|
"required": ["name"]
|
|
File without changes
|
|
File without changes
|
|
@@ -22,6 +22,7 @@ exports.main = main;
|
|
|
22
22
|
function transform(options) {
|
|
23
23
|
const target = Object.assign({}, options);
|
|
24
24
|
target.metadata = 'providers';
|
|
25
|
+
target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
|
|
25
26
|
if (!target.name) {
|
|
26
27
|
throw new schematics_1.SchematicsException('Option (name) is required.');
|
|
27
28
|
}
|
|
@@ -42,7 +43,13 @@ function transform(options) {
|
|
|
42
43
|
}
|
|
43
44
|
function generate(options) {
|
|
44
45
|
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
45
|
-
options.spec
|
|
46
|
+
options.spec
|
|
47
|
+
? (0, schematics_1.noop)()
|
|
48
|
+
: (0, schematics_1.filter)((path) => {
|
|
49
|
+
const languageExtension = options.language || 'ts';
|
|
50
|
+
const suffix = `.__specFileSuffix__.${languageExtension}`;
|
|
51
|
+
return !path.endsWith(suffix);
|
|
52
|
+
}),
|
|
46
53
|
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
47
54
|
(0, schematics_1.move)(options.path),
|
|
48
55
|
])(context);
|
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
"default": true,
|
|
37
37
|
"description": "Specifies if a spec file is generated."
|
|
38
38
|
},
|
|
39
|
+
"specFileSuffix": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"default": "spec",
|
|
42
|
+
"description": "Specifies the file suffix of spec files."
|
|
43
|
+
},
|
|
39
44
|
"className": {
|
|
40
45
|
"type": "string",
|
|
41
46
|
"description": "Class name to be used internally."
|
|
File without changes
|
|
File without changes
|
|
@@ -26,6 +26,7 @@ function transform(options) {
|
|
|
26
26
|
}
|
|
27
27
|
target.metadata = 'providers';
|
|
28
28
|
target.type = 'resolver';
|
|
29
|
+
target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
|
|
29
30
|
const location = new name_parser_1.NameParser().parse(target);
|
|
30
31
|
target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
|
|
31
32
|
target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
|
|
@@ -37,7 +38,13 @@ function transform(options) {
|
|
|
37
38
|
}
|
|
38
39
|
function generate(options) {
|
|
39
40
|
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
40
|
-
options.spec
|
|
41
|
+
options.spec
|
|
42
|
+
? (0, schematics_1.noop)()
|
|
43
|
+
: (0, schematics_1.filter)((path) => {
|
|
44
|
+
const languageExtension = options.language || 'ts';
|
|
45
|
+
const suffix = `.__specFileSuffix__.${languageExtension}`;
|
|
46
|
+
return !path.endsWith(suffix);
|
|
47
|
+
}),
|
|
41
48
|
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
42
49
|
(0, schematics_1.move)(options.path),
|
|
43
50
|
])(context);
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
"type": "boolean",
|
|
36
36
|
"default": true,
|
|
37
37
|
"description": "Specifies if a spec file is generated."
|
|
38
|
+
},
|
|
39
|
+
"specFileSuffix": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"default": "spec",
|
|
42
|
+
"description": "Specifies the file suffix of spec files."
|
|
38
43
|
}
|
|
39
44
|
},
|
|
40
45
|
"required": ["name"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -37,6 +37,7 @@ function transform(options) {
|
|
|
37
37
|
if (target.language === 'js') {
|
|
38
38
|
throw new Error('The "resource" schematic does not support JavaScript language (only TypeScript is supported).');
|
|
39
39
|
}
|
|
40
|
+
target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
|
|
40
41
|
target.path = target.flat
|
|
41
42
|
? target.path
|
|
42
43
|
: (0, core_1.join)(target.path, target.name);
|
|
@@ -57,7 +58,7 @@ function generate(options) {
|
|
|
57
58
|
options.crud);
|
|
58
59
|
}
|
|
59
60
|
if (path.endsWith('.resolver.ts') ||
|
|
60
|
-
path.endsWith('.resolver.
|
|
61
|
+
path.endsWith('.resolver.__specFileSuffix__.ts')) {
|
|
61
62
|
return (options.type === 'graphql-code-first' ||
|
|
62
63
|
options.type === 'graphql-schema-first');
|
|
63
64
|
}
|
|
@@ -65,10 +66,10 @@ function generate(options) {
|
|
|
65
66
|
return options.type === 'graphql-schema-first' && options.crud;
|
|
66
67
|
}
|
|
67
68
|
if (path.endsWith('controller.ts') ||
|
|
68
|
-
path.endsWith('.controller.
|
|
69
|
+
path.endsWith('.controller.__specFileSuffix__.ts')) {
|
|
69
70
|
return options.type === 'microservice' || options.type === 'rest';
|
|
70
71
|
}
|
|
71
|
-
if (path.endsWith('.gateway.ts') || path.endsWith('.gateway.
|
|
72
|
+
if (path.endsWith('.gateway.ts') || path.endsWith('.gateway.__specFileSuffix__.ts')) {
|
|
72
73
|
return options.type === 'ws';
|
|
73
74
|
}
|
|
74
75
|
if (path.includes('@ent')) {
|
|
@@ -76,7 +77,12 @@ function generate(options) {
|
|
|
76
77
|
}
|
|
77
78
|
return true;
|
|
78
79
|
}),
|
|
79
|
-
options.spec
|
|
80
|
+
options.spec
|
|
81
|
+
? (0, schematics_1.noop)()
|
|
82
|
+
: (0, schematics_1.filter)((path) => {
|
|
83
|
+
const suffix = `.__specFileSuffix__.ts`;
|
|
84
|
+
return !path.endsWith(suffix);
|
|
85
|
+
}),
|
|
80
86
|
(0, schematics_1.template)(Object.assign(Object.assign(Object.assign({}, core_1.strings), options), { lowercased: (name) => {
|
|
81
87
|
const classifiedName = (0, strings_1.classify)(name);
|
|
82
88
|
return (classifiedName.charAt(0).toLowerCase() + classifiedName.slice(1));
|
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
"default": true,
|
|
37
37
|
"description": "Specifies if specs file are generated."
|
|
38
38
|
},
|
|
39
|
+
"specFileSuffix": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"default": "spec",
|
|
42
|
+
"description": "Specifies the file suffix of spec files."
|
|
43
|
+
},
|
|
39
44
|
"type": {
|
|
40
45
|
"type": "string",
|
|
41
46
|
"description": "The transport layer.",
|
|
File without changes
|
|
File without changes
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
"type": "boolean",
|
|
36
36
|
"default": true,
|
|
37
37
|
"description": "Specifies if a spec file is generated."
|
|
38
|
+
},
|
|
39
|
+
"specFileSuffix": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"default": "spec",
|
|
42
|
+
"description": "Specifies the file suffix of spec files."
|
|
38
43
|
}
|
|
39
44
|
},
|
|
40
45
|
"required": ["name"]
|
|
@@ -31,6 +31,7 @@ function transform(source) {
|
|
|
31
31
|
target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
|
|
32
32
|
target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
|
|
33
33
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
34
|
+
target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(source.specFileSuffix || 'spec');
|
|
34
35
|
target.path = target.flat
|
|
35
36
|
? target.path
|
|
36
37
|
: (0, core_1.join)(target.path, target.name);
|
|
@@ -38,7 +39,13 @@ function transform(source) {
|
|
|
38
39
|
}
|
|
39
40
|
function generate(options) {
|
|
40
41
|
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
41
|
-
options.spec
|
|
42
|
+
options.spec
|
|
43
|
+
? (0, schematics_1.noop)()
|
|
44
|
+
: (0, schematics_1.filter)((path) => {
|
|
45
|
+
const languageExtension = options.language || 'ts';
|
|
46
|
+
const suffix = `.__specFileSuffix__.${languageExtension}`;
|
|
47
|
+
return !path.endsWith(suffix);
|
|
48
|
+
}),
|
|
42
49
|
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
43
50
|
(0, schematics_1.move)(options.path),
|
|
44
51
|
])(context);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -26,6 +26,11 @@
|
|
|
26
26
|
"type": "string",
|
|
27
27
|
"format": "path",
|
|
28
28
|
"description": "Applications root directory."
|
|
29
|
+
},
|
|
30
|
+
"specFileSuffix": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"default": "spec",
|
|
33
|
+
"description": "Specifies the file suffix of spec files."
|
|
29
34
|
}
|
|
30
35
|
},
|
|
31
36
|
"required": ["name"]
|
|
@@ -127,12 +127,10 @@ class MetadataManager {
|
|
|
127
127
|
}
|
|
128
128
|
else {
|
|
129
129
|
const text = node.getFullText(source);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
toInsert = `, ${symbol}`;
|
|
135
|
-
}
|
|
130
|
+
const itemSeparator = (text.match(/^\r?\n(\r?)\s+/) ||
|
|
131
|
+
text.match(/^\r?\n/) ||
|
|
132
|
+
' ')[0];
|
|
133
|
+
toInsert = `,${itemSeparator}${symbol}`;
|
|
136
134
|
}
|
|
137
135
|
return this.content.split('').reduce((content, char, index) => {
|
|
138
136
|
if (index === position) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/schematics",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@schematics)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"test": "npm run clean && NODE_ENV=test jest -w 1 --no-cache --config jest.json",
|
|
24
24
|
"test:dev": "NODE_ENV=test npm run -s test -- --watchAll",
|
|
25
25
|
"prerelease": "npm run build",
|
|
26
|
-
"release": "release-it"
|
|
26
|
+
"release": "release-it",
|
|
27
|
+
"prepare": "husky install"
|
|
27
28
|
},
|
|
28
29
|
"repository": {
|
|
29
30
|
"type": "git",
|
|
@@ -40,43 +41,38 @@
|
|
|
40
41
|
},
|
|
41
42
|
"homepage": "https://github.com/nestjs/schematics#readme",
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@angular-devkit/core": "
|
|
44
|
-
"@angular-devkit/schematics": "
|
|
45
|
-
"fs-extra": "10.0
|
|
44
|
+
"@angular-devkit/core": "14.0.5",
|
|
45
|
+
"@angular-devkit/schematics": "14.0.5",
|
|
46
|
+
"fs-extra": "10.1.0",
|
|
46
47
|
"jsonc-parser": "3.0.0",
|
|
47
48
|
"pluralize": "8.0.0"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
|
-
"@commitlint/cli": "
|
|
51
|
-
"@commitlint/config-angular": "
|
|
51
|
+
"@commitlint/cli": "17.0.3",
|
|
52
|
+
"@commitlint/config-angular": "17.0.3",
|
|
52
53
|
"@types/fs-extra": "9.0.13",
|
|
53
|
-
"@types/jest": "
|
|
54
|
-
"@types/node": "16.11.
|
|
55
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
56
|
-
"@typescript-eslint/parser": "5.
|
|
54
|
+
"@types/jest": "28.1.4",
|
|
55
|
+
"@types/node": "16.11.43",
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "5.30.5",
|
|
57
|
+
"@typescript-eslint/parser": "5.30.5",
|
|
57
58
|
"cpx": "1.5.0",
|
|
58
|
-
"eslint": "8.
|
|
59
|
+
"eslint": "8.19.0",
|
|
59
60
|
"eslint-config-prettier": "8.5.0",
|
|
60
61
|
"eslint-plugin-import": "2.26.0",
|
|
61
62
|
"gulp": "4.0.2",
|
|
62
63
|
"gulp-clean": "0.4.0",
|
|
63
|
-
"husky": "
|
|
64
|
-
"jest": "
|
|
64
|
+
"husky": "8.0.1",
|
|
65
|
+
"jest": "28.1.2",
|
|
65
66
|
"nyc": "15.1.0",
|
|
66
|
-
"release-it": "
|
|
67
|
-
"ts-jest": "
|
|
68
|
-
"ts-node": "10.
|
|
69
|
-
"typescript": "4.
|
|
67
|
+
"release-it": "15.1.1",
|
|
68
|
+
"ts-jest": "28.0.5",
|
|
69
|
+
"ts-node": "10.8.2",
|
|
70
|
+
"typescript": "4.7.4"
|
|
70
71
|
},
|
|
71
72
|
"peerDependencies": {
|
|
72
|
-
"typescript": "^
|
|
73
|
+
"typescript": "^4.3.5"
|
|
73
74
|
},
|
|
74
75
|
"schematics": "./dist/collection.json",
|
|
75
|
-
"husky": {
|
|
76
|
-
"hooks": {
|
|
77
|
-
"commit-msg": "commitlint -c .commitlintrc.json -E HUSKY_GIT_PARAMS"
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
76
|
"nyc": {
|
|
81
77
|
"include": [
|
|
82
78
|
"src"
|
|
@@ -97,5 +93,8 @@
|
|
|
97
93
|
],
|
|
98
94
|
"sourceMap": true,
|
|
99
95
|
"instrument": true
|
|
96
|
+
},
|
|
97
|
+
"lint-staged": {
|
|
98
|
+
"**/*.{ts,json}": []
|
|
100
99
|
}
|
|
101
100
|
}
|