@rxap/plugin-nestjs 16.1.0-dev.7 → 16.1.0-dev.8
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/package.json +5 -5
- package/src/executors/package-json/executor.js +13 -19
- package/src/executors/package-json/executor.js.map +1 -1
- package/src/generators/init/generator.js +25 -26
- package/src/generators/init/generator.js.map +1 -1
- package/src/generators/init/index.js +4 -6
- package/src/generators/init/index.js.map +1 -1
- package/src/generators/init-application/generator.js +84 -90
- package/src/generators/init-application/generator.js.map +1 -1
- package/src/generators/init-application/index.js +4 -6
- package/src/generators/init-application/index.js.map +1 -1
- package/src/generators/init-library/generator.js +23 -30
- package/src/generators/init-library/generator.js.map +1 -1
- package/src/generators/init-library/index.js +4 -6
- package/src/generators/init-library/index.js.map +1 -1
- package/src/generators/swagger/generator.js +27 -36
- package/src/generators/swagger/generator.js.map +1 -1
- package/src/generators/swagger/index.js +4 -6
- package/src/generators/swagger/index.js.map +1 -1
- package/src/index.js +2 -7
- package/src/index.js.map +1 -1
- package/src/lib/skip-non-nest-project.js +5 -10
- 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.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
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- change from commonjs to es2022 ([fd0f2ba](https://gitlab.com/rxap/packages/commit/fd0f2bae24eae7c854e96f630076cd5598c30be6))
|
|
11
|
+
|
|
6
12
|
# [16.1.0-dev.7](https://gitlab.com/rxap/packages/compare/@rxap/plugin-nestjs@16.1.0-dev.6...@rxap/plugin-nestjs@16.1.0-dev.7) (2023-08-14)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
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.8",
|
|
4
|
+
"type": "module",
|
|
5
5
|
"generators": "./generators.json",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@rxap/plugin-utilities": "^16.1.0-dev.6",
|
|
44
44
|
"@rxap/workspace-utilities": "^0.1.0-dev.3",
|
|
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.2",
|
|
47
|
+
"@rxap/utilities": "16.0.0-dev.10"
|
|
48
48
|
},
|
|
49
49
|
"nx-migrations": {
|
|
50
50
|
"packageGroup": [
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"executors": "./executors.json",
|
|
66
66
|
"schematics": "./generators.json",
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "bbab80e59acbe435a02e69c9fec022780cf4640d",
|
|
68
68
|
"main": "./src/index.js",
|
|
69
69
|
"types": "./src/index.d.ts"
|
|
70
70
|
}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
});
|
|
1
|
+
import { GetAllPackageDependenciesForProject, GetProjectRoot, LoadProjectToPackageMapping, } from '@rxap/plugin-utilities';
|
|
2
|
+
import { writeFileSync } from 'fs';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
export default async function runExecutor(options, context) {
|
|
5
|
+
console.log('Executor ran for PackageJson', options);
|
|
6
|
+
LoadProjectToPackageMapping(context);
|
|
7
|
+
const dependencies = GetAllPackageDependenciesForProject(context);
|
|
8
|
+
const packageJson = { dependencies, name: context.projectName, private: true };
|
|
9
|
+
console.log('dependencies', dependencies);
|
|
10
|
+
writeFileSync(join(GetProjectRoot(context), 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
11
|
+
return {
|
|
12
|
+
success: true,
|
|
13
|
+
};
|
|
19
14
|
}
|
|
20
|
-
exports.default = runExecutor;
|
|
21
15
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/executors/package-json/executor.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mCAAmC,EACnC,cAAc,EACd,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,WAAW,CACvC,OAAkC,EAClC,OAAwB;IAExB,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;IAErD,2BAA2B,CAAC,OAAO,CAAC,CAAC;IAErC,MAAM,YAAY,GAAG,mCAAmC,CAAC,OAAO,CAAC,CAAC;IAElE,MAAM,WAAW,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAE/E,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;IAE1C,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAEnG,OAAO;QACL,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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");
|
|
1
|
+
import { getProjects, } from '@nx/devkit';
|
|
2
|
+
import { SkipNonNestProject } from '../../lib/skip-non-nest-project';
|
|
3
|
+
import initApplicationGenerator from '../init-application/generator';
|
|
4
|
+
import initLibraryGenerator from '../init-library/generator';
|
|
9
5
|
function skipProject(tree, options, project, projectName) {
|
|
10
|
-
if (
|
|
6
|
+
if (SkipNonNestProject(tree, options, project, projectName)) {
|
|
11
7
|
return true;
|
|
12
8
|
}
|
|
13
9
|
return false;
|
|
14
10
|
}
|
|
15
|
-
function initGenerator(tree, options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
}
|
|
11
|
+
export async function initGenerator(tree, options) {
|
|
12
|
+
console.log('nestjs init generator:', options);
|
|
13
|
+
for (const [projectName, project] of getProjects(tree).entries()) {
|
|
14
|
+
if (skipProject(tree, options, project, projectName)) {
|
|
15
|
+
continue;
|
|
29
16
|
}
|
|
30
|
-
|
|
17
|
+
console.log(`init project: ${projectName}`);
|
|
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
|
+
}
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
exports.default = initGenerator;
|
|
32
|
+
export default initGenerator;
|
|
34
33
|
//# sourceMappingURL=generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init/generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAGZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AACrE,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAG7D,SAAS,WAAW,CAAC,IAAU,EAAE,OAA4B,EAAE,OAA6B,EAAE,WAAmB;IAE/G,IAAI,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;QAC3D,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AAEf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAU,EAAE,OAA4B;IAC1E,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC;IAE/C,KAAK,MAAM,CAAE,WAAW,EAAE,OAAO,CAAE,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QAElE,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;YACpD,SAAS;SACV;QAED,OAAO,CAAC,GAAG,CAAC,iBAAkB,WAAY,EAAE,CAAC,CAAC;QAE9C,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE;YACrC,MAAM,oBAAoB,CAAC,IAAI,EAC7B;gBACE,GAAG,OAAO;gBACV,QAAQ,EAAE,CAAE,WAAW,CAAE;aAC1B,CACF,CAAC;SACH;QAED,IAAI,OAAO,CAAC,WAAW,KAAK,aAAa,EAAE;YACzC,MAAM,wBAAwB,CAAC,IAAI,EACjC;gBACE,GAAG,OAAO;gBACV,QAAQ,EAAE,CAAE,WAAW,CAAE;aAC1B,CACF,CAAC;SACH;KAEF;AAEH,CAAC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const schematic = (0, devkit_1.convertNxGenerator)(generator_1.default);
|
|
6
|
-
exports.default = schematic;
|
|
1
|
+
import { convertNxGenerator } from '@nx/devkit';
|
|
2
|
+
import generator from './generator';
|
|
3
|
+
const schematic = convertNxGenerator(generator);
|
|
4
|
+
export default schematic;
|
|
7
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,SAAS,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAChD,eAAe,SAAS,CAAC"}
|
|
@@ -1,43 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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");
|
|
1
|
+
import { getProjects, readNxJson, updateNxJson, updateProjectConfiguration, } from '@nx/devkit';
|
|
2
|
+
import libraryGenerator from '@nx/js/src/generators/library/library';
|
|
3
|
+
import { CoerceIgnorePattern, SkipNonApplicationProject, } from '@rxap/generator-utilities';
|
|
4
|
+
import { CoerceTarget, CoerceTargetDefaultsDependency, } from '@rxap/workspace-utilities';
|
|
5
|
+
import { wrapAngularDevkitSchematic } from 'nx/src/adapter/ngcli-adapter';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import { SkipNonNestProject } from '../../lib/skip-non-nest-project';
|
|
8
|
+
import swaggerGenerator from '../swagger/generator';
|
|
13
9
|
function skipProject(tree, options, project, projectName) {
|
|
14
|
-
if (
|
|
10
|
+
if (SkipNonNestProject(tree, options, project, projectName)) {
|
|
15
11
|
return true;
|
|
16
12
|
}
|
|
17
|
-
if (
|
|
13
|
+
if (SkipNonApplicationProject(tree, options, project, projectName)) {
|
|
18
14
|
return true;
|
|
19
15
|
}
|
|
20
16
|
return false;
|
|
21
17
|
}
|
|
22
18
|
function setGeneralTargetDefaults(tree) {
|
|
23
|
-
const nxJson =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
const nxJson = readNxJson(tree);
|
|
20
|
+
CoerceTargetDefaultsDependency(nxJson, 'build', 'generate-package-json');
|
|
21
|
+
CoerceTargetDefaultsDependency(nxJson, 'generate-open-api', 'swagger-generate');
|
|
22
|
+
updateNxJson(tree, nxJson);
|
|
27
23
|
}
|
|
28
24
|
function updateProjectTargets(project) {
|
|
29
|
-
|
|
30
|
-
(0, workspace_utilities_1.CoerceTarget)(project, 'generate-package-json', {
|
|
25
|
+
CoerceTarget(project, 'generate-package-json', {
|
|
31
26
|
executor: '@rxap/plugin-nestjs:package-json',
|
|
32
27
|
configurations: {
|
|
33
28
|
production: {},
|
|
34
29
|
},
|
|
35
30
|
});
|
|
36
|
-
const outputPath =
|
|
31
|
+
const outputPath = project.targets?.build?.options?.outputPath;
|
|
37
32
|
if (!outputPath) {
|
|
38
33
|
throw new Error(`No outputPath found for project ${project.name}`);
|
|
39
34
|
}
|
|
40
|
-
|
|
35
|
+
CoerceTarget(project, 'generate-open-api', {
|
|
41
36
|
executor: '@rxap/plugin-library:run-generator',
|
|
42
37
|
options: {
|
|
43
38
|
generator: '@rxap/schematics-open-api:generate',
|
|
@@ -50,77 +45,76 @@ function updateProjectTargets(project) {
|
|
|
50
45
|
});
|
|
51
46
|
}
|
|
52
47
|
function updateGitIgnore(tree, project) {
|
|
53
|
-
|
|
48
|
+
CoerceIgnorePattern(tree, join(project.root, '.gitignore'), ['package.json']);
|
|
54
49
|
}
|
|
55
|
-
function createOpenApiClientSdkLibrary(tree, project, projects) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
50
|
+
async function createOpenApiClientSdkLibrary(tree, project, projects) {
|
|
51
|
+
const openApiProjectName = `open-api-${project.name}`;
|
|
52
|
+
if (projects.has(openApiProjectName)) {
|
|
53
|
+
return;
|
|
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;
|
|
86
100
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
101
|
+
console.log(`init project: ${projectName}`);
|
|
102
|
+
updateProjectTargets(project);
|
|
103
|
+
updateGitIgnore(tree, project);
|
|
104
|
+
await createOpenApiClientSdkLibrary(tree, project, projects);
|
|
105
|
+
// apply changes to the project configuration
|
|
106
|
+
updateProjectConfiguration(tree, projectName, project);
|
|
107
|
+
if (options.swagger !== false) {
|
|
108
|
+
await swaggerGenerator(tree, { project: projectName });
|
|
90
109
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
}
|
|
110
|
+
if (options.legacy) {
|
|
111
|
+
await wrapAngularDevkitSchematic('@rxap/schematic-nestjs', 'init')(tree, {
|
|
112
|
+
...options,
|
|
113
|
+
swagger: false,
|
|
114
|
+
project: projectName,
|
|
115
|
+
});
|
|
121
116
|
}
|
|
122
|
-
}
|
|
117
|
+
}
|
|
123
118
|
}
|
|
124
|
-
|
|
125
|
-
exports.default = initApplicationGenerator;
|
|
119
|
+
export default initApplicationGenerator;
|
|
126
120
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-application/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEX,UAAU,EAEV,YAAY,EACZ,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,gBAAgB,MAAM,uCAAuC,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,YAAY,EACZ,8BAA8B,GAC/B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;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AAC;IAE/B,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAEnC,KAAK,MAAM,CAAE,WAAW,EAAE,OAAO,CAAE,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE;QAEzD,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;YACpD,SAAS;SACV;QAED,OAAO,CAAC,GAAG,CAAC,iBAAkB,WAAY,EAAE,CAAC,CAAC;QAE9C,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAC9B,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/B,MAAM,6BAA6B,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAE7D,6CAA6C;QAC7C,0BAA0B,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QAEvD,IAAI,OAAO,CAAC,OAAO,KAAK,KAAK,EAAE;YAC7B,MAAM,gBAAgB,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;SACxD;QAED,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,MAAM,0BAA0B,CAC9B,wBAAwB,EACxB,MAAM,CACP,CAAC,IAAI,EAAE;gBACN,GAAG,OAAO;gBACV,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,WAAW;aACrB,CAAC,CAAC;SACJ;KAEF;AACH,CAAC;AAED,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const schematic = (0, devkit_1.convertNxGenerator)(generator_1.default);
|
|
6
|
-
exports.default = schematic;
|
|
1
|
+
import { convertNxGenerator } from '@nx/devkit';
|
|
2
|
+
import generator from './generator';
|
|
3
|
+
const schematic = convertNxGenerator(generator);
|
|
4
|
+
export default schematic;
|
|
7
5
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-application/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,SAAS,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAChD,eAAe,SAAS,CAAC"}
|
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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");
|
|
1
|
+
import { getProjects, readNxJson, updateNxJson, updateProjectConfiguration, } from '@nx/devkit';
|
|
2
|
+
import { IsPublishable, SkipNonLibraryProject, } from '@rxap/generator-utilities';
|
|
3
|
+
import { CoerceTarget, CoerceTargetDefaultsDependency, } from '@rxap/workspace-utilities';
|
|
4
|
+
import { SkipNonNestProject } from '../../lib/skip-non-nest-project';
|
|
9
5
|
function skipProject(tree, options, project, projectName) {
|
|
10
|
-
if (
|
|
6
|
+
if (SkipNonNestProject(tree, options, project, projectName)) {
|
|
11
7
|
return true;
|
|
12
8
|
}
|
|
13
|
-
if (
|
|
9
|
+
if (SkipNonLibraryProject(tree, options, project, projectName)) {
|
|
14
10
|
return true;
|
|
15
11
|
}
|
|
16
12
|
return false;
|
|
17
13
|
}
|
|
18
14
|
function setGeneralTargetDefaults(tree) {
|
|
19
|
-
const nxJson =
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
const nxJson = readNxJson(tree);
|
|
16
|
+
CoerceTargetDefaultsDependency(nxJson, 'build', 'check-version');
|
|
17
|
+
updateNxJson(tree, nxJson);
|
|
22
18
|
}
|
|
23
19
|
function updateProjectTargets(tree, project) {
|
|
24
|
-
if (
|
|
25
|
-
|
|
20
|
+
if (IsPublishable(tree, project)) {
|
|
21
|
+
CoerceTarget(project, 'check-version', {
|
|
26
22
|
executor: '@rxap/plugin-library:check-version',
|
|
27
23
|
options: {
|
|
28
24
|
packageName: '@nestjs/core',
|
|
@@ -30,21 +26,18 @@ function updateProjectTargets(tree, project) {
|
|
|
30
26
|
});
|
|
31
27
|
}
|
|
32
28
|
}
|
|
33
|
-
function initLibraryGenerator(tree, options) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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);
|
|
29
|
+
export async function initLibraryGenerator(tree, options) {
|
|
30
|
+
console.log('nestjs library init generator:', options);
|
|
31
|
+
setGeneralTargetDefaults(tree);
|
|
32
|
+
for (const [projectName, project] of getProjects(tree).entries()) {
|
|
33
|
+
if (skipProject(tree, options, project, projectName)) {
|
|
34
|
+
continue;
|
|
45
35
|
}
|
|
46
|
-
|
|
36
|
+
console.log(`init project: ${projectName}`);
|
|
37
|
+
updateProjectTargets(tree, project);
|
|
38
|
+
// apply changes to the project configuration
|
|
39
|
+
updateProjectConfiguration(tree, projectName, project);
|
|
40
|
+
}
|
|
47
41
|
}
|
|
48
|
-
|
|
49
|
-
exports.default = initLibraryGenerator;
|
|
42
|
+
export default initLibraryGenerator;
|
|
50
43
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-library/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEX,UAAU,EAEV,YAAY,EACZ,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,aAAa,EACb,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,YAAY,EACZ,8BAA8B,GAC/B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAGrE,SAAS,WAAW,CAClB,IAAU,EACV,OAAuC,EACvC,OAA6B,EAC7B,WAAmB;IAGnB,IAAI,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;QAC3D,OAAO,IAAI,CAAC;KACb;IAED,IAAI,qBAAqB,CAAC,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,UAAU,CAAC,IAAI,CAAC,CAAC;IAEhC,8BAA8B,CAAC,MAAM,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;IAEjE,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAU,EAAE,OAA6B;IAErE,IAAI,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE;QAChC,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE;YACrC,QAAQ,EAAE,oCAAoC;YAC9C,OAAO,EAAE;gBACP,WAAW,EAAE,cAAc;aAC5B;SACF,CAAC,CAAC;KACJ;AAEH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,IAAU,EACV,OAAuC;IAEvC,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IAEvD,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAE/B,KAAK,MAAM,CAAE,WAAW,EAAE,OAAO,CAAE,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QAElE,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;YACpD,SAAS;SACV;QAED,OAAO,CAAC,GAAG,CAAC,iBAAkB,WAAY,EAAE,CAAC,CAAC;QAE9C,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAGpC,6CAA6C;QAC7C,0BAA0B,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;KACxD;AACH,CAAC;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const schematic = (0, devkit_1.convertNxGenerator)(generator_1.default);
|
|
6
|
-
exports.default = schematic;
|
|
1
|
+
import { convertNxGenerator } from '@nx/devkit';
|
|
2
|
+
import generator from './generator';
|
|
3
|
+
const schematic = convertNxGenerator(generator);
|
|
4
|
+
export default schematic;
|
|
7
5
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/init-library/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,SAAS,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAChD,eAAe,SAAS,CAAC"}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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");
|
|
1
|
+
import { generateFiles, readNxJson, readProjectConfiguration, updateNxJson, updateProjectConfiguration, } from '@nx/devkit';
|
|
2
|
+
import { GetProjectRoot } from '@rxap/generator-utilities';
|
|
3
|
+
import { GetTarget, GetTargetOptions, } from '@rxap/plugin-utilities';
|
|
4
|
+
import { AddPackageJsonDependency, CoerceTarget, } from '@rxap/workspace-utilities';
|
|
5
|
+
import * as path from 'path';
|
|
6
|
+
import { join } from 'path';
|
|
11
7
|
function updateProjectTargets(project) {
|
|
12
|
-
const buildTarget =
|
|
13
|
-
const buildTargetOptions =
|
|
8
|
+
const buildTarget = GetTarget(project, 'build');
|
|
9
|
+
const buildTargetOptions = GetTargetOptions(buildTarget);
|
|
14
10
|
if (!buildTargetOptions['outputPath']) {
|
|
15
11
|
throw new Error('The selected project has the build target without the option outputPath');
|
|
16
12
|
}
|
|
@@ -18,7 +14,7 @@ function updateProjectTargets(project) {
|
|
|
18
14
|
throw new Error('The selected project has the build target without the option tsConfig');
|
|
19
15
|
}
|
|
20
16
|
const outputPath = buildTargetOptions['outputPath'].replace('dist/', 'dist/swagger/');
|
|
21
|
-
|
|
17
|
+
CoerceTarget(project, 'swagger-build', {
|
|
22
18
|
executor: '@nx/webpack:webpack',
|
|
23
19
|
outputs: ['{options.outputPath}'],
|
|
24
20
|
options: {
|
|
@@ -37,7 +33,7 @@ function updateProjectTargets(project) {
|
|
|
37
33
|
],
|
|
38
34
|
},
|
|
39
35
|
});
|
|
40
|
-
|
|
36
|
+
CoerceTarget(project, 'swagger-generate', {
|
|
41
37
|
executor: '@nx/js:node',
|
|
42
38
|
outputs: [
|
|
43
39
|
`${outputPath}/open-api.json`,
|
|
@@ -49,36 +45,31 @@ function updateProjectTargets(project) {
|
|
|
49
45
|
});
|
|
50
46
|
}
|
|
51
47
|
function updateNxDefaults(tree) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
(_a = nxJson.tasksRunnerOptions) !== null && _a !== void 0 ? _a : (nxJson.tasksRunnerOptions = {});
|
|
56
|
-
(_b = (_e = nxJson.tasksRunnerOptions)['default']) !== null && _b !== void 0 ? _b : (_e['default'] = {
|
|
48
|
+
const nxJson = readNxJson(tree);
|
|
49
|
+
nxJson.tasksRunnerOptions ??= {};
|
|
50
|
+
nxJson.tasksRunnerOptions['default'] ??= {
|
|
57
51
|
runner: 'nx-cloud',
|
|
58
52
|
options: {},
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
};
|
|
54
|
+
nxJson.tasksRunnerOptions['default'].options ??= {};
|
|
55
|
+
nxJson.tasksRunnerOptions['default'].options['cacheableOperations'] ??= [];
|
|
62
56
|
if (!nxJson.tasksRunnerOptions['default'].options['cacheableOperations'].includes('swagger-build')) {
|
|
63
57
|
nxJson.tasksRunnerOptions['default'].options['cacheableOperations'].push('swagger-build');
|
|
64
58
|
}
|
|
65
59
|
if (!nxJson.tasksRunnerOptions['default'].options['cacheableOperations'].includes('swagger-generate')) {
|
|
66
60
|
nxJson.tasksRunnerOptions['default'].options['cacheableOperations'].push('swagger-generate');
|
|
67
61
|
}
|
|
68
|
-
|
|
62
|
+
updateNxJson(tree, nxJson);
|
|
69
63
|
}
|
|
70
|
-
function swaggerGenerator(tree, options) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@nestjs/swagger', 'latest', { soft: true });
|
|
80
|
-
});
|
|
64
|
+
export async function swaggerGenerator(tree, options) {
|
|
65
|
+
const projectRoot = GetProjectRoot(tree, options.project);
|
|
66
|
+
generateFiles(tree, path.join(__dirname, 'files'), join(projectRoot, 'src'), { tmpl: '' });
|
|
67
|
+
const project = readProjectConfiguration(tree, options.project);
|
|
68
|
+
updateNxDefaults(tree);
|
|
69
|
+
updateProjectTargets(project);
|
|
70
|
+
updateProjectConfiguration(tree, options.project, project);
|
|
71
|
+
await AddPackageJsonDependency(tree, 'swagger-ui-express', 'latest', { soft: true });
|
|
72
|
+
await AddPackageJsonDependency(tree, '@nestjs/swagger', 'latest', { soft: true });
|
|
81
73
|
}
|
|
82
|
-
|
|
83
|
-
exports.default = swaggerGenerator;
|
|
74
|
+
export default swaggerGenerator;
|
|
84
75
|
//# sourceMappingURL=generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/swagger/generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/swagger/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,UAAU,EACV,wBAAwB,EAExB,YAAY,EACZ,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EACL,SAAS,EACT,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,wBAAwB,EACxB,YAAY,GACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,SAAS,oBAAoB,CAAC,OAA6B;IAEzD,MAAM,WAAW,GAAG,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAChD,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,WAAW,CAAC,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E,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACvB,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAE9B,0BAA0B,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAE3D,MAAM,wBAAwB,CAAC,IAAI,EAAE,oBAAoB,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACrF,MAAM,wBAAwB,CAAC,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAEpF,CAAC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const schematic = (0, devkit_1.convertNxGenerator)(generator_1.default);
|
|
6
|
-
exports.default = schematic;
|
|
1
|
+
import { convertNxGenerator } from '@nx/devkit';
|
|
2
|
+
import generator from './generator';
|
|
3
|
+
const schematic = convertNxGenerator(generator);
|
|
4
|
+
export default schematic;
|
|
7
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/swagger/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/nestjs/src/generators/swagger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,SAAS,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAChD,eAAe,SAAS,CAAC"}
|
package/src/index.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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; } });
|
|
1
|
+
export { initGenerator as nestJsInitGenerator } from './generators/init/generator';
|
|
2
|
+
export { swaggerGenerator as NestJsSwaggerGenerator } from './generators/swagger/generator';
|
|
8
3
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/plugin/nestjs/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,gBAAgB,IAAI,sBAAsB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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)) {
|
|
1
|
+
import { SkipProject, } from '@rxap/generator-utilities';
|
|
2
|
+
export function SkipNonNestProject(tree, options, project, projectName) {
|
|
3
|
+
if (SkipProject(tree, options, project, projectName)) {
|
|
8
4
|
return true;
|
|
9
5
|
}
|
|
10
|
-
if (!
|
|
6
|
+
if (!project.tags?.includes('nest') && !project.tags?.includes('nestjs')) {
|
|
11
7
|
return true;
|
|
12
8
|
}
|
|
13
|
-
if (
|
|
9
|
+
if (project.tags?.includes('plugin') || project.tags?.includes('schematic')) {
|
|
14
10
|
return true;
|
|
15
11
|
}
|
|
16
12
|
return false;
|
|
17
13
|
}
|
|
18
|
-
exports.SkipNonNestProject = SkipNonNestProject;
|
|
19
14
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"skip-non-nest-project.js","sourceRoot":"","sources":["../../../../../../packages/plugin/nestjs/src/lib/skip-non-nest-project.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,WAAW,GAEZ,MAAM,2BAA2B,CAAC;AAMnC,MAAM,UAAU,kBAAkB,CAChC,IAAU,EACV,OAA2B,EAC3B,OAA6B,EAC7B,WAAmB;IAEnB,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;QACpD,OAAO,IAAI,CAAC;KACb;IACD,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE;QACxE,OAAO,IAAI,CAAC;KACb;IACD,IAAI,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE;QAC3E,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|