@rxap/plugin-nestjs 16.1.0-dev.8 → 16.1.0-dev.9
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/package.json +11 -11
- package/src/executors/package-json/executor.js +19 -13
- package/src/executors/package-json/executor.js.map +1 -1
- package/src/generators/init/generator.js +26 -25
- package/src/generators/init/generator.js.map +1 -1
- package/src/generators/init/index.js +6 -4
- package/src/generators/init/index.js.map +1 -1
- package/src/generators/init-application/generator.js +90 -84
- package/src/generators/init-application/generator.js.map +1 -1
- package/src/generators/init-application/index.js +6 -4
- package/src/generators/init-application/index.js.map +1 -1
- package/src/generators/init-library/generator.js +30 -23
- package/src/generators/init-library/generator.js.map +1 -1
- package/src/generators/init-library/index.js +6 -4
- package/src/generators/init-library/index.js.map +1 -1
- package/src/generators/swagger/generator.js +36 -27
- package/src/generators/swagger/generator.js.map +1 -1
- package/src/generators/swagger/index.js +6 -4
- package/src/generators/swagger/index.js.map +1 -1
- package/src/index.js +7 -2
- package/src/index.js.map +1 -1
- package/src/lib/skip-non-nest-project.js +10 -5
- package/src/lib/skip-non-nest-project.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [16.1.0-dev.9](https://gitlab.com/rxap/packages/compare/@rxap/plugin-nestjs@16.1.0-dev.8...@rxap/plugin-nestjs@16.1.0-dev.9) (2023-08-17)
|
|
7
|
+
|
|
8
|
+
### Reverts
|
|
9
|
+
|
|
10
|
+
- change from commonjs to es2022 ([747a381](https://gitlab.com/rxap/packages/commit/747a381a090f0a276cf363da61bb19ed0c9cb5b7))
|
|
11
|
+
|
|
6
12
|
# [16.1.0-dev.8](https://gitlab.com/rxap/packages/compare/@rxap/plugin-nestjs@16.1.0-dev.7...@rxap/plugin-nestjs@16.1.0-dev.8) (2023-08-16)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ yarn add @rxap/plugin-nestjs
|
|
|
19
19
|
```
|
|
20
20
|
**Install peer dependencies:**
|
|
21
21
|
```bash
|
|
22
|
-
yarn add @nx/devkit@^16.5.0 @nx/js@^16.5.0 @rxap/generator-utilities@^1.1.0-dev.
|
|
22
|
+
yarn add @nx/devkit@^16.5.0 @nx/js@^16.5.0 @rxap/generator-utilities@^1.1.0-dev.5 @rxap/plugin-utilities@^16.1.0-dev.7 @rxap/workspace-utilities@^0.1.0-dev.4 nx@^16.5.0
|
|
23
23
|
```
|
|
24
24
|
**Execute the init generator:**
|
|
25
25
|
```bash
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxap/plugin-nestjs",
|
|
3
|
-
"version": "16.1.0-dev.
|
|
4
|
-
"type": "
|
|
3
|
+
"version": "16.1.0-dev.9",
|
|
4
|
+
"type": "commonjs",
|
|
5
5
|
"generators": "./generators.json",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public",
|
|
@@ -39,32 +39,32 @@
|
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@nx/devkit": "^16.5.0",
|
|
41
41
|
"@nx/js": "^16.5.0",
|
|
42
|
-
"@rxap/generator-utilities": "^1.1.0-dev.
|
|
43
|
-
"@rxap/plugin-utilities": "^16.1.0-dev.
|
|
44
|
-
"@rxap/workspace-utilities": "^0.1.0-dev.
|
|
42
|
+
"@rxap/generator-utilities": "^1.1.0-dev.5",
|
|
43
|
+
"@rxap/plugin-utilities": "^16.1.0-dev.7",
|
|
44
|
+
"@rxap/workspace-utilities": "^0.1.0-dev.4",
|
|
45
45
|
"nx": "^16.5.0",
|
|
46
|
-
"@rxap/node-utilities": "1.1.0-dev.
|
|
47
|
-
"@rxap/utilities": "16.0.0-dev.
|
|
46
|
+
"@rxap/node-utilities": "1.1.0-dev.3",
|
|
47
|
+
"@rxap/utilities": "16.0.0-dev.11"
|
|
48
48
|
},
|
|
49
49
|
"nx-migrations": {
|
|
50
50
|
"packageGroup": [
|
|
51
51
|
{
|
|
52
52
|
"package": "@rxap/generator-utilities",
|
|
53
|
-
"version": "1.1.0-dev.
|
|
53
|
+
"version": "1.1.0-dev.5"
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
"package": "@rxap/plugin-utilities",
|
|
57
|
-
"version": "16.1.0-dev.
|
|
57
|
+
"version": "16.1.0-dev.7"
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
"package": "@rxap/workspace-utilities",
|
|
61
|
-
"version": "0.1.0-dev.
|
|
61
|
+
"version": "0.1.0-dev.4"
|
|
62
62
|
}
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
65
|
"executors": "./executors.json",
|
|
66
66
|
"schematics": "./generators.json",
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "bdda345932cb56c4034526de42761d15700fc56d",
|
|
68
68
|
"main": "./src/index.js",
|
|
69
69
|
"types": "./src/index.d.ts"
|
|
70
70
|
}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const plugin_utilities_1 = require("@rxap/plugin-utilities");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
function runExecutor(options, context) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
console.log('Executor ran for PackageJson', options);
|
|
10
|
+
(0, plugin_utilities_1.LoadProjectToPackageMapping)(context);
|
|
11
|
+
const dependencies = (0, plugin_utilities_1.GetAllPackageDependenciesForProject)(context);
|
|
12
|
+
const packageJson = { dependencies, name: context.projectName, private: true };
|
|
13
|
+
console.log('dependencies', dependencies);
|
|
14
|
+
(0, fs_1.writeFileSync)((0, path_1.join)((0, plugin_utilities_1.GetProjectRoot)(context), 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
15
|
+
return {
|
|
16
|
+
success: true,
|
|
17
|
+
};
|
|
18
|
+
});
|
|
14
19
|
}
|
|
20
|
+
exports.default = runExecutor;
|
|
15
21
|
//# sourceMappingURL=executor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/executors/package-json/executor.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/executors/package-json/executor.ts"],"names":[],"mappings":";;;AACA,6DAIgC;AAChC,2BAAmC;AACnC,+BAA4B;AAG5B,SAA8B,WAAW,CACvC,OAAkC,EAClC,OAAwB;;QAExB,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;QAErD,IAAA,8CAA2B,EAAC,OAAO,CAAC,CAAC;QAErC,MAAM,YAAY,GAAG,IAAA,sDAAmC,EAAC,OAAO,CAAC,CAAC;QAElE,MAAM,WAAW,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAE/E,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QAE1C,IAAA,kBAAa,EAAC,IAAA,WAAI,EAAC,IAAA,iCAAc,EAAC,OAAO,CAAC,EAAE,cAAc,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAEnG,OAAO;YACL,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;CAAA;AAnBD,8BAmBC"}
|
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const skip_non_nest_project_1 = require("../../lib/skip-non-nest-project");
|
|
7
|
+
const generator_1 = require("../init-application/generator");
|
|
8
|
+
const generator_2 = require("../init-library/generator");
|
|
5
9
|
function skipProject(tree, options, project, projectName) {
|
|
6
|
-
if (SkipNonNestProject(tree, options, project, projectName)) {
|
|
10
|
+
if ((0, skip_non_nest_project_1.SkipNonNestProject)(tree, options, project, projectName)) {
|
|
7
11
|
return true;
|
|
8
12
|
}
|
|
9
13
|
return false;
|
|
10
14
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
function initGenerator(tree, options) {
|
|
16
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
console.log('nestjs init generator:', options);
|
|
18
|
+
for (const [projectName, project] of (0, devkit_1.getProjects)(tree).entries()) {
|
|
19
|
+
if (skipProject(tree, options, project, projectName)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
console.log(`init project: ${projectName}`);
|
|
23
|
+
if (project.projectType === 'library') {
|
|
24
|
+
yield (0, generator_2.default)(tree, Object.assign(Object.assign({}, options), { projects: [projectName] }));
|
|
25
|
+
}
|
|
26
|
+
if (project.projectType === 'application') {
|
|
27
|
+
yield (0, generator_1.default)(tree, Object.assign(Object.assign({}, options), { projects: [projectName] }));
|
|
28
|
+
}
|
|
16
29
|
}
|
|
17
|
-
|
|
18
|
-
if (project.projectType === 'library') {
|
|
19
|
-
await initLibraryGenerator(tree, {
|
|
20
|
-
...options,
|
|
21
|
-
projects: [projectName],
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
if (project.projectType === 'application') {
|
|
25
|
-
await initApplicationGenerator(tree, {
|
|
26
|
-
...options,
|
|
27
|
-
projects: [projectName],
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
30
|
+
});
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
exports.initGenerator = initGenerator;
|
|
33
|
+
exports.default = initGenerator;
|
|
33
34
|
//# sourceMappingURL=generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init/generator.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAIoB;AACpB,2EAAqE;AACrE,6DAAqE;AACrE,yDAA6D;AAG7D,SAAS,WAAW,CAAC,IAAU,EAAE,OAA4B,EAAE,OAA6B,EAAE,WAAmB;IAE/G,IAAI,IAAA,0CAAkB,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;QAC3D,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AAEf,CAAC;AAED,SAAsB,aAAa,CAAC,IAAU,EAAE,OAA4B;;QAC1E,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC;QAE/C,KAAK,MAAM,CAAE,WAAW,EAAE,OAAO,CAAE,IAAI,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;YAElE,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;gBACpD,SAAS;aACV;YAED,OAAO,CAAC,GAAG,CAAC,iBAAkB,WAAY,EAAE,CAAC,CAAC;YAE9C,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE;gBACrC,MAAM,IAAA,mBAAoB,EAAC,IAAI,kCAExB,OAAO,KACV,QAAQ,EAAE,CAAE,WAAW,CAAE,IAE5B,CAAC;aACH;YAED,IAAI,OAAO,CAAC,WAAW,KAAK,aAAa,EAAE;gBACzC,MAAM,IAAA,mBAAwB,EAAC,IAAI,kCAE5B,OAAO,KACV,QAAQ,EAAE,CAAE,WAAW,CAAE,IAE5B,CAAC;aACH;SAEF;IAEH,CAAC;CAAA;AA/BD,sCA+BC;AAED,kBAAe,aAAa,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const generator_1 = require("./generator");
|
|
5
|
+
const schematic = (0, devkit_1.convertNxGenerator)(generator_1.default);
|
|
6
|
+
exports.default = schematic;
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init/index.ts"],"names":[],"mappings":";;AAAA,uCAAgD;AAChD,2CAAoC;AAEpC,MAAM,SAAS,GAAG,IAAA,2BAAkB,EAAC,mBAAS,CAAC,CAAC;AAChD,kBAAe,SAAS,CAAC"}
|
|
@@ -1,38 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initApplicationGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const library_1 = require("@nx/js/src/generators/library/library");
|
|
7
|
+
const generator_utilities_1 = require("@rxap/generator-utilities");
|
|
8
|
+
const workspace_utilities_1 = require("@rxap/workspace-utilities");
|
|
9
|
+
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
const skip_non_nest_project_1 = require("../../lib/skip-non-nest-project");
|
|
12
|
+
const generator_1 = require("../swagger/generator");
|
|
9
13
|
function skipProject(tree, options, project, projectName) {
|
|
10
|
-
if (SkipNonNestProject(tree, options, project, projectName)) {
|
|
14
|
+
if ((0, skip_non_nest_project_1.SkipNonNestProject)(tree, options, project, projectName)) {
|
|
11
15
|
return true;
|
|
12
16
|
}
|
|
13
|
-
if (SkipNonApplicationProject(tree, options, project, projectName)) {
|
|
17
|
+
if ((0, generator_utilities_1.SkipNonApplicationProject)(tree, options, project, projectName)) {
|
|
14
18
|
return true;
|
|
15
19
|
}
|
|
16
20
|
return false;
|
|
17
21
|
}
|
|
18
22
|
function setGeneralTargetDefaults(tree) {
|
|
19
|
-
const nxJson = readNxJson(tree);
|
|
20
|
-
CoerceTargetDefaultsDependency(nxJson, 'build', 'generate-package-json');
|
|
21
|
-
CoerceTargetDefaultsDependency(nxJson, 'generate-open-api', 'swagger-generate');
|
|
22
|
-
updateNxJson(tree, nxJson);
|
|
23
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
24
|
+
(0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'build', 'generate-package-json');
|
|
25
|
+
(0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'generate-open-api', 'swagger-generate');
|
|
26
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
23
27
|
}
|
|
24
28
|
function updateProjectTargets(project) {
|
|
25
|
-
|
|
29
|
+
var _a, _b, _c;
|
|
30
|
+
(0, workspace_utilities_1.CoerceTarget)(project, 'generate-package-json', {
|
|
26
31
|
executor: '@rxap/plugin-nestjs:package-json',
|
|
27
32
|
configurations: {
|
|
28
33
|
production: {},
|
|
29
34
|
},
|
|
30
35
|
});
|
|
31
|
-
const outputPath = project.targets
|
|
36
|
+
const outputPath = (_c = (_b = (_a = project.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.outputPath;
|
|
32
37
|
if (!outputPath) {
|
|
33
38
|
throw new Error(`No outputPath found for project ${project.name}`);
|
|
34
39
|
}
|
|
35
|
-
CoerceTarget(project, 'generate-open-api', {
|
|
40
|
+
(0, workspace_utilities_1.CoerceTarget)(project, 'generate-open-api', {
|
|
36
41
|
executor: '@rxap/plugin-library:run-generator',
|
|
37
42
|
options: {
|
|
38
43
|
generator: '@rxap/schematics-open-api:generate',
|
|
@@ -45,76 +50,77 @@ function updateProjectTargets(project) {
|
|
|
45
50
|
});
|
|
46
51
|
}
|
|
47
52
|
function updateGitIgnore(tree, project) {
|
|
48
|
-
CoerceIgnorePattern(tree, join(project.root, '.gitignore'), ['package.json']);
|
|
53
|
+
(0, generator_utilities_1.CoerceIgnorePattern)(tree, (0, path_1.join)(project.root, '.gitignore'), ['package.json']);
|
|
49
54
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const projectRoot = project.root;
|
|
56
|
-
const fragments = projectRoot.split('/');
|
|
57
|
-
const name = fragments.pop();
|
|
58
|
-
fragments.shift(); // remove the root folder
|
|
59
|
-
const directory = `open-api/${fragments.join('/')}`;
|
|
60
|
-
try {
|
|
61
|
-
await libraryGenerator(tree, {
|
|
62
|
-
name,
|
|
63
|
-
directory,
|
|
64
|
-
unitTestRunner: 'none',
|
|
65
|
-
tags: 'open-api',
|
|
66
|
-
buildable: false,
|
|
67
|
-
bundler: 'none',
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
catch (e) {
|
|
71
|
-
console.warn(`Can't create open api client sdk library: ${e.message}`);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
let tsConfig;
|
|
75
|
-
try {
|
|
76
|
-
tsConfig = JSON.parse(tree.read('tsconfig.base.json').toString('utf-8'));
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
throw new Error(`Can't parse tsconfig.base.json: ${e.message}`);
|
|
80
|
-
}
|
|
81
|
-
projects = getProjects(tree);
|
|
82
|
-
if (!projects.has(openApiProjectName)) {
|
|
83
|
-
throw new Error(`Can't find project ${openApiProjectName}`);
|
|
84
|
-
}
|
|
85
|
-
const openApiProjectRoot = projects.get(openApiProjectName).root;
|
|
86
|
-
delete tsConfig.compilerOptions.paths[`${directory}/${name}`];
|
|
87
|
-
tsConfig.compilerOptions.paths[`${openApiProjectName}/*`] = [`${openApiProjectRoot}/src/lib/*`];
|
|
88
|
-
tree.write('tsconfig.base.json', JSON.stringify(tsConfig, null, 2));
|
|
89
|
-
tree.write(`${openApiProjectRoot}/src/index.ts`, 'export {};');
|
|
90
|
-
tree.delete(`${openApiProjectRoot}/src/lib/${openApiProjectName}.ts`);
|
|
91
|
-
tree.delete(`${openApiProjectRoot}/README.md`);
|
|
92
|
-
}
|
|
93
|
-
export async function initApplicationGenerator(tree, options) {
|
|
94
|
-
console.log('nestjs application init generator:', options);
|
|
95
|
-
setGeneralTargetDefaults(tree);
|
|
96
|
-
const projects = getProjects(tree);
|
|
97
|
-
for (const [projectName, project] of projects.entries()) {
|
|
98
|
-
if (skipProject(tree, options, project, projectName)) {
|
|
99
|
-
continue;
|
|
55
|
+
function createOpenApiClientSdkLibrary(tree, project, projects) {
|
|
56
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
const openApiProjectName = `open-api-${project.name}`;
|
|
58
|
+
if (projects.has(openApiProjectName)) {
|
|
59
|
+
return;
|
|
100
60
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
project: projectName,
|
|
61
|
+
const projectRoot = project.root;
|
|
62
|
+
const fragments = projectRoot.split('/');
|
|
63
|
+
const name = fragments.pop();
|
|
64
|
+
fragments.shift(); // remove the root folder
|
|
65
|
+
const directory = `open-api/${fragments.join('/')}`;
|
|
66
|
+
try {
|
|
67
|
+
yield (0, library_1.default)(tree, {
|
|
68
|
+
name,
|
|
69
|
+
directory,
|
|
70
|
+
unitTestRunner: 'none',
|
|
71
|
+
tags: 'open-api',
|
|
72
|
+
buildable: false,
|
|
73
|
+
bundler: 'none',
|
|
115
74
|
});
|
|
116
75
|
}
|
|
117
|
-
|
|
76
|
+
catch (e) {
|
|
77
|
+
console.warn(`Can't create open api client sdk library: ${e.message}`);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
let tsConfig;
|
|
81
|
+
try {
|
|
82
|
+
tsConfig = JSON.parse(tree.read('tsconfig.base.json').toString('utf-8'));
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
throw new Error(`Can't parse tsconfig.base.json: ${e.message}`);
|
|
86
|
+
}
|
|
87
|
+
projects = (0, devkit_1.getProjects)(tree);
|
|
88
|
+
if (!projects.has(openApiProjectName)) {
|
|
89
|
+
throw new Error(`Can't find project ${openApiProjectName}`);
|
|
90
|
+
}
|
|
91
|
+
const openApiProjectRoot = projects.get(openApiProjectName).root;
|
|
92
|
+
delete tsConfig.compilerOptions.paths[`${directory}/${name}`];
|
|
93
|
+
tsConfig.compilerOptions.paths[`${openApiProjectName}/*`] = [`${openApiProjectRoot}/src/lib/*`];
|
|
94
|
+
tree.write('tsconfig.base.json', JSON.stringify(tsConfig, null, 2));
|
|
95
|
+
tree.write(`${openApiProjectRoot}/src/index.ts`, 'export {};');
|
|
96
|
+
tree.delete(`${openApiProjectRoot}/src/lib/${openApiProjectName}.ts`);
|
|
97
|
+
tree.delete(`${openApiProjectRoot}/README.md`);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function initApplicationGenerator(tree, options) {
|
|
101
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
console.log('nestjs application init generator:', options);
|
|
103
|
+
setGeneralTargetDefaults(tree);
|
|
104
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
105
|
+
for (const [projectName, project] of projects.entries()) {
|
|
106
|
+
if (skipProject(tree, options, project, projectName)) {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
console.log(`init project: ${projectName}`);
|
|
110
|
+
updateProjectTargets(project);
|
|
111
|
+
updateGitIgnore(tree, project);
|
|
112
|
+
yield createOpenApiClientSdkLibrary(tree, project, projects);
|
|
113
|
+
// apply changes to the project configuration
|
|
114
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
|
|
115
|
+
if (options.swagger !== false) {
|
|
116
|
+
yield (0, generator_1.default)(tree, { project: projectName });
|
|
117
|
+
}
|
|
118
|
+
if (options.legacy) {
|
|
119
|
+
yield (0, ngcli_adapter_1.wrapAngularDevkitSchematic)('@rxap/schematic-nestjs', 'init')(tree, Object.assign(Object.assign({}, options), { swagger: false, project: projectName }));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
118
123
|
}
|
|
119
|
-
|
|
124
|
+
exports.initApplicationGenerator = initApplicationGenerator;
|
|
125
|
+
exports.default = initApplicationGenerator;
|
|
120
126
|
//# sourceMappingURL=generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-application/generator.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-application/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAOoB;AACpB,mEAAqE;AACrE,mEAGmC;AACnC,mEAGmC;AACnC,gEAA0E;AAC1E,+BAA4B;AAC5B,2EAAqE;AACrE,oDAAoD;AAGpD,SAAS,WAAW,CAClB,IAAU,EACV,OAAuC,EACvC,OAA6B,EAC7B,WAAmB;IAGnB,IAAI,IAAA,0CAAkB,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;QAC3D,OAAO,IAAI,CAAC;KACb;IAED,IAAI,IAAA,+CAAyB,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;QAClE,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AAEf,CAAC;AAED,SAAS,wBAAwB,CAAC,IAAU;IAC1C,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC;IAEhC,IAAA,oDAA8B,EAAC,MAAM,EAAE,OAAO,EAAE,uBAAuB,CAAC,CAAC;IACzE,IAAA,oDAA8B,EAAC,MAAM,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;IAEhF,IAAA,qBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,oBAAoB,CAAC,OAA6B;;IAEzD,IAAA,kCAAY,EAAC,OAAO,EAAE,uBAAuB,EAAE;QAC7C,QAAQ,EAAE,kCAAkC;QAC5C,cAAc,EAAE;YACd,UAAU,EAAE,EAAE;SACf;KACF,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,MAAA,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,KAAK,0CAAE,OAAO,0CAAE,UAAU,CAAC;IAE/D,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,mCAAoC,OAAO,CAAC,IAAK,EAAE,CAAC,CAAC;KACt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|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const generator_1 = require("./generator");
|
|
5
|
+
const schematic = (0, devkit_1.convertNxGenerator)(generator_1.default);
|
|
6
|
+
exports.default = schematic;
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-application/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-application/index.ts"],"names":[],"mappings":";;AAAA,uCAAgD;AAChD,2CAAoC;AAEpC,MAAM,SAAS,GAAG,IAAA,2BAAkB,EAAC,mBAAS,CAAC,CAAC;AAChD,kBAAe,SAAS,CAAC"}
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initLibraryGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const generator_utilities_1 = require("@rxap/generator-utilities");
|
|
7
|
+
const workspace_utilities_1 = require("@rxap/workspace-utilities");
|
|
8
|
+
const skip_non_nest_project_1 = require("../../lib/skip-non-nest-project");
|
|
5
9
|
function skipProject(tree, options, project, projectName) {
|
|
6
|
-
if (SkipNonNestProject(tree, options, project, projectName)) {
|
|
10
|
+
if ((0, skip_non_nest_project_1.SkipNonNestProject)(tree, options, project, projectName)) {
|
|
7
11
|
return true;
|
|
8
12
|
}
|
|
9
|
-
if (SkipNonLibraryProject(tree, options, project, projectName)) {
|
|
13
|
+
if ((0, generator_utilities_1.SkipNonLibraryProject)(tree, options, project, projectName)) {
|
|
10
14
|
return true;
|
|
11
15
|
}
|
|
12
16
|
return false;
|
|
13
17
|
}
|
|
14
18
|
function setGeneralTargetDefaults(tree) {
|
|
15
|
-
const nxJson = readNxJson(tree);
|
|
16
|
-
CoerceTargetDefaultsDependency(nxJson, 'build', 'check-version');
|
|
17
|
-
updateNxJson(tree, nxJson);
|
|
19
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
20
|
+
(0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'build', 'check-version');
|
|
21
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
18
22
|
}
|
|
19
23
|
function updateProjectTargets(tree, project) {
|
|
20
|
-
if (IsPublishable(tree, project)) {
|
|
21
|
-
CoerceTarget(project, 'check-version', {
|
|
24
|
+
if ((0, generator_utilities_1.IsPublishable)(tree, project)) {
|
|
25
|
+
(0, workspace_utilities_1.CoerceTarget)(project, 'check-version', {
|
|
22
26
|
executor: '@rxap/plugin-library:check-version',
|
|
23
27
|
options: {
|
|
24
28
|
packageName: '@nestjs/core',
|
|
@@ -26,18 +30,21 @@ function updateProjectTargets(tree, project) {
|
|
|
26
30
|
});
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
function initLibraryGenerator(tree, options) {
|
|
34
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
console.log('nestjs library init generator:', options);
|
|
36
|
+
setGeneralTargetDefaults(tree);
|
|
37
|
+
for (const [projectName, project] of (0, devkit_1.getProjects)(tree).entries()) {
|
|
38
|
+
if (skipProject(tree, options, project, projectName)) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
console.log(`init project: ${projectName}`);
|
|
42
|
+
updateProjectTargets(tree, project);
|
|
43
|
+
// apply changes to the project configuration
|
|
44
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
|
|
35
45
|
}
|
|
36
|
-
|
|
37
|
-
updateProjectTargets(tree, project);
|
|
38
|
-
// apply changes to the project configuration
|
|
39
|
-
updateProjectConfiguration(tree, projectName, project);
|
|
40
|
-
}
|
|
46
|
+
});
|
|
41
47
|
}
|
|
42
|
-
|
|
48
|
+
exports.initLibraryGenerator = initLibraryGenerator;
|
|
49
|
+
exports.default = initLibraryGenerator;
|
|
43
50
|
//# sourceMappingURL=generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-library/generator.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-library/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAOoB;AACpB,mEAGmC;AACnC,mEAGmC;AACnC,2EAAqE;AAGrE,SAAS,WAAW,CAClB,IAAU,EACV,OAAuC,EACvC,OAA6B,EAC7B,WAAmB;IAGnB,IAAI,IAAA,0CAAkB,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;QAC3D,OAAO,IAAI,CAAC;KACb;IAED,IAAI,IAAA,2CAAqB,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;QAC9D,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AAEf,CAAC;AAED,SAAS,wBAAwB,CAAC,IAAU;IAC1C,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC;IAEhC,IAAA,oDAA8B,EAAC,MAAM,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;IAEjE,IAAA,qBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAU,EAAE,OAA6B;IAErE,IAAI,IAAA,mCAAa,EAAC,IAAI,EAAE,OAAO,CAAC,EAAE;QAChC,IAAA,kCAAY,EAAC,OAAO,EAAE,eAAe,EAAE;YACrC,QAAQ,EAAE,oCAAoC;YAC9C,OAAO,EAAE;gBACP,WAAW,EAAE,cAAc;aAC5B;SACF,CAAC,CAAC;KACJ;AAEH,CAAC;AAED,SAAsB,oBAAoB,CACxC,IAAU,EACV,OAAuC;;QAEvC,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;QAEvD,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAE/B,KAAK,MAAM,CAAE,WAAW,EAAE,OAAO,CAAE,IAAI,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;YAElE,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;gBACpD,SAAS;aACV;YAED,OAAO,CAAC,GAAG,CAAC,iBAAkB,WAAY,EAAE,CAAC,CAAC;YAE9C,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAGpC,6CAA6C;YAC7C,IAAA,mCAA0B,EAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;SACxD;IACH,CAAC;CAAA;AAtBD,oDAsBC;AAED,kBAAe,oBAAoB,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const generator_1 = require("./generator");
|
|
5
|
+
const schematic = (0, devkit_1.convertNxGenerator)(generator_1.default);
|
|
6
|
+
exports.default = schematic;
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-library/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-library/index.ts"],"names":[],"mappings":";;AAAA,uCAAgD;AAChD,2CAAoC;AAEpC,MAAM,SAAS,GAAG,IAAA,2BAAkB,EAAC,mBAAS,CAAC,CAAC;AAChD,kBAAe,SAAS,CAAC"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.swaggerGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const generator_utilities_1 = require("@rxap/generator-utilities");
|
|
7
|
+
const plugin_utilities_1 = require("@rxap/plugin-utilities");
|
|
8
|
+
const workspace_utilities_1 = require("@rxap/workspace-utilities");
|
|
9
|
+
const path = require("path");
|
|
10
|
+
const path_1 = require("path");
|
|
7
11
|
function updateProjectTargets(project) {
|
|
8
|
-
const buildTarget = GetTarget(project, 'build');
|
|
9
|
-
const buildTargetOptions = GetTargetOptions(buildTarget);
|
|
12
|
+
const buildTarget = (0, plugin_utilities_1.GetTarget)(project, 'build');
|
|
13
|
+
const buildTargetOptions = (0, plugin_utilities_1.GetTargetOptions)(buildTarget);
|
|
10
14
|
if (!buildTargetOptions['outputPath']) {
|
|
11
15
|
throw new Error('The selected project has the build target without the option outputPath');
|
|
12
16
|
}
|
|
@@ -14,7 +18,7 @@ function updateProjectTargets(project) {
|
|
|
14
18
|
throw new Error('The selected project has the build target without the option tsConfig');
|
|
15
19
|
}
|
|
16
20
|
const outputPath = buildTargetOptions['outputPath'].replace('dist/', 'dist/swagger/');
|
|
17
|
-
CoerceTarget(project, 'swagger-build', {
|
|
21
|
+
(0, workspace_utilities_1.CoerceTarget)(project, 'swagger-build', {
|
|
18
22
|
executor: '@nx/webpack:webpack',
|
|
19
23
|
outputs: ['{options.outputPath}'],
|
|
20
24
|
options: {
|
|
@@ -33,7 +37,7 @@ function updateProjectTargets(project) {
|
|
|
33
37
|
],
|
|
34
38
|
},
|
|
35
39
|
});
|
|
36
|
-
CoerceTarget(project, 'swagger-generate', {
|
|
40
|
+
(0, workspace_utilities_1.CoerceTarget)(project, 'swagger-generate', {
|
|
37
41
|
executor: '@nx/js:node',
|
|
38
42
|
outputs: [
|
|
39
43
|
`${outputPath}/open-api.json`,
|
|
@@ -45,31 +49,36 @@ function updateProjectTargets(project) {
|
|
|
45
49
|
});
|
|
46
50
|
}
|
|
47
51
|
function updateNxDefaults(tree) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
nxJson
|
|
52
|
+
var _a, _b, _c, _d;
|
|
53
|
+
var _e, _f, _g;
|
|
54
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
55
|
+
(_a = nxJson.tasksRunnerOptions) !== null && _a !== void 0 ? _a : (nxJson.tasksRunnerOptions = {});
|
|
56
|
+
(_b = (_e = nxJson.tasksRunnerOptions)['default']) !== null && _b !== void 0 ? _b : (_e['default'] = {
|
|
51
57
|
runner: 'nx-cloud',
|
|
52
58
|
options: {},
|
|
53
|
-
};
|
|
54
|
-
nxJson.tasksRunnerOptions['default'].options
|
|
55
|
-
nxJson.tasksRunnerOptions['default'].options['cacheableOperations']
|
|
59
|
+
});
|
|
60
|
+
(_c = (_f = nxJson.tasksRunnerOptions['default']).options) !== null && _c !== void 0 ? _c : (_f.options = {});
|
|
61
|
+
(_d = (_g = nxJson.tasksRunnerOptions['default'].options)['cacheableOperations']) !== null && _d !== void 0 ? _d : (_g['cacheableOperations'] = []);
|
|
56
62
|
if (!nxJson.tasksRunnerOptions['default'].options['cacheableOperations'].includes('swagger-build')) {
|
|
57
63
|
nxJson.tasksRunnerOptions['default'].options['cacheableOperations'].push('swagger-build');
|
|
58
64
|
}
|
|
59
65
|
if (!nxJson.tasksRunnerOptions['default'].options['cacheableOperations'].includes('swagger-generate')) {
|
|
60
66
|
nxJson.tasksRunnerOptions['default'].options['cacheableOperations'].push('swagger-generate');
|
|
61
67
|
}
|
|
62
|
-
updateNxJson(tree, nxJson);
|
|
68
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
63
69
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
function swaggerGenerator(tree, options) {
|
|
71
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const projectRoot = (0, generator_utilities_1.GetProjectRoot)(tree, options.project);
|
|
73
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), (0, path_1.join)(projectRoot, 'src'), { tmpl: '' });
|
|
74
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
75
|
+
updateNxDefaults(tree);
|
|
76
|
+
updateProjectTargets(project);
|
|
77
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.project, project);
|
|
78
|
+
yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, 'swagger-ui-express', 'latest', { soft: true });
|
|
79
|
+
yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@nestjs/swagger', 'latest', { soft: true });
|
|
80
|
+
});
|
|
73
81
|
}
|
|
74
|
-
|
|
82
|
+
exports.swaggerGenerator = swaggerGenerator;
|
|
83
|
+
exports.default = swaggerGenerator;
|
|
75
84
|
//# sourceMappingURL=generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/swagger/generator.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/swagger/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAQoB;AACpB,mEAA2D;AAC3D,6DAGgC;AAChC,mEAGmC;AACnC,6BAA6B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AAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,IAAA,WAAI,EAAC,WAAW,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAE3F,MAAM,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAEhE,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACvB,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAE9B,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAE3D,MAAM,IAAA,8CAAwB,EAAC,IAAI,EAAE,oBAAoB,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACrF,MAAM,IAAA,8CAAwB,EAAC,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAEpF,CAAC;CAAA;AAjBD,4CAiBC;AAED,kBAAe,gBAAgB,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const generator_1 = require("./generator");
|
|
5
|
+
const schematic = (0, devkit_1.convertNxGenerator)(generator_1.default);
|
|
6
|
+
exports.default = schematic;
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/swagger/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/swagger/index.ts"],"names":[],"mappings":";;AAAA,uCAAgD;AAChD,2CAAoC;AAEpC,MAAM,SAAS,GAAG,IAAA,2BAAkB,EAAC,mBAAS,CAAC,CAAC;AAChD,kBAAe,SAAS,CAAC"}
|
package/src/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NestJsSwaggerGenerator = exports.nestJsInitGenerator = void 0;
|
|
4
|
+
var generator_1 = require("./generators/init/generator");
|
|
5
|
+
Object.defineProperty(exports, "nestJsInitGenerator", { enumerable: true, get: function () { return generator_1.initGenerator; } });
|
|
6
|
+
var generator_2 = require("./generators/swagger/generator");
|
|
7
|
+
Object.defineProperty(exports, "NestJsSwaggerGenerator", { enumerable: true, get: function () { return generator_2.swaggerGenerator; } });
|
|
3
8
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/plugin/nestjs/src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/plugin/nestjs/src/index.ts"],"names":[],"mappings":";;;AAAA,yDAAmF;AAA1E,gHAAA,aAAa,OAAuB;AAC7C,4DAA4F;AAAnF,mHAAA,gBAAgB,OAA0B"}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SkipNonNestProject = void 0;
|
|
4
|
+
const generator_utilities_1 = require("@rxap/generator-utilities");
|
|
5
|
+
function SkipNonNestProject(tree, options, project, projectName) {
|
|
6
|
+
var _a, _b, _c, _d;
|
|
7
|
+
if ((0, generator_utilities_1.SkipProject)(tree, options, project, projectName)) {
|
|
4
8
|
return true;
|
|
5
9
|
}
|
|
6
|
-
if (!project.tags
|
|
10
|
+
if (!((_a = project.tags) === null || _a === void 0 ? void 0 : _a.includes('nest')) && !((_b = project.tags) === null || _b === void 0 ? void 0 : _b.includes('nestjs'))) {
|
|
7
11
|
return true;
|
|
8
12
|
}
|
|
9
|
-
if (project.tags
|
|
13
|
+
if (((_c = project.tags) === null || _c === void 0 ? void 0 : _c.includes('plugin')) || ((_d = project.tags) === null || _d === void 0 ? void 0 : _d.includes('schematic'))) {
|
|
10
14
|
return true;
|
|
11
15
|
}
|
|
12
16
|
return false;
|
|
13
17
|
}
|
|
18
|
+
exports.SkipNonNestProject = SkipNonNestProject;
|
|
14
19
|
//# sourceMappingURL=skip-non-nest-project.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skip-non-nest-project.js","sourceRoot":"","sources":["../../../../../../packages/plugin/nestjs/src/lib/skip-non-nest-project.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"skip-non-nest-project.js","sourceRoot":"","sources":["../../../../../../packages/plugin/nestjs/src/lib/skip-non-nest-project.ts"],"names":[],"mappings":";;;AAIA,mEAGmC;AAMnC,SAAgB,kBAAkB,CAChC,IAAU,EACV,OAA2B,EAC3B,OAA6B,EAC7B,WAAmB;;IAEnB,IAAI,IAAA,iCAAW,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;QACpD,OAAO,IAAI,CAAC;KACb;IACD,IAAI,CAAC,CAAA,MAAA,OAAO,CAAC,IAAI,0CAAE,QAAQ,CAAC,MAAM,CAAC,CAAA,IAAI,CAAC,CAAA,MAAA,OAAO,CAAC,IAAI,0CAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA,EAAE;QACxE,OAAO,IAAI,CAAC;KACb;IACD,IAAI,CAAA,MAAA,OAAO,CAAC,IAAI,0CAAE,QAAQ,CAAC,QAAQ,CAAC,MAAI,MAAA,OAAO,CAAC,IAAI,0CAAE,QAAQ,CAAC,WAAW,CAAC,CAAA,EAAE;QAC3E,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAhBD,gDAgBC"}
|