@rxap/open-api 22.0.0-dev.0 → 22.0.0-dev.2
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 +46 -0
- package/README.md +5 -3
- package/compodoc/architecture.html +222 -0
- package/compodoc/changelog.html +90 -5
- package/compodoc/classes/OpenApiHttpResponseError.html +110 -39
- package/compodoc/classes/RxapOpenApiError.html +77 -10
- package/compodoc/classes/SchemaValidationMixin.html +100 -29
- package/compodoc/dependencies.html +128 -35
- package/compodoc/index.html +50 -8
- package/compodoc/injectables/OpenApiConfigService.html +112 -38
- package/compodoc/interfaces/OpenApiInitOptions.html +166 -111
- package/compodoc/interfaces/OpenApiMetaData.html +259 -175
- package/compodoc/interfaces/OperationObjectWithMetadata.html +165 -91
- package/compodoc/interfaces/SchemaValidationResponse.html +247 -182
- package/compodoc/js/architecture-graph.js +288 -0
- package/compodoc/js/libs/bootstrap-native.js +4 -2
- package/compodoc/js/libs/jszip.min.js +13 -0
- package/compodoc/js/libs/svg-pan-zoom.min.js +3 -3
- package/compodoc/js/libs/tablesort.min.js +3 -3
- package/compodoc/js/libs/tablesort.number.min.js +3 -3
- package/compodoc/js/libs/vis-network.min.js +78 -0
- package/compodoc/js/menu-wc.js +27 -14
- package/compodoc/js/menu.js +10 -11
- package/compodoc/js/routes/routes_index.js +1 -0
- package/compodoc/js/routes.js +142 -34
- package/compodoc/js/search/search-lunr.js +6 -8
- package/compodoc/js/search/search.js +118 -66
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/js/tabs.js +98 -15
- package/compodoc/js/tree.js +44 -7
- package/compodoc/license.html +48 -6
- package/compodoc/llms.txt +156 -0
- package/compodoc/miscellaneous/functions.html +167 -19
- package/compodoc/miscellaneous/typealiases.html +46 -4
- package/compodoc/miscellaneous/variables.html +123 -16
- package/compodoc/modules.html +44 -3
- package/compodoc/overview.html +54 -3
- package/compodoc/properties.html +45 -4
- package/compodoc/routes.html +227 -0
- package/compodoc/styles/compodoc.css +365 -44
- package/compodoc/styles/dark.css +16 -0
- package/compodoc/template-playground/default-templates.json +192 -0
- package/compodoc/template-playground/hbs-render.service.ts +217 -0
- package/compodoc/template-playground/main.ts +9 -0
- package/compodoc/template-playground/template-editor.service.ts +173 -0
- package/compodoc/template-playground/template-playground.component.ts +614 -0
- package/compodoc/template-playground/template-playground.module.ts +29 -0
- package/compodoc/template-playground/zip-export.service.ts +86 -0
- package/compodoc/template-playground-app/app.js +1389 -0
- package/compodoc/template-playground-app/index.html +462 -0
- package/docs/documentation.json +1287 -1054
- package/docs/html/assets/highlight.css +1 -1
- package/docs/html/assets/icons.js +1 -1
- package/docs/html/assets/icons.svg +1 -1
- package/docs/html/assets/main.js +5 -5
- package/docs/html/assets/navigation.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/assets/style.css +265 -228
- package/docs/html/classes/OpenApiConfigService.html +216 -14
- package/docs/html/classes/OpenApiHttpResponseError.html +215 -26
- package/docs/html/classes/RxapOpenApiError.html +242 -23
- package/docs/html/classes/SchemaValidationMixin.html +245 -16
- package/docs/html/functions/AssertOpenApiV3.html +42 -1
- package/docs/html/functions/IsOpenApiV3.html +42 -1
- package/docs/html/functions/IsReferenceObject.html +42 -1
- package/docs/html/functions/NotContainsReferenceObjects.html +46 -1
- package/docs/html/functions/OpenApiInit.html +43 -1
- package/docs/html/functions/getJsonContentSchema.html +42 -1
- package/docs/html/functions/getJsonSchema.html +42 -1
- package/docs/html/functions/hasJsonContentSchema.html +46 -1
- package/docs/html/functions/hasJsonSchema.html +42 -1
- package/docs/html/hierarchy.html +29 -0
- package/docs/html/index.html +44 -7
- package/docs/html/interfaces/OpenApiInitOptions.html +65 -5
- package/docs/html/interfaces/OpenApiMetaData.html +98 -9
- package/docs/html/interfaces/OperationObjectWithMetadata.html +151 -15
- package/docs/html/interfaces/SchemaValidationResponse.html +77 -5
- package/docs/html/modules.html +52 -1
- package/docs/html/types/OperationMap.html +33 -1
- package/docs/html/variables/DEFAULT_OPEN_API_DATA_SOURCE_META_DATA.html +33 -1
- package/docs/html/variables/DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA.html +33 -1
- package/docs/html/variables/DISABLE_SCHEMA_VALIDATION.html +33 -1
- package/docs/html/variables/DISABLE_VALIDATION.html +33 -1
- package/docs/html/variables/OPEN_API_OPERATION.html +33 -1
- package/docs/html/variables/OPEN_API_OPERATION_ID.html +33 -1
- package/docs/html/variables/OPEN_API_SERVER_ID.html +33 -1
- package/docs/html/variables/OPEN_API_SERVER_INDEX.html +33 -1
- package/docs/html/variables/RXAP_OPEN_API_CONFIG.html +33 -1
- package/docs/html/variables/RXAP_OPEN_API_STRICT_VALIDATOR.html +33 -1
- package/docs/html/variables/injectOpenApiBaseUrlHttpInterceptorFn.html +33 -0
- package/docs/markdown/README.md +6 -4
- package/docs/markdown/classes/OpenApiConfigService.md +27 -27
- package/docs/markdown/classes/OpenApiHttpResponseError.md +26 -26
- package/docs/markdown/classes/RxapOpenApiError.md +25 -25
- package/docs/markdown/classes/SchemaValidationMixin.md +36 -30
- package/docs/markdown/functions/AssertOpenApiV3.md +3 -3
- package/docs/markdown/functions/IsOpenApiV3.md +3 -3
- package/docs/markdown/functions/IsReferenceObject.md +3 -3
- package/docs/markdown/functions/NotContainsReferenceObjects.md +7 -5
- package/docs/markdown/functions/OpenApiInit.md +5 -5
- package/docs/markdown/functions/getJsonContentSchema.md +5 -5
- package/docs/markdown/functions/getJsonSchema.md +5 -5
- package/docs/markdown/functions/hasJsonContentSchema.md +8 -6
- package/docs/markdown/functions/hasJsonSchema.md +3 -3
- package/docs/markdown/globals.md +3 -3
- package/docs/markdown/interfaces/OpenApiInitOptions.md +6 -6
- package/docs/markdown/interfaces/OpenApiMetaData.md +12 -12
- package/docs/markdown/interfaces/OperationObjectWithMetadata.md +27 -27
- package/docs/markdown/interfaces/SchemaValidationResponse.md +11 -9
- package/docs/markdown/type-aliases/OperationMap.md +3 -3
- package/docs/markdown/variables/DEFAULT_OPEN_API_DATA_SOURCE_META_DATA.md +2 -2
- package/docs/markdown/variables/DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA.md +2 -2
- package/docs/markdown/variables/DISABLE_SCHEMA_VALIDATION.md +2 -2
- package/docs/markdown/variables/DISABLE_VALIDATION.md +2 -2
- package/docs/markdown/variables/OPEN_API_OPERATION.md +2 -2
- package/docs/markdown/variables/OPEN_API_OPERATION_ID.md +2 -2
- package/docs/markdown/variables/OPEN_API_SERVER_ID.md +3 -3
- package/docs/markdown/variables/OPEN_API_SERVER_INDEX.md +2 -2
- package/docs/markdown/variables/RXAP_OPEN_API_CONFIG.md +2 -2
- package/docs/markdown/variables/RXAP_OPEN_API_STRICT_VALIDATOR.md +2 -2
- package/docs/markdown/variables/injectOpenApiBaseUrlHttpInterceptorFn.md +11 -0
- package/docs/wiki/Class.OpenApiConfigService.md +26 -26
- package/docs/wiki/Class.OpenApiHttpResponseError.md +25 -25
- package/docs/wiki/Class.RxapOpenApiError.md +24 -24
- package/docs/wiki/Class.SchemaValidationMixin.md +35 -29
- package/docs/wiki/Function.AssertOpenApiV3.md +2 -2
- package/docs/wiki/Function.IsOpenApiV3.md +2 -2
- package/docs/wiki/Function.IsReferenceObject.md +2 -2
- package/docs/wiki/Function.NotContainsReferenceObjects.md +6 -4
- package/docs/wiki/Function.OpenApiInit.md +4 -4
- package/docs/wiki/Function.getJsonContentSchema.md +4 -4
- package/docs/wiki/Function.getJsonSchema.md +4 -4
- package/docs/wiki/Function.hasJsonContentSchema.md +7 -5
- package/docs/wiki/Function.hasJsonSchema.md +2 -2
- package/docs/wiki/Home.md +5 -3
- package/docs/wiki/Interface.OpenApiInitOptions.md +5 -5
- package/docs/wiki/Interface.OpenApiMetaData.md +11 -11
- package/docs/wiki/Interface.OperationObjectWithMetadata.md +26 -26
- package/docs/wiki/Interface.SchemaValidationResponse.md +10 -8
- package/docs/wiki/TypeAlias.OperationMap.md +2 -2
- package/docs/wiki/Variable.DEFAULT_OPEN_API_DATA_SOURCE_META_DATA.md +1 -1
- package/docs/wiki/Variable.DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA.md +1 -1
- package/docs/wiki/Variable.DISABLE_SCHEMA_VALIDATION.md +1 -1
- package/docs/wiki/Variable.DISABLE_VALIDATION.md +1 -1
- package/docs/wiki/Variable.OPEN_API_OPERATION.md +1 -1
- package/docs/wiki/Variable.OPEN_API_OPERATION_ID.md +1 -1
- package/docs/wiki/Variable.OPEN_API_SERVER_ID.md +2 -2
- package/docs/wiki/Variable.OPEN_API_SERVER_INDEX.md +1 -1
- package/docs/wiki/Variable.RXAP_OPEN_API_CONFIG.md +1 -1
- package/docs/wiki/Variable.RXAP_OPEN_API_STRICT_VALIDATOR.md +1 -1
- package/docs/wiki/Variable.injectOpenApiBaseUrlHttpInterceptorFn.md +7 -0
- package/docs/wiki/_Sidebar.md +1 -1
- package/docs/wiki/globals.md +2 -2
- package/fesm2022/rxap-open-api-data-source-table.mjs +1 -1
- package/fesm2022/rxap-open-api-data-source-table.mjs.map +1 -1
- package/fesm2022/rxap-open-api-data-source.mjs +1 -1
- package/fesm2022/rxap-open-api-data-source.mjs.map +1 -1
- package/fesm2022/rxap-open-api-remote-method.mjs +6 -2
- package/fesm2022/rxap-open-api-remote-method.mjs.map +1 -1
- package/generators.json +16 -0
- package/package.json +28 -29
- package/src/generators/init/generator.js +120 -0
- package/src/generators/init/index.js +6 -0
- package/src/generators/init/schema.json +8 -0
- package/src/generators/package.json +3 -0
- package/compodoc/js/libs/vis.min.js +0 -47
- package/compodoc/js/menu-wc_es5.js +0 -40
- package/docs/html/functions/injectOpenApiBaseUrlHttpInterceptorFn.html +0 -1
- package/docs/markdown/functions/injectOpenApiBaseUrlHttpInterceptorFn.md +0 -25
- package/docs/wiki/Function.injectOpenApiBaseUrlHttpInterceptorFn.md +0 -21
- package/theme.css +0 -1
package/generators.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"generators": {
|
|
3
|
+
"init": {
|
|
4
|
+
"factory": "./src/generators/init/generator",
|
|
5
|
+
"schema": "./src/generators/init/schema.json",
|
|
6
|
+
"description": "Initialize the package in the workspace"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"schematics": {
|
|
10
|
+
"init": {
|
|
11
|
+
"factory": "./src/generators/init/index",
|
|
12
|
+
"schema": "./src/generators/init/schema.json",
|
|
13
|
+
"description": "Initialize the package in the workspace"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "22.0.0-dev.
|
|
2
|
+
"version": "22.0.0-dev.2",
|
|
3
3
|
"name": "@rxap/open-api",
|
|
4
4
|
"description": "This package provides tools for working with OpenAPI specifications in Angular applications. It includes services for configuring and loading OpenAPI definitions, validating requests and responses against schemas, and handling errors. It also offers utilities for building HTTP requests based on OpenAPI definitions.\n",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@nx/devkit": "24.0.6",
|
|
8
|
-
"tslib": "2.
|
|
8
|
+
"tslib": "2.9.1"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@angular/common": "^22.
|
|
12
|
-
"@angular/core": "^22.
|
|
13
|
-
"@rxap/config": "^22.0.0-dev.
|
|
14
|
-
"@rxap/data-source": "^22.0.0-dev.
|
|
15
|
-
"@rxap/environment": "^22.0.0-dev.
|
|
16
|
-
"@rxap/mixin": "^16.0.
|
|
17
|
-
"@rxap/
|
|
18
|
-
"@rxap/
|
|
19
|
-
"@rxap/
|
|
20
|
-
"
|
|
11
|
+
"@angular/common": "^22.0.0",
|
|
12
|
+
"@angular/core": "^22.0.0",
|
|
13
|
+
"@rxap/config": "^22.0.0-dev.2",
|
|
14
|
+
"@rxap/data-source": "^22.0.0-dev.2",
|
|
15
|
+
"@rxap/environment": "^22.0.0-dev.2",
|
|
16
|
+
"@rxap/mixin": "^16.0.18-dev.1",
|
|
17
|
+
"@rxap/pattern": "^1.1.17-dev.1",
|
|
18
|
+
"@rxap/remote-method": "^22.0.0-dev.2",
|
|
19
|
+
"@rxap/rxjs": "^1.1.19-dev.1",
|
|
20
|
+
"@rxap/utilities": "^16.5.3-dev.1",
|
|
21
|
+
"ajv": "^8.0.0",
|
|
21
22
|
"openapi-types": "^10.0.0",
|
|
22
|
-
"rxjs": "^7.
|
|
23
|
+
"rxjs": "^7.0.0"
|
|
23
24
|
},
|
|
24
25
|
"author": {
|
|
25
26
|
"name": "Merzough Münker",
|
|
@@ -68,53 +69,52 @@
|
|
|
68
69
|
},
|
|
69
70
|
{
|
|
70
71
|
"package": "@rxap/config",
|
|
71
|
-
"version": "22.0.0-dev.
|
|
72
|
+
"version": "22.0.0-dev.2"
|
|
72
73
|
},
|
|
73
74
|
{
|
|
74
75
|
"package": "@rxap/data-source",
|
|
75
|
-
"version": "22.0.0-dev.
|
|
76
|
+
"version": "22.0.0-dev.2"
|
|
76
77
|
},
|
|
77
78
|
{
|
|
78
79
|
"package": "@rxap/data-structure-tree",
|
|
79
|
-
"version": "1.1.
|
|
80
|
+
"version": "1.1.20-dev.1"
|
|
80
81
|
},
|
|
81
82
|
{
|
|
82
83
|
"package": "@rxap/definition",
|
|
83
|
-
"version": "22.0.0-dev.
|
|
84
|
+
"version": "22.0.0-dev.2"
|
|
84
85
|
},
|
|
85
86
|
{
|
|
86
87
|
"package": "@rxap/environment",
|
|
87
|
-
"version": "22.0.0-dev.
|
|
88
|
+
"version": "22.0.0-dev.2"
|
|
88
89
|
},
|
|
89
90
|
{
|
|
90
91
|
"package": "@rxap/mixin",
|
|
91
|
-
"version": "16.0.
|
|
92
|
+
"version": "16.0.18-dev.1"
|
|
92
93
|
},
|
|
93
94
|
{
|
|
94
95
|
"package": "@rxap/pattern",
|
|
95
|
-
"version": "1.1.
|
|
96
|
+
"version": "1.1.17-dev.1"
|
|
96
97
|
},
|
|
97
98
|
{
|
|
98
99
|
"package": "@rxap/reflect-metadata",
|
|
99
|
-
"version": "1.0.
|
|
100
|
+
"version": "1.0.19-dev.1"
|
|
100
101
|
},
|
|
101
102
|
{
|
|
102
103
|
"package": "@rxap/remote-method",
|
|
103
|
-
"version": "22.0.0-dev.
|
|
104
|
+
"version": "22.0.0-dev.2"
|
|
104
105
|
},
|
|
105
106
|
{
|
|
106
107
|
"package": "@rxap/rxjs",
|
|
107
|
-
"version": "1.1.
|
|
108
|
+
"version": "1.1.19-dev.1"
|
|
108
109
|
},
|
|
109
110
|
{
|
|
110
111
|
"package": "@rxap/utilities",
|
|
111
|
-
"version": "16.5.
|
|
112
|
+
"version": "16.5.3-dev.1"
|
|
112
113
|
}
|
|
113
114
|
]
|
|
114
115
|
},
|
|
115
116
|
"publishConfig": {
|
|
116
|
-
"access": "public"
|
|
117
|
-
"directory": "../../../dist/packages/angular/open-api"
|
|
117
|
+
"access": "public"
|
|
118
118
|
},
|
|
119
119
|
"repository": {
|
|
120
120
|
"type": "git",
|
|
@@ -152,8 +152,7 @@
|
|
|
152
152
|
"./testing": {
|
|
153
153
|
"types": "./types/rxap-open-api-testing.d.ts",
|
|
154
154
|
"default": "./fesm2022/rxap-open-api-testing.mjs"
|
|
155
|
-
}
|
|
156
|
-
"./theme": "./theme.css"
|
|
155
|
+
}
|
|
157
156
|
},
|
|
158
157
|
"type": "module"
|
|
159
|
-
}
|
|
158
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initGenerator = initGenerator;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
/**
|
|
8
|
+
* Resolves the directory of a package installed in the workspace. The lookup starts at the
|
|
9
|
+
* workspace root, not at this package: with an isolated node_modules layout (pnpm) or Yarn PnP
|
|
10
|
+
* the peer is not resolvable from here. The plain node_modules path is the fallback for packages
|
|
11
|
+
* whose `exports` map hides their package.json.
|
|
12
|
+
*/
|
|
13
|
+
function resolvePackageDir(root, packageName) {
|
|
14
|
+
try {
|
|
15
|
+
return (0, path_1.dirname)(require.resolve(`${packageName}/package.json`, { paths: [root] }));
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return (0, path_1.join)(root, 'node_modules', ...packageName.split('/'));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async function initGenerator(tree, options) {
|
|
22
|
+
// The package's own package.json lives on disk next to the compiled generator
|
|
23
|
+
// (inside node_modules when installed), which the virtual Tree does not track.
|
|
24
|
+
// Read it directly from the physical filesystem.
|
|
25
|
+
const packageJsonFilePath = (0, path_1.join)(__dirname, '..', '..', '..', 'package.json');
|
|
26
|
+
if (!(0, fs_1.existsSync)(packageJsonFilePath)) {
|
|
27
|
+
console.error('package.json not found in: ' + packageJsonFilePath);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const { peerDependencies, name: packageName } = JSON.parse((0, fs_1.readFileSync)(packageJsonFilePath, 'utf-8'));
|
|
31
|
+
console.log(`Coerce peer dependencies for package: ${packageName}`);
|
|
32
|
+
if (!peerDependencies || !Object.keys(peerDependencies).length) {
|
|
33
|
+
console.log('No peer dependencies found');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
console.log(`Peer dependencies: ${Object.keys(peerDependencies).join(', ')}`);
|
|
37
|
+
const rootPackageJson = JSON.parse(tree.read('package.json', 'utf-8'));
|
|
38
|
+
let isDevDependency = !!rootPackageJson.devDependencies?.[packageName];
|
|
39
|
+
if (isDevDependency &&
|
|
40
|
+
[/^@rxap\/ngx/, /^@rxap\/nest/].some((rx) => rx.test(packageName))) {
|
|
41
|
+
rootPackageJson.dependencies ??= {};
|
|
42
|
+
rootPackageJson.dependencies[packageName] =
|
|
43
|
+
rootPackageJson.devDependencies[packageName];
|
|
44
|
+
delete rootPackageJson.devDependencies[packageName];
|
|
45
|
+
isDevDependency = false;
|
|
46
|
+
tree.write('package.json', JSON.stringify(rootPackageJson, null, 2));
|
|
47
|
+
}
|
|
48
|
+
if (!isDevDependency &&
|
|
49
|
+
[
|
|
50
|
+
/^@rxap\/plugin/,
|
|
51
|
+
/^@rxap\/workspace/,
|
|
52
|
+
/@rxap\/schematic/,
|
|
53
|
+
].some((rx) => rx.test(packageName))) {
|
|
54
|
+
rootPackageJson.devDependencies ??= {};
|
|
55
|
+
rootPackageJson.devDependencies[packageName] =
|
|
56
|
+
rootPackageJson.dependencies[packageName];
|
|
57
|
+
delete rootPackageJson.dependencies[packageName];
|
|
58
|
+
isDevDependency = true;
|
|
59
|
+
tree.write('package.json', JSON.stringify(rootPackageJson, null, 2));
|
|
60
|
+
}
|
|
61
|
+
const missingPeerDependencies = Object.entries(peerDependencies)
|
|
62
|
+
.filter(([dep]) => !rootPackageJson.dependencies?.[dep] &&
|
|
63
|
+
!rootPackageJson.devDependencies?.[dep])
|
|
64
|
+
.reduce((acc, [dep, version]) => ({ ...acc, [dep]: version }), {});
|
|
65
|
+
if (!Object.keys(missingPeerDependencies).length) {
|
|
66
|
+
console.log('No missing peer dependencies');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (isDevDependency) {
|
|
70
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, missingPeerDependencies);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, missingPeerDependencies, {});
|
|
74
|
+
}
|
|
75
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
76
|
+
(0, devkit_1.installPackagesTask)(tree);
|
|
77
|
+
for (const peer of Object.keys(missingPeerDependencies)) {
|
|
78
|
+
console.log(`Peer dependency ${peer} added to package.json`);
|
|
79
|
+
// node_modules is physical and excluded from the virtual Tree, so read the
|
|
80
|
+
// peer files from disk.
|
|
81
|
+
const peerPackageDir = resolvePackageDir(tree.root, peer);
|
|
82
|
+
const peerPackageJsonFilePath = (0, path_1.join)(peerPackageDir, 'package.json');
|
|
83
|
+
if (!(0, fs_1.existsSync)(peerPackageJsonFilePath)) {
|
|
84
|
+
console.log(`Peer dependency ${peer} has no package.json`);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const { generators, schematics } = JSON.parse((0, fs_1.readFileSync)(peerPackageJsonFilePath, 'utf-8'));
|
|
88
|
+
if (!generators && !schematics) {
|
|
89
|
+
console.log(`Peer dependency ${peer} has no generators or schematics`);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const configFile = generators || schematics;
|
|
93
|
+
const configFilePath = (0, path_1.join)(peerPackageDir, configFile);
|
|
94
|
+
if (!(0, fs_1.existsSync)(configFilePath)) {
|
|
95
|
+
console.log(`Peer dependency ${peer} has no generators or schematics file`);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const config = JSON.parse((0, fs_1.readFileSync)(configFilePath, 'utf-8'));
|
|
99
|
+
if (!config.generators?.init) {
|
|
100
|
+
console.log(`Peer dependency ${peer} has no init generator`);
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const initGeneratorFilePath = config.generators.init.factory;
|
|
104
|
+
const fullInitGeneratorFilePath = (0, path_1.join)(peerPackageDir, initGeneratorFilePath) + '.js';
|
|
105
|
+
if (!(0, fs_1.existsSync)(fullInitGeneratorFilePath)) {
|
|
106
|
+
console.log(`Peer dependency ${peer} has no init generator file: ` +
|
|
107
|
+
fullInitGeneratorFilePath);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
111
|
+
const initGenerator = require((0, path_1.join)(peerPackageDir, initGeneratorFilePath))?.default;
|
|
112
|
+
if (typeof initGenerator !== 'function') {
|
|
113
|
+
console.log(`Peer dependency ${peer} has no init generator function`);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
console.log(`Run init generator for peer dependency ${peer}`);
|
|
117
|
+
await initGenerator(tree, options);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.default = initGenerator;
|
|
@@ -0,0 +1,6 @@
|
|
|
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;
|