@nestjs/schematics 8.0.4 → 8.0.7
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 +34 -17
- package/dist/lib/application/application.factory.js +11 -8
- package/dist/lib/application/files/js/package.json +11 -11
- package/dist/lib/application/files/ts/package.json +1 -1
- package/dist/lib/class/class.factory.js +6 -6
- package/dist/lib/client-app/angular/angular.factory.js +9 -9
- package/dist/lib/configuration/configuration.factory.js +4 -4
- package/dist/lib/controller/controller.factory.js +8 -8
- package/dist/lib/decorator/decorator.factory.js +5 -5
- package/dist/lib/filter/filter.factory.js +6 -6
- package/dist/lib/gateway/gateway.factory.js +8 -8
- package/dist/lib/guard/guard.factory.js +6 -6
- package/dist/lib/interceptor/interceptor.factory.js +6 -6
- package/dist/lib/interface/interface.factory.js +5 -5
- package/dist/lib/library/library.factory.js +19 -18
- package/dist/lib/middleware/middleware.factory.js +6 -6
- package/dist/lib/module/module.factory.js +7 -7
- package/dist/lib/pipe/pipe.factory.js +6 -6
- package/dist/lib/provider/provider.factory.js +8 -8
- package/dist/lib/resolver/resolver.factory.js +8 -8
- package/dist/lib/resource/resource.factory.js +13 -13
- package/dist/lib/service/service.factory.js +9 -9
- package/dist/lib/sub-app/sub-app.factory.js +28 -27
- package/dist/utils/json-file.util.js +7 -7
- package/dist/utils/metadata.manager.js +1 -1
- package/dist/utils/module-import.declarator.js +2 -2
- package/dist/utils/module.declarator.js +2 -2
- package/dist/utils/module.finder.js +1 -1
- package/dist/utils/name.parser.js +3 -3
- package/dist/utils/path.solver.js +2 -2
- package/dist/utils/source-root.helpers.js +2 -2
- package/package.json +19 -19
package/dist/collection.json
CHANGED
|
@@ -14,37 +14,44 @@
|
|
|
14
14
|
"class": {
|
|
15
15
|
"factory": "./lib/class/class.factory#main",
|
|
16
16
|
"description": "Create a new class.",
|
|
17
|
-
"schema": "./lib/class/schema.json"
|
|
17
|
+
"schema": "./lib/class/schema.json",
|
|
18
|
+
"aliases": ["cl"]
|
|
18
19
|
},
|
|
19
20
|
"controller": {
|
|
20
21
|
"factory": "./lib/controller/controller.factory#main",
|
|
21
22
|
"description": "Create a Nest controller.",
|
|
22
|
-
"schema": "./lib/controller/schema.json"
|
|
23
|
+
"schema": "./lib/controller/schema.json",
|
|
24
|
+
"aliases": ["co"]
|
|
23
25
|
},
|
|
24
26
|
"decorator": {
|
|
25
27
|
"factory": "./lib/decorator/decorator.factory#main",
|
|
26
28
|
"description": "Create a Nest decorator.",
|
|
27
|
-
"schema": "./lib/decorator/schema.json"
|
|
29
|
+
"schema": "./lib/decorator/schema.json",
|
|
30
|
+
"aliases": ["d"]
|
|
28
31
|
},
|
|
29
32
|
"filter": {
|
|
30
33
|
"factory": "./lib/filter/filter.factory#main",
|
|
31
34
|
"description": "Create a Nest filter.",
|
|
32
|
-
"schema": "./lib/filter/schema.json"
|
|
35
|
+
"schema": "./lib/filter/schema.json",
|
|
36
|
+
"aliases": ["f"]
|
|
33
37
|
},
|
|
34
38
|
"gateway": {
|
|
35
39
|
"factory": "./lib/gateway/gateway.factory#main",
|
|
36
40
|
"description": "Create a Nest gateway.",
|
|
37
|
-
"schema": "./lib/gateway/schema.json"
|
|
41
|
+
"schema": "./lib/gateway/schema.json",
|
|
42
|
+
"aliases": ["ga"]
|
|
38
43
|
},
|
|
39
44
|
"guard": {
|
|
40
45
|
"factory": "./lib/guard/guard.factory#main",
|
|
41
46
|
"description": "Create a Nest guard.",
|
|
42
|
-
"schema": "./lib/guard/schema.json"
|
|
47
|
+
"schema": "./lib/guard/schema.json",
|
|
48
|
+
"aliases": ["gu"]
|
|
43
49
|
},
|
|
44
50
|
"interceptor": {
|
|
45
51
|
"factory": "./lib/interceptor/interceptor.factory#main",
|
|
46
52
|
"description": "Create a Nest interceptor.",
|
|
47
|
-
"schema": "./lib/interceptor/schema.json"
|
|
53
|
+
"schema": "./lib/interceptor/schema.json",
|
|
54
|
+
"aliases": ["in"]
|
|
48
55
|
},
|
|
49
56
|
"interface": {
|
|
50
57
|
"factory": "./lib/interface/interface.factory#main",
|
|
@@ -54,51 +61,61 @@
|
|
|
54
61
|
"middleware": {
|
|
55
62
|
"factory": "./lib/middleware/middleware.factory#main",
|
|
56
63
|
"description": "Create a Nest middleware.",
|
|
57
|
-
"schema": "./lib/middleware/schema.json"
|
|
64
|
+
"schema": "./lib/middleware/schema.json",
|
|
65
|
+
"aliases": ["mi"]
|
|
58
66
|
},
|
|
59
67
|
"module": {
|
|
60
68
|
"factory": "./lib/module/module.factory#main",
|
|
61
69
|
"description": "Create a Nest module.",
|
|
62
|
-
"schema": "./lib/module/schema.json"
|
|
70
|
+
"schema": "./lib/module/schema.json",
|
|
71
|
+
"aliases": ["mo"]
|
|
63
72
|
},
|
|
64
73
|
"pipe": {
|
|
65
74
|
"factory": "./lib/pipe/pipe.factory#main",
|
|
66
75
|
"description": "Create a Nest pipe.",
|
|
67
|
-
"schema": "./lib/pipe/schema.json"
|
|
76
|
+
"schema": "./lib/pipe/schema.json",
|
|
77
|
+
"aliases": ["pi"]
|
|
68
78
|
},
|
|
69
79
|
"provider": {
|
|
70
80
|
"factory": "./lib/provider/provider.factory#main",
|
|
71
81
|
"description": "Create a Nest provider.",
|
|
72
|
-
"schema": "./lib/provider/schema.json"
|
|
82
|
+
"schema": "./lib/provider/schema.json",
|
|
83
|
+
"aliases": ["pr"]
|
|
73
84
|
},
|
|
74
85
|
"service": {
|
|
75
86
|
"factory": "./lib/service/service.factory#main",
|
|
76
87
|
"description": "Create a Nest service.",
|
|
77
|
-
"schema": "./lib/service/schema.json"
|
|
88
|
+
"schema": "./lib/service/schema.json",
|
|
89
|
+
"aliases": ["s"]
|
|
78
90
|
},
|
|
79
91
|
"resolver": {
|
|
80
92
|
"factory": "./lib/resolver/resolver.factory#main",
|
|
81
93
|
"description": "Create a Nest resolver.",
|
|
82
|
-
"schema": "./lib/resolver/schema.json"
|
|
94
|
+
"schema": "./lib/resolver/schema.json",
|
|
95
|
+
"aliases": ["r"]
|
|
83
96
|
},
|
|
84
97
|
"configuration": {
|
|
85
98
|
"factory": "./lib/configuration/configuration.factory#main",
|
|
86
|
-
"description": "Create a Nest CLI configuration."
|
|
99
|
+
"description": "Create a Nest CLI configuration.",
|
|
100
|
+
"aliases": ["config"]
|
|
87
101
|
},
|
|
88
102
|
"library": {
|
|
89
103
|
"factory": "./lib/library/library.factory#main",
|
|
90
104
|
"description": "Create a Nest library (mono-repo).",
|
|
91
|
-
"schema": "./lib/library/schema.json"
|
|
105
|
+
"schema": "./lib/library/schema.json",
|
|
106
|
+
"aliases": ["lib"]
|
|
92
107
|
},
|
|
93
108
|
"sub-app": {
|
|
94
109
|
"factory": "./lib/sub-app/sub-app.factory#main",
|
|
95
110
|
"description": "Create a Nest application (mono-repo).",
|
|
96
|
-
"schema": "./lib/sub-app/schema.json"
|
|
111
|
+
"schema": "./lib/sub-app/schema.json",
|
|
112
|
+
"aliases": ["app"]
|
|
97
113
|
},
|
|
98
114
|
"resource": {
|
|
99
115
|
"factory": "./lib/resource/resource.factory#main",
|
|
100
116
|
"description": "Create a Nest resource.",
|
|
101
|
-
"schema": "./lib/resource/schema.json"
|
|
117
|
+
"schema": "./lib/resource/schema.json",
|
|
118
|
+
"aliases": ["res"]
|
|
102
119
|
}
|
|
103
120
|
}
|
|
104
121
|
}
|
|
@@ -11,7 +11,7 @@ function main(options) {
|
|
|
11
11
|
? options.name
|
|
12
12
|
: options.directory;
|
|
13
13
|
options = transform(options);
|
|
14
|
-
return schematics_1.mergeWith(generate(options, path));
|
|
14
|
+
return (0, schematics_1.mergeWith)(generate(options, path));
|
|
15
15
|
}
|
|
16
16
|
exports.main = main;
|
|
17
17
|
function transform(options) {
|
|
@@ -34,15 +34,18 @@ function transform(options) {
|
|
|
34
34
|
return target;
|
|
35
35
|
}
|
|
36
36
|
function resolvePackageName(path) {
|
|
37
|
-
const {
|
|
38
|
-
if (
|
|
39
|
-
return path_1.basename(process.cwd());
|
|
37
|
+
const { base: baseFilename, dir: dirname } = (0, path_1.parse)(path);
|
|
38
|
+
if (baseFilename === '.') {
|
|
39
|
+
return (0, path_1.basename)(process.cwd());
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
if (dirname.match(/^@[^\s]/)) {
|
|
42
|
+
return `${dirname}/${baseFilename}`;
|
|
43
|
+
}
|
|
44
|
+
return baseFilename;
|
|
42
45
|
}
|
|
43
46
|
function generate(options, path) {
|
|
44
|
-
return schematics_1.apply(schematics_1.url(core_1.join('./files', options.language)), [
|
|
45
|
-
schematics_1.template(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
46
|
-
schematics_1.move(path),
|
|
47
|
+
return (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
48
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
49
|
+
(0, schematics_1.move)(path),
|
|
47
50
|
]);
|
|
48
51
|
}
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@nestjs/testing": "^8.0.0",
|
|
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": "27.
|
|
33
|
-
"nodemon": "2.0.
|
|
34
|
-
"prettier": "2.
|
|
35
|
-
"supertest": "6.
|
|
25
|
+
"@babel/core": "7.17.5",
|
|
26
|
+
"@babel/node": "7.16.8",
|
|
27
|
+
"@babel/plugin-proposal-decorators": "7.17.2",
|
|
28
|
+
"@babel/plugin-transform-runtime": "7.17.0",
|
|
29
|
+
"@babel/preset-env": "7.16.11",
|
|
30
|
+
"@babel/register": "7.17.0",
|
|
31
|
+
"@babel/runtime": "7.17.2",
|
|
32
|
+
"jest": "27.5.1",
|
|
33
|
+
"nodemon": "2.0.15",
|
|
34
|
+
"prettier": "2.5.1",
|
|
35
|
+
"supertest": "6.2.2"
|
|
36
36
|
},
|
|
37
37
|
"jest": {
|
|
38
38
|
"moduleFileExtensions": [
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@nestjs/schematics": "^8.0.0",
|
|
34
34
|
"@nestjs/testing": "^8.0.0",
|
|
35
35
|
"@types/express": "^4.17.13",
|
|
36
|
-
"@types/jest": "
|
|
36
|
+
"@types/jest": "27.4.1",
|
|
37
37
|
"@types/node": "^16.0.0",
|
|
38
38
|
"@types/supertest": "^2.0.11",
|
|
39
39
|
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
@@ -8,7 +8,7 @@ const source_root_helpers_1 = require("../../utils/source-root.helpers");
|
|
|
8
8
|
const defaults_1 = require("../defaults");
|
|
9
9
|
function main(options) {
|
|
10
10
|
options = transform(options);
|
|
11
|
-
return schematics_1.chain([source_root_helpers_1.mergeSourceRoot(options), schematics_1.mergeWith(generate(options))]);
|
|
11
|
+
return (0, schematics_1.chain)([(0, source_root_helpers_1.mergeSourceRoot)(options), (0, schematics_1.mergeWith)(generate(options))]);
|
|
12
12
|
}
|
|
13
13
|
exports.main = main;
|
|
14
14
|
function transform(options) {
|
|
@@ -29,13 +29,13 @@ function transform(options) {
|
|
|
29
29
|
target.path = core_1.strings.dasherize(location.path);
|
|
30
30
|
target.path = target.flat
|
|
31
31
|
? target.path
|
|
32
|
-
: core_1.join(target.path, target.name);
|
|
32
|
+
: (0, core_1.join)(target.path, target.name);
|
|
33
33
|
return target;
|
|
34
34
|
}
|
|
35
35
|
function generate(options) {
|
|
36
|
-
return (context) => schematics_1.apply(schematics_1.url(core_1.join('./files', options.language)), [
|
|
37
|
-
options.spec ? schematics_1.noop() : schematics_1.filter(path => !path.endsWith('.spec.ts')),
|
|
38
|
-
schematics_1.template(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
39
|
-
schematics_1.move(options.path),
|
|
36
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
37
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)(path => !path.endsWith('.spec.ts')),
|
|
38
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
39
|
+
(0, schematics_1.move)(options.path),
|
|
40
40
|
])(context);
|
|
41
41
|
}
|
|
@@ -11,12 +11,12 @@ const source_root_helpers_1 = require("../../../utils/source-root.helpers");
|
|
|
11
11
|
function main(options) {
|
|
12
12
|
options = transform(options);
|
|
13
13
|
return (tree, context) => {
|
|
14
|
-
return schematics_1.branchAndMerge(schematics_1.chain([
|
|
14
|
+
return (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
|
|
15
15
|
createAngularApplication(options),
|
|
16
|
-
source_root_helpers_1.mergeSourceRoot(options),
|
|
16
|
+
(0, source_root_helpers_1.mergeSourceRoot)(options),
|
|
17
17
|
addDeclarationToModule(options),
|
|
18
18
|
addGlobalPrefix(),
|
|
19
|
-
schematics_1.mergeWith(generate(options)),
|
|
19
|
+
(0, schematics_1.mergeWith)(generate(options)),
|
|
20
20
|
]))(tree, context);
|
|
21
21
|
};
|
|
22
22
|
}
|
|
@@ -29,20 +29,20 @@ function transform(source) {
|
|
|
29
29
|
target.type = 'module';
|
|
30
30
|
const location = new name_parser_1.NameParser().parse(target);
|
|
31
31
|
target.name = core_1.strings.dasherize(location.name);
|
|
32
|
-
target.path = path_1.join(core_1.strings.dasherize(location.path), target.name);
|
|
32
|
+
target.path = (0, path_1.join)(core_1.strings.dasherize(location.path), target.name);
|
|
33
33
|
return target;
|
|
34
34
|
}
|
|
35
35
|
function generate(options) {
|
|
36
|
-
return (context) => schematics_1.apply(schematics_1.url('./files'), [
|
|
37
|
-
schematics_1.template(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
38
|
-
schematics_1.move(options.path),
|
|
36
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
37
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
38
|
+
(0, schematics_1.move)(options.path),
|
|
39
39
|
])(context);
|
|
40
40
|
}
|
|
41
41
|
function createAngularApplication(options) {
|
|
42
42
|
if (!options.initApp) {
|
|
43
|
-
return schematics_1.noop();
|
|
43
|
+
return (0, schematics_1.noop)();
|
|
44
44
|
}
|
|
45
|
-
return schematics_1.externalSchematic('@schematics/angular', 'ng-new', {
|
|
45
|
+
return (0, schematics_1.externalSchematic)('@schematics/angular', 'ng-new', {
|
|
46
46
|
name: options.directory,
|
|
47
47
|
version: '8.0.0',
|
|
48
48
|
});
|
|
@@ -5,7 +5,7 @@ const core_1 = require("@angular-devkit/core");
|
|
|
5
5
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
6
|
const defaults_1 = require("../defaults");
|
|
7
7
|
function main(options) {
|
|
8
|
-
return schematics_1.mergeWith(generate(transform(options)));
|
|
8
|
+
return (0, schematics_1.mergeWith)(generate(transform(options)));
|
|
9
9
|
}
|
|
10
10
|
exports.main = main;
|
|
11
11
|
function transform(options) {
|
|
@@ -17,8 +17,8 @@ function transform(options) {
|
|
|
17
17
|
return target;
|
|
18
18
|
}
|
|
19
19
|
function generate(options) {
|
|
20
|
-
return schematics_1.apply(schematics_1.url(core_1.join('./files', options.language)), [
|
|
21
|
-
schematics_1.template(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
22
|
-
schematics_1.move(options.project),
|
|
20
|
+
return (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
21
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
22
|
+
(0, schematics_1.move)(options.project),
|
|
23
23
|
]);
|
|
24
24
|
}
|
|
@@ -13,9 +13,9 @@ const ELEMENT_TYPE = 'controller';
|
|
|
13
13
|
function main(options) {
|
|
14
14
|
options = transform(options);
|
|
15
15
|
return (tree, context) => {
|
|
16
|
-
return schematics_1.branchAndMerge(schematics_1.chain([
|
|
17
|
-
source_root_helpers_1.mergeSourceRoot(options),
|
|
18
|
-
schematics_1.mergeWith(generate(options)),
|
|
16
|
+
return (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
|
|
17
|
+
(0, source_root_helpers_1.mergeSourceRoot)(options),
|
|
18
|
+
(0, schematics_1.mergeWith)(generate(options)),
|
|
19
19
|
addDeclarationToModule(options),
|
|
20
20
|
]))(tree, context);
|
|
21
21
|
};
|
|
@@ -32,14 +32,14 @@ function transform(source) {
|
|
|
32
32
|
target.language !== undefined ? target.language : defaults_1.DEFAULT_LANGUAGE;
|
|
33
33
|
target.path = target.flat
|
|
34
34
|
? target.path
|
|
35
|
-
: core_1.join(target.path, target.name);
|
|
35
|
+
: (0, core_1.join)(target.path, target.name);
|
|
36
36
|
return target;
|
|
37
37
|
}
|
|
38
38
|
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),
|
|
39
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
40
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)(path => !path.endsWith('.spec.ts')),
|
|
41
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
42
|
+
(0, schematics_1.move)(options.path),
|
|
43
43
|
])(context);
|
|
44
44
|
}
|
|
45
45
|
function addDeclarationToModule(options) {
|
|
@@ -7,7 +7,7 @@ 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
12
|
exports.main = main;
|
|
13
13
|
function transform(options) {
|
|
@@ -21,12 +21,12 @@ function transform(options) {
|
|
|
21
21
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
22
22
|
target.path = target.flat
|
|
23
23
|
? target.path
|
|
24
|
-
: core_1.join(target.path, target.name);
|
|
24
|
+
: (0, core_1.join)(target.path, target.name);
|
|
25
25
|
return target;
|
|
26
26
|
}
|
|
27
27
|
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),
|
|
28
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
29
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
30
|
+
(0, schematics_1.move)(options.path),
|
|
31
31
|
])(context);
|
|
32
32
|
}
|
|
@@ -7,7 +7,7 @@ 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
12
|
exports.main = main;
|
|
13
13
|
function transform(options) {
|
|
@@ -21,13 +21,13 @@ function transform(options) {
|
|
|
21
21
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
22
22
|
target.path = target.flat
|
|
23
23
|
? target.path
|
|
24
|
-
: core_1.join(target.path, target.name);
|
|
24
|
+
: (0, core_1.join)(target.path, target.name);
|
|
25
25
|
return target;
|
|
26
26
|
}
|
|
27
27
|
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),
|
|
28
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
29
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)(path => !path.endsWith('.spec.ts')),
|
|
30
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
31
|
+
(0, schematics_1.move)(options.path),
|
|
32
32
|
])(context);
|
|
33
33
|
}
|
|
@@ -10,10 +10,10 @@ 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
|
}
|
|
@@ -31,14 +31,14 @@ function transform(options) {
|
|
|
31
31
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
32
32
|
target.path = target.flat
|
|
33
33
|
? target.path
|
|
34
|
-
: core_1.join(target.path, target.name);
|
|
34
|
+
: (0, core_1.join)(target.path, target.name);
|
|
35
35
|
return target;
|
|
36
36
|
}
|
|
37
37
|
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),
|
|
38
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
39
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)(path => !path.endsWith('.spec.ts')),
|
|
40
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
41
|
+
(0, schematics_1.move)(options.path),
|
|
42
42
|
])(context);
|
|
43
43
|
}
|
|
44
44
|
function addDeclarationToModule(options) {
|
|
@@ -7,7 +7,7 @@ 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
12
|
exports.main = main;
|
|
13
13
|
function transform(options) {
|
|
@@ -21,13 +21,13 @@ function transform(options) {
|
|
|
21
21
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
22
22
|
target.path = target.flat
|
|
23
23
|
? target.path
|
|
24
|
-
: core_1.join(target.path, target.name);
|
|
24
|
+
: (0, core_1.join)(target.path, target.name);
|
|
25
25
|
return target;
|
|
26
26
|
}
|
|
27
27
|
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),
|
|
28
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
29
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts')),
|
|
30
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
31
|
+
(0, schematics_1.move)(options.path),
|
|
32
32
|
])(context);
|
|
33
33
|
}
|
|
@@ -7,7 +7,7 @@ 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
12
|
exports.main = main;
|
|
13
13
|
function transform(options) {
|
|
@@ -21,13 +21,13 @@ function transform(options) {
|
|
|
21
21
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
22
22
|
target.path = target.flat
|
|
23
23
|
? target.path
|
|
24
|
-
: core_1.join(target.path, target.name);
|
|
24
|
+
: (0, core_1.join)(target.path, target.name);
|
|
25
25
|
return target;
|
|
26
26
|
}
|
|
27
27
|
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),
|
|
28
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
29
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)(path => !path.endsWith('.spec.ts')),
|
|
30
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
31
|
+
(0, schematics_1.move)(options.path),
|
|
32
32
|
])(context);
|
|
33
33
|
}
|
|
@@ -7,7 +7,7 @@ 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
12
|
exports.main = main;
|
|
13
13
|
function transform(options) {
|
|
@@ -20,12 +20,12 @@ function transform(options) {
|
|
|
20
20
|
target.path = core_1.strings.dasherize(location.path);
|
|
21
21
|
target.path = target.flat
|
|
22
22
|
? target.path
|
|
23
|
-
: core_1.join(target.path, target.name);
|
|
23
|
+
: (0, core_1.join)(target.path, target.name);
|
|
24
24
|
return target;
|
|
25
25
|
}
|
|
26
26
|
function generate(options) {
|
|
27
|
-
return (context) => schematics_1.apply(schematics_1.url('./files'), [
|
|
28
|
-
schematics_1.template(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
29
|
-
schematics_1.move(options.path),
|
|
27
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
28
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
29
|
+
(0, schematics_1.move)(options.path),
|
|
30
30
|
])(context);
|
|
31
31
|
}
|
|
@@ -3,15 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.main = void 0;
|
|
4
4
|
const core_1 = require("@angular-devkit/core");
|
|
5
5
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
const jsonc_parser_1 = require("jsonc-parser");
|
|
6
7
|
const defaults_1 = require("../defaults");
|
|
7
8
|
function main(options) {
|
|
8
9
|
options = transform(options);
|
|
9
|
-
return schematics_1.chain([
|
|
10
|
+
return (0, schematics_1.chain)([
|
|
10
11
|
addLibraryToCliOptions(options.path, options.name),
|
|
11
12
|
updatePackageJson(options),
|
|
12
13
|
updateJestEndToEnd(options),
|
|
13
14
|
updateTsConfig(options.name, options.prefix, options.path),
|
|
14
|
-
schematics_1.branchAndMerge(schematics_1.mergeWith(generate(options))),
|
|
15
|
+
(0, schematics_1.branchAndMerge)((0, schematics_1.mergeWith)(generate(options))),
|
|
15
16
|
]);
|
|
16
17
|
}
|
|
17
18
|
exports.main = main;
|
|
@@ -25,8 +26,8 @@ function transform(options) {
|
|
|
25
26
|
target.name = core_1.strings.dasherize(target.name);
|
|
26
27
|
target.path =
|
|
27
28
|
target.path !== undefined
|
|
28
|
-
? core_1.join(core_1.normalize(defaultSourceRoot), target.path)
|
|
29
|
-
: core_1.normalize(defaultSourceRoot);
|
|
29
|
+
? (0, core_1.join)((0, core_1.normalize)(defaultSourceRoot), target.path)
|
|
30
|
+
: (0, core_1.normalize)(defaultSourceRoot);
|
|
30
31
|
target.prefix = target.prefix || '@app';
|
|
31
32
|
return target;
|
|
32
33
|
}
|
|
@@ -35,7 +36,7 @@ function updatePackageJson(options) {
|
|
|
35
36
|
if (!host.exists('package.json')) {
|
|
36
37
|
return host;
|
|
37
38
|
}
|
|
38
|
-
const distRoot = core_1.join(options.path, options.name, 'src');
|
|
39
|
+
const distRoot = (0, core_1.join)(options.path, options.name, 'src');
|
|
39
40
|
const packageKey = options.prefix
|
|
40
41
|
? options.prefix + '/' + options.name
|
|
41
42
|
: options.name;
|
|
@@ -65,8 +66,8 @@ function updateJestConfig(jestOptions, options, packageKey, distRoot) {
|
|
|
65
66
|
jestOptions.moduleNameMapper = {};
|
|
66
67
|
}
|
|
67
68
|
const packageKeyRegex = '^' + packageKey + '(|/.*)$';
|
|
68
|
-
const packageRoot = core_1.join('<rootDir>', distRoot);
|
|
69
|
-
jestOptions.moduleNameMapper[packageKeyRegex] = core_1.join(packageRoot, '$1');
|
|
69
|
+
const packageRoot = (0, core_1.join)('<rootDir>', distRoot);
|
|
70
|
+
jestOptions.moduleNameMapper[packageKeyRegex] = (0, core_1.join)(packageRoot, '$1');
|
|
70
71
|
}
|
|
71
72
|
function updateNpmScripts(scripts, options) {
|
|
72
73
|
if (!scripts) {
|
|
@@ -84,11 +85,11 @@ function updateNpmScripts(scripts, options) {
|
|
|
84
85
|
}
|
|
85
86
|
function updateJestEndToEnd(options) {
|
|
86
87
|
return (host) => {
|
|
87
|
-
const pathToFile = core_1.join('test', 'jest-e2e.json');
|
|
88
|
+
const pathToFile = (0, core_1.join)('test', 'jest-e2e.json');
|
|
88
89
|
if (!host.exists(pathToFile)) {
|
|
89
90
|
return host;
|
|
90
91
|
}
|
|
91
|
-
const distRoot = core_1.join(options.path, options.name, 'src');
|
|
92
|
+
const distRoot = (0, core_1.join)(options.path, options.name, 'src');
|
|
92
93
|
const packageKey = options.prefix
|
|
93
94
|
? options.prefix + '/' + options.name
|
|
94
95
|
: options.name;
|
|
@@ -107,7 +108,7 @@ function updateJsonFile(host, path, callback) {
|
|
|
107
108
|
const source = host.read(path);
|
|
108
109
|
if (source) {
|
|
109
110
|
const sourceText = source.toString('utf-8');
|
|
110
|
-
const json =
|
|
111
|
+
const json = (0, jsonc_parser_1.parse)(sourceText);
|
|
111
112
|
callback(json);
|
|
112
113
|
host.overwrite(path, JSON.stringify(json, null, 2));
|
|
113
114
|
}
|
|
@@ -118,7 +119,7 @@ function updateTsConfig(packageName, packagePrefix, root) {
|
|
|
118
119
|
if (!host.exists('tsconfig.json')) {
|
|
119
120
|
return host;
|
|
120
121
|
}
|
|
121
|
-
const distRoot = core_1.join(root, packageName, 'src');
|
|
122
|
+
const distRoot = (0, core_1.join)(root, packageName, 'src');
|
|
122
123
|
const packageKey = packagePrefix
|
|
123
124
|
? packagePrefix + '/' + packageName
|
|
124
125
|
: packageName;
|
|
@@ -145,14 +146,14 @@ function updateTsConfig(packageName, packagePrefix, root) {
|
|
|
145
146
|
};
|
|
146
147
|
}
|
|
147
148
|
function addLibraryToCliOptions(projectRoot, projectName) {
|
|
148
|
-
const rootPath = core_1.join(projectRoot, projectName);
|
|
149
|
+
const rootPath = (0, core_1.join)(projectRoot, projectName);
|
|
149
150
|
const project = {
|
|
150
151
|
type: defaults_1.PROJECT_TYPE.LIBRARY,
|
|
151
152
|
root: rootPath,
|
|
152
153
|
entryFile: 'index',
|
|
153
|
-
sourceRoot: core_1.join(rootPath, 'src'),
|
|
154
|
+
sourceRoot: (0, core_1.join)(rootPath, 'src'),
|
|
154
155
|
compilerOptions: {
|
|
155
|
-
tsConfigPath: core_1.join(rootPath, 'tsconfig.lib.json'),
|
|
156
|
+
tsConfigPath: (0, core_1.join)(rootPath, 'tsconfig.lib.json'),
|
|
156
157
|
},
|
|
157
158
|
};
|
|
158
159
|
return (host) => {
|
|
@@ -180,9 +181,9 @@ function addLibraryToCliOptions(projectRoot, projectName) {
|
|
|
180
181
|
};
|
|
181
182
|
}
|
|
182
183
|
function generate(options) {
|
|
183
|
-
const path = core_1.join(options.path, options.name);
|
|
184
|
-
return schematics_1.apply(schematics_1.url(core_1.join('./files', options.language)), [
|
|
185
|
-
schematics_1.template(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
186
|
-
schematics_1.move(path),
|
|
184
|
+
const path = (0, core_1.join)(options.path, options.name);
|
|
185
|
+
return (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
186
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
187
|
+
(0, schematics_1.move)(path),
|
|
187
188
|
]);
|
|
188
189
|
}
|
|
@@ -7,7 +7,7 @@ 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
12
|
exports.main = main;
|
|
13
13
|
function transform(options) {
|
|
@@ -21,13 +21,13 @@ function transform(options) {
|
|
|
21
21
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
22
22
|
target.path = target.flat
|
|
23
23
|
? target.path
|
|
24
|
-
: core_1.join(target.path, target.name);
|
|
24
|
+
: (0, core_1.join)(target.path, target.name);
|
|
25
25
|
return target;
|
|
26
26
|
}
|
|
27
27
|
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),
|
|
28
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
29
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)(path => !path.endsWith('.spec.ts')),
|
|
30
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
31
|
+
(0, schematics_1.move)(options.path),
|
|
32
32
|
])(context);
|
|
33
33
|
}
|
|
@@ -10,10 +10,10 @@ 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
|
}
|
|
@@ -28,13 +28,13 @@ function transform(source) {
|
|
|
28
28
|
target.path = core_1.strings.dasherize(location.path);
|
|
29
29
|
target.path = target.flat
|
|
30
30
|
? target.path
|
|
31
|
-
: core_1.join(target.path, target.name);
|
|
31
|
+
: (0, core_1.join)(target.path, target.name);
|
|
32
32
|
return target;
|
|
33
33
|
}
|
|
34
34
|
function generate(options) {
|
|
35
|
-
return (context) => schematics_1.apply(schematics_1.url(core_1.join('./files', options.language)), [
|
|
36
|
-
schematics_1.template(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
37
|
-
schematics_1.move(options.path),
|
|
35
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
36
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
37
|
+
(0, schematics_1.move)(options.path),
|
|
38
38
|
])(context);
|
|
39
39
|
}
|
|
40
40
|
function addDeclarationToModule(options) {
|
|
@@ -7,7 +7,7 @@ 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
12
|
exports.main = main;
|
|
13
13
|
function transform(options) {
|
|
@@ -21,13 +21,13 @@ function transform(options) {
|
|
|
21
21
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
22
22
|
target.path = target.flat
|
|
23
23
|
? target.path
|
|
24
|
-
: core_1.join(target.path, target.name);
|
|
24
|
+
: (0, core_1.join)(target.path, target.name);
|
|
25
25
|
return target;
|
|
26
26
|
}
|
|
27
27
|
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),
|
|
28
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
29
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)(path => !path.endsWith('.spec.ts')),
|
|
30
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
31
|
+
(0, schematics_1.move)(options.path),
|
|
32
32
|
])(context);
|
|
33
33
|
}
|
|
@@ -10,10 +10,10 @@ 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
|
}
|
|
@@ -36,14 +36,14 @@ function transform(options) {
|
|
|
36
36
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
37
37
|
target.path = target.flat
|
|
38
38
|
? target.path
|
|
39
|
-
: core_1.join(target.path, target.name);
|
|
39
|
+
: (0, core_1.join)(target.path, target.name);
|
|
40
40
|
return target;
|
|
41
41
|
}
|
|
42
42
|
function generate(options) {
|
|
43
|
-
return (context) => schematics_1.apply(schematics_1.url(core_1.join('./files', options.language)), [
|
|
44
|
-
options.spec ? schematics_1.noop() : schematics_1.filter((path) => !path.endsWith('.spec.ts')),
|
|
45
|
-
schematics_1.template(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
46
|
-
schematics_1.move(options.path),
|
|
43
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
44
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts')),
|
|
45
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
46
|
+
(0, schematics_1.move)(options.path),
|
|
47
47
|
])(context);
|
|
48
48
|
}
|
|
49
49
|
function addDeclarationToModule(options) {
|
|
@@ -10,10 +10,10 @@ 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
|
}
|
|
@@ -31,14 +31,14 @@ function transform(options) {
|
|
|
31
31
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
32
32
|
target.path = target.flat
|
|
33
33
|
? target.path
|
|
34
|
-
: core_1.join(target.path, target.name);
|
|
34
|
+
: (0, core_1.join)(target.path, target.name);
|
|
35
35
|
return target;
|
|
36
36
|
}
|
|
37
37
|
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),
|
|
38
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
39
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)(path => !path.endsWith('.spec.ts')),
|
|
40
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
41
|
+
(0, schematics_1.move)(options.path),
|
|
42
42
|
])(context);
|
|
43
43
|
}
|
|
44
44
|
function addDeclarationToModule(options) {
|
|
@@ -13,11 +13,11 @@ const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
|
13
13
|
function main(options) {
|
|
14
14
|
options = transform(options);
|
|
15
15
|
return (tree, context) => {
|
|
16
|
-
return schematics_1.branchAndMerge(schematics_1.chain([
|
|
16
|
+
return (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
|
|
17
17
|
addMappedTypesDependencyIfApplies(options),
|
|
18
|
-
source_root_helpers_1.mergeSourceRoot(options),
|
|
18
|
+
(0, source_root_helpers_1.mergeSourceRoot)(options),
|
|
19
19
|
addDeclarationToModule(options),
|
|
20
|
-
schematics_1.mergeWith(generate(options)),
|
|
20
|
+
(0, schematics_1.mergeWith)(generate(options)),
|
|
21
21
|
]))(tree, context);
|
|
22
22
|
};
|
|
23
23
|
}
|
|
@@ -38,13 +38,13 @@ function transform(options) {
|
|
|
38
38
|
}
|
|
39
39
|
target.path = target.flat
|
|
40
40
|
? target.path
|
|
41
|
-
: core_1.join(target.path, target.name);
|
|
41
|
+
: (0, core_1.join)(target.path, target.name);
|
|
42
42
|
target.isSwaggerInstalled = (_a = options.isSwaggerInstalled) !== null && _a !== void 0 ? _a : false;
|
|
43
43
|
return target;
|
|
44
44
|
}
|
|
45
45
|
function generate(options) {
|
|
46
|
-
return (context) => schematics_1.apply(schematics_1.url(core_1.join('./files', options.language)), [
|
|
47
|
-
schematics_1.filter((path) => {
|
|
46
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
47
|
+
(0, schematics_1.filter)((path) => {
|
|
48
48
|
if (path.endsWith('.dto.ts')) {
|
|
49
49
|
return (options.type !== 'graphql-code-first' &&
|
|
50
50
|
options.type !== 'graphql-schema-first' &&
|
|
@@ -75,12 +75,12 @@ function generate(options) {
|
|
|
75
75
|
}
|
|
76
76
|
return true;
|
|
77
77
|
}),
|
|
78
|
-
options.spec ? schematics_1.noop() : schematics_1.filter((path) => !path.endsWith('.spec.ts')),
|
|
79
|
-
schematics_1.template(Object.assign(Object.assign(Object.assign({}, core_1.strings), options), { lowercased: (name) => {
|
|
80
|
-
const classifiedName = strings_1.classify(name);
|
|
78
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts')),
|
|
79
|
+
(0, schematics_1.template)(Object.assign(Object.assign(Object.assign({}, core_1.strings), options), { lowercased: (name) => {
|
|
80
|
+
const classifiedName = (0, strings_1.classify)(name);
|
|
81
81
|
return (classifiedName.charAt(0).toLowerCase() + classifiedName.slice(1));
|
|
82
82
|
}, singular: (name) => pluralize.singular(name), ent: (name) => name + '.entity' })),
|
|
83
|
-
schematics_1.move(options.path),
|
|
83
|
+
(0, schematics_1.move)(options.path),
|
|
84
84
|
])(context);
|
|
85
85
|
}
|
|
86
86
|
function addDeclarationToModule(options) {
|
|
@@ -108,15 +108,15 @@ function addMappedTypesDependencyIfApplies(options) {
|
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
if (options.type === 'rest') {
|
|
111
|
-
const nodeDependencyRef = dependencies_utils_1.getPackageJsonDependency(host, '@nestjs/swagger');
|
|
111
|
+
const nodeDependencyRef = (0, dependencies_utils_1.getPackageJsonDependency)(host, '@nestjs/swagger');
|
|
112
112
|
if (nodeDependencyRef) {
|
|
113
113
|
options.isSwaggerInstalled = true;
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
const nodeDependencyRef = dependencies_utils_1.getPackageJsonDependency(host, '@nestjs/mapped-types');
|
|
117
|
+
const nodeDependencyRef = (0, dependencies_utils_1.getPackageJsonDependency)(host, '@nestjs/mapped-types');
|
|
118
118
|
if (!nodeDependencyRef) {
|
|
119
|
-
dependencies_utils_1.addPackageJsonDependency(host, {
|
|
119
|
+
(0, dependencies_utils_1.addPackageJsonDependency)(host, {
|
|
120
120
|
type: dependencies_utils_1.NodeDependencyType.Default,
|
|
121
121
|
name: '@nestjs/mapped-types',
|
|
122
122
|
version: '*',
|
|
@@ -11,10 +11,10 @@ const source_root_helpers_1 = require("../../utils/source-root.helpers");
|
|
|
11
11
|
function main(options) {
|
|
12
12
|
options = transform(options);
|
|
13
13
|
return (tree, context) => {
|
|
14
|
-
return schematics_1.branchAndMerge(schematics_1.chain([
|
|
15
|
-
source_root_helpers_1.mergeSourceRoot(options),
|
|
14
|
+
return (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
|
|
15
|
+
(0, source_root_helpers_1.mergeSourceRoot)(options),
|
|
16
16
|
addDeclarationToModule(options),
|
|
17
|
-
schematics_1.mergeWith(generate(options)),
|
|
17
|
+
(0, schematics_1.mergeWith)(generate(options)),
|
|
18
18
|
]))(tree, context);
|
|
19
19
|
};
|
|
20
20
|
}
|
|
@@ -23,7 +23,7 @@ function transform(source) {
|
|
|
23
23
|
const target = Object.assign({}, source);
|
|
24
24
|
target.metadata = 'providers';
|
|
25
25
|
target.type = 'service';
|
|
26
|
-
if (util_1.isNullOrUndefined(target.name)) {
|
|
26
|
+
if ((0, util_1.isNullOrUndefined)(target.name)) {
|
|
27
27
|
throw new schematics_1.SchematicsException('Option (name) is required.');
|
|
28
28
|
}
|
|
29
29
|
const location = new name_parser_1.NameParser().parse(target);
|
|
@@ -32,14 +32,14 @@ function transform(source) {
|
|
|
32
32
|
target.language = target.language !== undefined ? target.language : 'ts';
|
|
33
33
|
target.path = target.flat
|
|
34
34
|
? target.path
|
|
35
|
-
: core_1.join(target.path, target.name);
|
|
35
|
+
: (0, core_1.join)(target.path, target.name);
|
|
36
36
|
return target;
|
|
37
37
|
}
|
|
38
38
|
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),
|
|
39
|
+
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
40
|
+
options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)(path => !path.endsWith('.spec.ts')),
|
|
41
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
42
|
+
(0, schematics_1.move)(options.path),
|
|
43
43
|
])(context);
|
|
44
44
|
}
|
|
45
45
|
function addDeclarationToModule(options) {
|
|
@@ -3,22 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.main = void 0;
|
|
4
4
|
const core_1 = require("@angular-devkit/core");
|
|
5
5
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
const jsonc_parser_1 = require("jsonc-parser");
|
|
6
7
|
const fse = require("fs-extra");
|
|
7
8
|
const defaults_1 = require("../defaults");
|
|
8
9
|
function main(options) {
|
|
9
10
|
const appName = getAppNameFromPackageJson();
|
|
10
11
|
options = transform(options);
|
|
11
|
-
return schematics_1.chain([
|
|
12
|
+
return (0, schematics_1.chain)([
|
|
12
13
|
updateTsConfig(),
|
|
13
14
|
updatePackageJson(options, appName),
|
|
14
15
|
(tree, context) => isMonorepo(tree)
|
|
15
|
-
? schematics_1.noop()(tree, context)
|
|
16
|
-
: schematics_1.chain([
|
|
17
|
-
schematics_1.branchAndMerge(schematics_1.mergeWith(generateWorkspace(options, appName))),
|
|
16
|
+
? (0, schematics_1.noop)()(tree, context)
|
|
17
|
+
: (0, schematics_1.chain)([
|
|
18
|
+
(0, schematics_1.branchAndMerge)((0, schematics_1.mergeWith)(generateWorkspace(options, appName))),
|
|
18
19
|
moveDefaultAppToApps(options.path, appName, options.sourceRoot),
|
|
19
20
|
])(tree, context),
|
|
20
21
|
addAppsToCliOptions(options.path, options.name, appName),
|
|
21
|
-
schematics_1.branchAndMerge(schematics_1.mergeWith(generate(options))),
|
|
22
|
+
(0, schematics_1.branchAndMerge)((0, schematics_1.mergeWith)(generate(options))),
|
|
22
23
|
]);
|
|
23
24
|
}
|
|
24
25
|
exports.main = main;
|
|
@@ -49,8 +50,8 @@ function transform(options) {
|
|
|
49
50
|
target.name = core_1.strings.dasherize(target.name);
|
|
50
51
|
target.path =
|
|
51
52
|
target.path !== undefined
|
|
52
|
-
? core_1.join(core_1.normalize(defaultSourceRoot), target.path)
|
|
53
|
-
: core_1.normalize(defaultSourceRoot);
|
|
53
|
+
? (0, core_1.join)((0, core_1.normalize)(defaultSourceRoot), target.path)
|
|
54
|
+
: (0, core_1.normalize)(defaultSourceRoot);
|
|
54
55
|
return target;
|
|
55
56
|
}
|
|
56
57
|
function isMonorepo(host) {
|
|
@@ -65,14 +66,14 @@ function isMonorepo(host) {
|
|
|
65
66
|
return false;
|
|
66
67
|
}
|
|
67
68
|
const sourceText = source.toString('utf-8');
|
|
68
|
-
const optionsObj =
|
|
69
|
+
const optionsObj = (0, jsonc_parser_1.parse)(sourceText);
|
|
69
70
|
return !!optionsObj.monorepo;
|
|
70
71
|
}
|
|
71
72
|
function updateJsonFile(host, path, callback) {
|
|
72
73
|
const source = host.read(path);
|
|
73
74
|
if (source) {
|
|
74
75
|
const sourceText = source.toString('utf-8');
|
|
75
|
-
const json =
|
|
76
|
+
const json = (0, jsonc_parser_1.parse)(sourceText);
|
|
76
77
|
callback(json);
|
|
77
78
|
host.overwrite(path, JSON.stringify(json, null, 2));
|
|
78
79
|
}
|
|
@@ -119,7 +120,7 @@ function updateNpmScripts(scripts, options, defaultAppName) {
|
|
|
119
120
|
if (scripts[defaultTestScriptName] &&
|
|
120
121
|
scripts[defaultTestScriptName].indexOf(options.path) < 0) {
|
|
121
122
|
const defaultTestDir = 'test';
|
|
122
|
-
const newTestDir = core_1.join(options.path, defaultAppName, defaultTestDir);
|
|
123
|
+
const newTestDir = (0, core_1.join)(options.path, defaultAppName, defaultTestDir);
|
|
123
124
|
scripts[defaultTestScriptName] = scripts[defaultTestScriptName].replace(defaultTestDir, newTestDir);
|
|
124
125
|
}
|
|
125
126
|
if (scripts[defaultFormatScriptName] &&
|
|
@@ -157,11 +158,11 @@ function moveDefaultAppToApps(projectRoot, appName, sourceRoot = defaults_1.DEFA
|
|
|
157
158
|
}
|
|
158
159
|
try {
|
|
159
160
|
if (fse.existsSync(sourceRoot)) {
|
|
160
|
-
fse.moveSync(sourceRoot, core_1.join(projectRoot, appName, sourceRoot));
|
|
161
|
+
fse.moveSync(sourceRoot, (0, core_1.join)(projectRoot, appName, sourceRoot));
|
|
161
162
|
}
|
|
162
163
|
const testDir = 'test';
|
|
163
164
|
if (fse.existsSync(testDir)) {
|
|
164
|
-
fse.moveSync(testDir, core_1.join(projectRoot, appName, testDir));
|
|
165
|
+
fse.moveSync(testDir, (0, core_1.join)(projectRoot, appName, testDir));
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
168
|
catch (err) {
|
|
@@ -171,14 +172,14 @@ function moveDefaultAppToApps(projectRoot, appName, sourceRoot = defaults_1.DEFA
|
|
|
171
172
|
};
|
|
172
173
|
}
|
|
173
174
|
function addAppsToCliOptions(projectRoot, projectName, appName) {
|
|
174
|
-
const rootPath = core_1.join(projectRoot, projectName);
|
|
175
|
+
const rootPath = (0, core_1.join)(projectRoot, projectName);
|
|
175
176
|
const project = {
|
|
176
177
|
type: defaults_1.PROJECT_TYPE.APPLICATION,
|
|
177
178
|
root: rootPath,
|
|
178
179
|
entryFile: 'main',
|
|
179
|
-
sourceRoot: core_1.join(rootPath, defaults_1.DEFAULT_PATH_NAME),
|
|
180
|
+
sourceRoot: (0, core_1.join)(rootPath, defaults_1.DEFAULT_PATH_NAME),
|
|
180
181
|
compilerOptions: {
|
|
181
|
-
tsConfigPath: core_1.join(rootPath, 'tsconfig.app.json'),
|
|
182
|
+
tsConfigPath: (0, core_1.join)(rootPath, 'tsconfig.app.json'),
|
|
182
183
|
},
|
|
183
184
|
};
|
|
184
185
|
return (host) => {
|
|
@@ -204,11 +205,11 @@ function updateMainAppOptions(optionsFile, projectRoot, appName) {
|
|
|
204
205
|
if (optionsFile.monorepo) {
|
|
205
206
|
return;
|
|
206
207
|
}
|
|
207
|
-
const rootFilePath = core_1.join(projectRoot, appName);
|
|
208
|
-
const tsConfigPath = core_1.join(rootFilePath, 'tsconfig.app.json');
|
|
208
|
+
const rootFilePath = (0, core_1.join)(projectRoot, appName);
|
|
209
|
+
const tsConfigPath = (0, core_1.join)(rootFilePath, 'tsconfig.app.json');
|
|
209
210
|
optionsFile.monorepo = true;
|
|
210
211
|
optionsFile.root = rootFilePath;
|
|
211
|
-
optionsFile.sourceRoot = core_1.join(projectRoot, appName, optionsFile.sourceRoot || defaults_1.DEFAULT_PATH_NAME);
|
|
212
|
+
optionsFile.sourceRoot = (0, core_1.join)(projectRoot, appName, optionsFile.sourceRoot || defaults_1.DEFAULT_PATH_NAME);
|
|
212
213
|
if (!optionsFile.compilerOptions) {
|
|
213
214
|
optionsFile.compilerOptions = {};
|
|
214
215
|
}
|
|
@@ -221,23 +222,23 @@ function updateMainAppOptions(optionsFile, projectRoot, appName) {
|
|
|
221
222
|
type: defaults_1.PROJECT_TYPE.APPLICATION,
|
|
222
223
|
root: rootFilePath,
|
|
223
224
|
entryFile: optionsFile.entryFile || 'main',
|
|
224
|
-
sourceRoot: core_1.join(rootFilePath, defaults_1.DEFAULT_PATH_NAME),
|
|
225
|
+
sourceRoot: (0, core_1.join)(rootFilePath, defaults_1.DEFAULT_PATH_NAME),
|
|
225
226
|
compilerOptions: {
|
|
226
227
|
tsConfigPath,
|
|
227
228
|
},
|
|
228
229
|
};
|
|
229
230
|
}
|
|
230
231
|
function generateWorkspace(options, appName) {
|
|
231
|
-
const path = core_1.join(options.path, appName);
|
|
232
|
-
return schematics_1.apply(schematics_1.url(core_1.join('./workspace', options.language)), [
|
|
233
|
-
schematics_1.template(Object.assign(Object.assign(Object.assign({}, core_1.strings), options), { name: appName })),
|
|
234
|
-
schematics_1.move(path),
|
|
232
|
+
const path = (0, core_1.join)(options.path, appName);
|
|
233
|
+
return (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./workspace', options.language)), [
|
|
234
|
+
(0, schematics_1.template)(Object.assign(Object.assign(Object.assign({}, core_1.strings), options), { name: appName })),
|
|
235
|
+
(0, schematics_1.move)(path),
|
|
235
236
|
]);
|
|
236
237
|
}
|
|
237
238
|
function generate(options) {
|
|
238
|
-
const path = core_1.join(options.path, options.name);
|
|
239
|
-
return schematics_1.apply(schematics_1.url(core_1.join('./files', options.language)), [
|
|
240
|
-
schematics_1.template(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
241
|
-
schematics_1.move(path),
|
|
239
|
+
const path = (0, core_1.join)(options.path, options.name);
|
|
240
|
+
return (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
241
|
+
(0, schematics_1.template)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
242
|
+
(0, schematics_1.move)(path),
|
|
242
243
|
]);
|
|
243
244
|
}
|
|
@@ -19,12 +19,12 @@ class JSONFile {
|
|
|
19
19
|
return this._jsonAst;
|
|
20
20
|
}
|
|
21
21
|
const errors = [];
|
|
22
|
-
this._jsonAst = jsonc_parser_1.parseTree(this.content, errors, {
|
|
22
|
+
this._jsonAst = (0, jsonc_parser_1.parseTree)(this.content, errors, {
|
|
23
23
|
allowTrailingComma: true,
|
|
24
24
|
});
|
|
25
25
|
if (errors.length) {
|
|
26
26
|
const { error, offset } = errors[0];
|
|
27
|
-
throw new Error(`Failed to parse "${this.path}" as JSON AST Object. ${jsonc_parser_1.printParseErrorCode(error)} at location: ${offset}.`);
|
|
27
|
+
throw new Error(`Failed to parse "${this.path}" as JSON AST Object. ${(0, jsonc_parser_1.printParseErrorCode)(error)} at location: ${offset}.`);
|
|
28
28
|
}
|
|
29
29
|
return this._jsonAst;
|
|
30
30
|
}
|
|
@@ -34,10 +34,10 @@ class JSONFile {
|
|
|
34
34
|
return undefined;
|
|
35
35
|
}
|
|
36
36
|
if (jsonPath.length === 0) {
|
|
37
|
-
return jsonc_parser_1.getNodeValue(jsonAstNode);
|
|
37
|
+
return (0, jsonc_parser_1.getNodeValue)(jsonAstNode);
|
|
38
38
|
}
|
|
39
|
-
const node = jsonc_parser_1.findNodeAtLocation(jsonAstNode, jsonPath);
|
|
40
|
-
return node === undefined ? undefined : jsonc_parser_1.getNodeValue(node);
|
|
39
|
+
const node = (0, jsonc_parser_1.findNodeAtLocation)(jsonAstNode, jsonPath);
|
|
40
|
+
return node === undefined ? undefined : (0, jsonc_parser_1.getNodeValue)(node);
|
|
41
41
|
}
|
|
42
42
|
modify(jsonPath, value, insertInOrder) {
|
|
43
43
|
let getInsertionIndex;
|
|
@@ -48,14 +48,14 @@ class JSONFile {
|
|
|
48
48
|
else if (insertInOrder !== false) {
|
|
49
49
|
getInsertionIndex = insertInOrder;
|
|
50
50
|
}
|
|
51
|
-
const edits = jsonc_parser_1.modify(this.content, jsonPath, value, {
|
|
51
|
+
const edits = (0, jsonc_parser_1.modify)(this.content, jsonPath, value, {
|
|
52
52
|
getInsertionIndex,
|
|
53
53
|
formattingOptions: {
|
|
54
54
|
insertSpaces: true,
|
|
55
55
|
tabSize: 2,
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
|
-
this.content = jsonc_parser_1.applyEdits(this.content, edits);
|
|
58
|
+
this.content = (0, jsonc_parser_1.applyEdits)(this.content, edits);
|
|
59
59
|
this.host.overwrite(this.path, this.content);
|
|
60
60
|
this._jsonAst = undefined;
|
|
61
61
|
}
|
|
@@ -7,7 +7,7 @@ class MetadataManager {
|
|
|
7
7
|
this.content = content;
|
|
8
8
|
}
|
|
9
9
|
insert(metadata, symbol, staticOptions) {
|
|
10
|
-
const source = typescript_1.createSourceFile('filename.ts', this.content, typescript_1.ScriptTarget.ES2017);
|
|
10
|
+
const source = (0, typescript_1.createSourceFile)('filename.ts', this.content, typescript_1.ScriptTarget.ES2017);
|
|
11
11
|
const decoratorNodes = this.getDecoratorMetadata(source, '@Module');
|
|
12
12
|
const node = decoratorNodes[0];
|
|
13
13
|
const matchingProperties = node.properties
|
|
@@ -28,10 +28,10 @@ class ModuleImportDeclarator {
|
|
|
28
28
|
computeRelativePath(options) {
|
|
29
29
|
let importModulePath;
|
|
30
30
|
if (options.type !== undefined) {
|
|
31
|
-
importModulePath = core_1.normalize(`/${options.path}/${options.name}.${options.type}`);
|
|
31
|
+
importModulePath = (0, core_1.normalize)(`/${options.path}/${options.name}.${options.type}`);
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
|
-
importModulePath = core_1.normalize(`/${options.path}/${options.name}`);
|
|
34
|
+
importModulePath = (0, core_1.normalize)(`/${options.path}/${options.name}`);
|
|
35
35
|
}
|
|
36
36
|
return this.solver.relative(options.module, importModulePath);
|
|
37
37
|
}
|
|
@@ -21,10 +21,10 @@ class ModuleDeclarator {
|
|
|
21
21
|
target.symbol = options.className;
|
|
22
22
|
}
|
|
23
23
|
else if (options.type !== undefined) {
|
|
24
|
-
target.symbol = strings_1.classify(options.name).concat(strings_1.capitalize(options.type));
|
|
24
|
+
target.symbol = (0, strings_1.classify)(options.name).concat((0, strings_1.capitalize)(options.type));
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
target.symbol = strings_1.classify(options.name);
|
|
27
|
+
target.symbol = (0, strings_1.classify)(options.name);
|
|
28
28
|
}
|
|
29
29
|
return target;
|
|
30
30
|
}
|
|
@@ -17,7 +17,7 @@ class ModuleFinder {
|
|
|
17
17
|
}
|
|
18
18
|
const moduleFilename = directory.subfiles.find(filename => /\.module\.(t|j)s$/.test(filename));
|
|
19
19
|
return moduleFilename !== undefined
|
|
20
|
-
? core_1.join(directory.path, moduleFilename.valueOf())
|
|
20
|
+
? (0, core_1.join)(directory.path, moduleFilename.valueOf())
|
|
21
21
|
: this.findIn(directory.parent);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -4,13 +4,13 @@ exports.NameParser = void 0;
|
|
|
4
4
|
const core_1 = require("@angular-devkit/core");
|
|
5
5
|
class NameParser {
|
|
6
6
|
parse(options) {
|
|
7
|
-
const nameWithoutPath = core_1.basename(options.name);
|
|
8
|
-
const namePath = core_1.dirname((options.path === undefined ? '' : options.path)
|
|
7
|
+
const nameWithoutPath = (0, core_1.basename)(options.name);
|
|
8
|
+
const namePath = (0, core_1.dirname)((options.path === undefined ? '' : options.path)
|
|
9
9
|
.concat('/')
|
|
10
10
|
.concat(options.name));
|
|
11
11
|
return {
|
|
12
12
|
name: nameWithoutPath,
|
|
13
|
-
path: core_1.normalize('/'.concat(namePath)),
|
|
13
|
+
path: (0, core_1.normalize)('/'.concat(namePath)),
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -5,10 +5,10 @@ const core_1 = require("@angular-devkit/core");
|
|
|
5
5
|
class PathSolver {
|
|
6
6
|
relative(from, to) {
|
|
7
7
|
const placeholder = '/placeholder';
|
|
8
|
-
const relativeDir = core_1.relative(core_1.dirname((placeholder + from)), core_1.dirname((placeholder + to)));
|
|
8
|
+
const relativeDir = (0, core_1.relative)((0, core_1.dirname)((placeholder + from)), (0, core_1.dirname)((placeholder + to)));
|
|
9
9
|
return (relativeDir.startsWith('.')
|
|
10
10
|
? relativeDir
|
|
11
|
-
: './' + relativeDir).concat(relativeDir.length === 0 ? core_1.basename(to) : '/' + core_1.basename(to));
|
|
11
|
+
: './' + relativeDir).concat(relativeDir.length === 0 ? (0, core_1.basename)(to) : '/' + (0, core_1.basename)(to));
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
exports.PathSolver = PathSolver;
|
|
@@ -17,8 +17,8 @@ function mergeSourceRoot(options) {
|
|
|
17
17
|
const defaultSourceRoot = options.sourceRoot !== undefined ? options.sourceRoot : defaults_1.DEFAULT_PATH_NAME;
|
|
18
18
|
options.path =
|
|
19
19
|
options.path !== undefined
|
|
20
|
-
? core_1.join(core_1.normalize(defaultSourceRoot), options.path)
|
|
21
|
-
: core_1.normalize(defaultSourceRoot);
|
|
20
|
+
? (0, core_1.join)((0, core_1.normalize)(defaultSourceRoot), options.path)
|
|
21
|
+
: (0, core_1.normalize)(defaultSourceRoot);
|
|
22
22
|
return host;
|
|
23
23
|
};
|
|
24
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/schematics",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.7",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@schematics)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -40,33 +40,33 @@
|
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://github.com/nestjs/schematics#readme",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@angular-devkit/core": "
|
|
44
|
-
"@angular-devkit/schematics": "
|
|
45
|
-
"fs-extra": "10.0.
|
|
43
|
+
"@angular-devkit/core": "13.2.4",
|
|
44
|
+
"@angular-devkit/schematics": "13.2.4",
|
|
45
|
+
"fs-extra": "10.0.1",
|
|
46
46
|
"jsonc-parser": "3.0.0",
|
|
47
47
|
"pluralize": "8.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@commitlint/cli": "
|
|
51
|
-
"@commitlint/config-angular": "
|
|
50
|
+
"@commitlint/cli": "16.2.1",
|
|
51
|
+
"@commitlint/config-angular": "16.2.1",
|
|
52
52
|
"@types/fs-extra": "9.0.13",
|
|
53
|
-
"@types/jest": "27.
|
|
54
|
-
"@types/node": "16.
|
|
55
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
56
|
-
"@typescript-eslint/parser": "5.
|
|
53
|
+
"@types/jest": "27.4.1",
|
|
54
|
+
"@types/node": "16.11.25",
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "5.12.1",
|
|
56
|
+
"@typescript-eslint/parser": "5.12.1",
|
|
57
57
|
"cpx": "1.5.0",
|
|
58
|
-
"eslint": "8.0
|
|
59
|
-
"eslint-config-prettier": "8.
|
|
60
|
-
"eslint-plugin-import": "2.25.
|
|
58
|
+
"eslint": "8.9.0",
|
|
59
|
+
"eslint-config-prettier": "8.4.0",
|
|
60
|
+
"eslint-plugin-import": "2.25.4",
|
|
61
61
|
"gulp": "4.0.2",
|
|
62
62
|
"gulp-clean": "0.4.0",
|
|
63
|
-
"husky": "7.0.
|
|
64
|
-
"jest": "27.
|
|
63
|
+
"husky": "7.0.4",
|
|
64
|
+
"jest": "27.5.1",
|
|
65
65
|
"nyc": "15.1.0",
|
|
66
|
-
"release-it": "14.
|
|
67
|
-
"ts-jest": "27.
|
|
68
|
-
"ts-node": "10.
|
|
69
|
-
"typescript": "4.
|
|
66
|
+
"release-it": "14.12.5",
|
|
67
|
+
"ts-jest": "27.1.3",
|
|
68
|
+
"ts-node": "10.5.0",
|
|
69
|
+
"typescript": "4.5.5"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"typescript": "^3.4.5 || ^4.3.5"
|