@rxap/plugin-open-api 16.0.1-dev.5 → 16.1.0-dev.0
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 +12 -0
- package/README.md +18 -1
- package/executors.json +9 -0
- package/package.json +24 -22
- package/src/executors/copy-client-sdk/executor.d.ts +5 -0
- package/src/executors/copy-client-sdk/executor.js +92 -0
- package/src/executors/copy-client-sdk/executor.js.map +1 -0
- package/src/executors/copy-client-sdk/schema.d.ts +9 -0
- package/src/executors/copy-client-sdk/schema.json +41 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.0](https://gitlab.com/rxap/packages/compare/@rxap/plugin-open-api@16.0.1-dev.6...@rxap/plugin-open-api@16.1.0-dev.0) (2023-10-01)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- add the copy-client-sdk executor ([6c5c46a](https://gitlab.com/rxap/packages/commit/6c5c46a6d1f8f12d3f0f77117aa6070d7c2507e2))
|
|
11
|
+
|
|
12
|
+
## [16.0.1-dev.6](https://gitlab.com/rxap/packages/compare/@rxap/plugin-open-api@16.0.1-dev.5...@rxap/plugin-open-api@16.0.1-dev.6) (2023-09-12)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- peer dependency issue ([e67e2b8](https://gitlab.com/rxap/packages/commit/e67e2b8eb884b598536d16c2c544a9ad9be5b53e))
|
|
17
|
+
|
|
6
18
|
## [16.0.1-dev.5](https://gitlab.com/rxap/packages/compare/@rxap/plugin-open-api@16.0.1-dev.4...@rxap/plugin-open-api@16.0.1-dev.5) (2023-09-12)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @rxap/plugin-open-api
|
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
- [Installation](#installation)
|
|
11
11
|
- [Generators](#generators)
|
|
12
|
+
- [Executors](#executors)
|
|
12
13
|
|
|
13
14
|
# Installation
|
|
14
15
|
|
|
@@ -18,7 +19,7 @@ yarn add @rxap/plugin-open-api
|
|
|
18
19
|
```
|
|
19
20
|
**Install peer dependencies:**
|
|
20
21
|
```bash
|
|
21
|
-
yarn add tslib@2.6.2
|
|
22
|
+
yarn add @nx/devkit@^16.5.0 @rxap/generator-utilities@^1.1.0-dev.13 @rxap/node-utilities@* @rxap/plugin-library@^16.0.0-dev.25 @rxap/plugin-utilities@* @rxap/utilities@^16.0.0-dev.17 @rxap/workspace-open-api@^0.0.2-dev.5 @rxap/workspace-ts-morph@^0.1.0-dev.8 @rxap/workspace-utilities@^0.1.0-dev.13 tslib@2.6.2
|
|
22
23
|
```
|
|
23
24
|
# Generators
|
|
24
25
|
|
|
@@ -28,3 +29,19 @@ yarn add tslib@2.6.2
|
|
|
28
29
|
```bash
|
|
29
30
|
yarn nx g @rxap/plugin-open-api:generate
|
|
30
31
|
```
|
|
32
|
+
# Executors
|
|
33
|
+
|
|
34
|
+
## copy-client-sdk
|
|
35
|
+
> copy-client-sdk executor
|
|
36
|
+
|
|
37
|
+
**project.json**
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"targets": {
|
|
41
|
+
"copy-client-sdk": {
|
|
42
|
+
"executor": "@rxap/plugin-open-api:copy-client-sdk"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
package/executors.json
ADDED
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "16.0
|
|
2
|
+
"version": "16.1.0-dev.0",
|
|
3
3
|
"name": "@rxap/plugin-open-api",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
5
|
"dependencies": {
|
|
@@ -14,21 +14,22 @@
|
|
|
14
14
|
"yaml": "2.3.1"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
+
"@nx/devkit": "^16.5.0",
|
|
18
|
+
"@rxap/generator-utilities": "^1.1.0-dev.13",
|
|
19
|
+
"@rxap/node-utilities": "*",
|
|
20
|
+
"@rxap/plugin-library": "^16.0.0-dev.25",
|
|
21
|
+
"@rxap/plugin-utilities": "*",
|
|
22
|
+
"@rxap/utilities": "^16.0.0-dev.17",
|
|
23
|
+
"@rxap/workspace-open-api": "^0.0.2-dev.5",
|
|
24
|
+
"@rxap/workspace-ts-morph": "^0.1.0-dev.8",
|
|
25
|
+
"@rxap/workspace-utilities": "^0.1.0-dev.13",
|
|
17
26
|
"tslib": "2.6.2",
|
|
18
|
-
"@rxap/generator-ts-morph": "1.0.1-dev.
|
|
19
|
-
"@rxap/
|
|
20
|
-
"@rxap/
|
|
21
|
-
"@rxap/
|
|
22
|
-
"@rxap/plugin-
|
|
23
|
-
"@rxap/
|
|
24
|
-
"@rxap/plugin-localazy": "16.1.0-dev.10",
|
|
25
|
-
"@rxap/plugin-nestjs": "16.1.0-dev.18",
|
|
26
|
-
"@rxap/plugin-utilities": "16.1.0-dev.13",
|
|
27
|
-
"@rxap/ts-morph": "0.1.0-dev.8",
|
|
28
|
-
"@rxap/utilities": "16.0.0-dev.17",
|
|
29
|
-
"@rxap/workspace-open-api": "0.0.2-dev.4",
|
|
30
|
-
"@rxap/workspace-ts-morph": "0.1.0-dev.7",
|
|
31
|
-
"@rxap/workspace-utilities": "0.1.0-dev.12"
|
|
27
|
+
"@rxap/generator-ts-morph": "1.0.1-dev.12",
|
|
28
|
+
"@rxap/json-schema-to-typescript": "16.0.0-dev.15",
|
|
29
|
+
"@rxap/plugin-angular": "16.1.0-dev.43",
|
|
30
|
+
"@rxap/plugin-localazy": "16.1.0-dev.11",
|
|
31
|
+
"@rxap/plugin-nestjs": "16.1.0-dev.31",
|
|
32
|
+
"@rxap/ts-morph": "0.1.0-dev.12"
|
|
32
33
|
},
|
|
33
34
|
"author": {
|
|
34
35
|
"name": "Merzough Münker",
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
"url": "https://gitlab.com/rxap/packages/-/issues",
|
|
39
40
|
"email": "incoming+rxap-packages-14898188-issue-@incoming.gitlab.com"
|
|
40
41
|
},
|
|
42
|
+
"executors": "./executors.json",
|
|
41
43
|
"generators": "./generators.json",
|
|
42
44
|
"homepage": "https:/gitlab.com/rxap/packages/packages/plugin/open-api",
|
|
43
45
|
"keywords": [
|
|
@@ -52,27 +54,27 @@
|
|
|
52
54
|
"packageGroup": [
|
|
53
55
|
{
|
|
54
56
|
"package": "@rxap/generator-utilities",
|
|
55
|
-
"version": "1.1.0-dev.
|
|
57
|
+
"version": "1.1.0-dev.13"
|
|
56
58
|
},
|
|
57
59
|
{
|
|
58
60
|
"package": "@rxap/plugin-library",
|
|
59
|
-
"version": "16.0.0-dev.
|
|
61
|
+
"version": "16.0.0-dev.25"
|
|
60
62
|
},
|
|
61
63
|
{
|
|
62
64
|
"package": "@rxap/utilities",
|
|
63
|
-
"version": "16.0.0-dev.
|
|
65
|
+
"version": "16.0.0-dev.17"
|
|
64
66
|
},
|
|
65
67
|
{
|
|
66
68
|
"package": "@rxap/workspace-open-api",
|
|
67
|
-
"version": "0.0.2-dev.
|
|
69
|
+
"version": "0.0.2-dev.5"
|
|
68
70
|
},
|
|
69
71
|
{
|
|
70
72
|
"package": "@rxap/workspace-ts-morph",
|
|
71
|
-
"version": "0.1.0-dev.
|
|
73
|
+
"version": "0.1.0-dev.8"
|
|
72
74
|
},
|
|
73
75
|
{
|
|
74
76
|
"package": "@rxap/workspace-utilities",
|
|
75
|
-
"version": "0.1.0-dev.
|
|
77
|
+
"version": "0.1.0-dev.13"
|
|
76
78
|
}
|
|
77
79
|
]
|
|
78
80
|
},
|
|
@@ -86,7 +88,7 @@
|
|
|
86
88
|
"directory": "packages/plugin/open-api"
|
|
87
89
|
},
|
|
88
90
|
"type": "commonjs",
|
|
89
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "0572fea26873bbef8ccaa59c6801e19042489573",
|
|
90
92
|
"main": "./src/index.js",
|
|
91
93
|
"types": "./src/index.d.ts"
|
|
92
94
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const node_utilities_1 = require("@rxap/node-utilities");
|
|
5
|
+
const plugin_utilities_1 = require("@rxap/plugin-utilities");
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const GENERIC_SOURCE_FILE_FOLDER = [
|
|
9
|
+
'parameters',
|
|
10
|
+
'responses',
|
|
11
|
+
'request-bodies',
|
|
12
|
+
'components',
|
|
13
|
+
];
|
|
14
|
+
const ANGULAR_SOURCE_FILE_FOLDER = [
|
|
15
|
+
'data-sources',
|
|
16
|
+
'remote-methods',
|
|
17
|
+
'directives',
|
|
18
|
+
];
|
|
19
|
+
const NEST_JS_SOURCE_FILE_FOLDER = [
|
|
20
|
+
'commands',
|
|
21
|
+
];
|
|
22
|
+
function getAngularSourceFileFolder(options) {
|
|
23
|
+
const copy = [...ANGULAR_SOURCE_FILE_FOLDER];
|
|
24
|
+
if (options.skipDataSources) {
|
|
25
|
+
copy.splice(copy.indexOf('data-sources'), 1);
|
|
26
|
+
}
|
|
27
|
+
if (options.skipDirectives) {
|
|
28
|
+
copy.splice(copy.indexOf('directives'), 1);
|
|
29
|
+
}
|
|
30
|
+
if (options.skipRemoteMethods) {
|
|
31
|
+
copy.splice(copy.indexOf('remote-methods'), 1);
|
|
32
|
+
}
|
|
33
|
+
return copy;
|
|
34
|
+
}
|
|
35
|
+
function clearOutputDir(options, context) {
|
|
36
|
+
const projectSourceRoot = (0, plugin_utilities_1.GetProjectSourceRoot)(context);
|
|
37
|
+
// if the output dir exists
|
|
38
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(projectSourceRoot, 'lib', options.outputDir))) {
|
|
39
|
+
// then remove the directory recursively
|
|
40
|
+
(0, fs_1.rmSync)((0, path_1.join)(projectSourceRoot, 'lib', options.outputDir), {
|
|
41
|
+
recursive: true,
|
|
42
|
+
force: true,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
(0, fs_1.mkdirSync)((0, path_1.join)(projectSourceRoot, 'lib', options.outputDir), { recursive: true });
|
|
46
|
+
}
|
|
47
|
+
function copyFolder(options, context, folderName) {
|
|
48
|
+
const sourceProjectSourceRoot = (0, plugin_utilities_1.GetProjectSourceRoot)(context, options.clientSdkProject);
|
|
49
|
+
const targetProjectSourceRoot = (0, plugin_utilities_1.GetProjectSourceRoot)(context);
|
|
50
|
+
const sourceFolderPath = (0, path_1.join)(sourceProjectSourceRoot, 'lib', folderName);
|
|
51
|
+
const targetFolderPath = (0, path_1.join)(targetProjectSourceRoot, 'lib', options.outputDir, folderName);
|
|
52
|
+
if (!(0, fs_1.existsSync)(sourceFolderPath)) {
|
|
53
|
+
console.log(`Skip copy folder '${folderName}' from '${sourceFolderPath}' to '${targetFolderPath}' because the source folder does not exists`);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
console.log(`Copy folder '${folderName}' from '${sourceFolderPath}' to '${targetFolderPath}'`);
|
|
57
|
+
(0, node_utilities_1.CopyFolderSync)(sourceFolderPath, targetFolderPath);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function runExecutor(options, context) {
|
|
61
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
// the directives have a direct dependency to the remote methods
|
|
63
|
+
if (options.skipRemoteMethods && !options.skipDirectives) {
|
|
64
|
+
// if the skip remote methods is set but not the skip directives
|
|
65
|
+
// then enforce that remote methods are not skipped
|
|
66
|
+
options.skipRemoteMethods = false;
|
|
67
|
+
}
|
|
68
|
+
console.log('Executor ran for CopyClientSdk', options);
|
|
69
|
+
if (!context.projectsConfigurations.projects[options.clientSdkProject]) {
|
|
70
|
+
throw new Error(`Could not find project '${options.clientSdkProject}'`);
|
|
71
|
+
}
|
|
72
|
+
clearOutputDir(options, context);
|
|
73
|
+
for (const folderName of GENERIC_SOURCE_FILE_FOLDER) {
|
|
74
|
+
copyFolder(options, context, folderName);
|
|
75
|
+
}
|
|
76
|
+
if (options.angular) {
|
|
77
|
+
for (const folderName of getAngularSourceFileFolder(options)) {
|
|
78
|
+
copyFolder(options, context, folderName);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (options.nestJs) {
|
|
82
|
+
for (const folderName of NEST_JS_SOURCE_FILE_FOLDER) {
|
|
83
|
+
copyFolder(options, context, folderName);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
success: true,
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
exports.default = runExecutor;
|
|
92
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/open-api/src/executors/copy-client-sdk/executor.ts"],"names":[],"mappings":";;;AACA,yDAAsD;AACtD,6DAA8D;AAC9D,2BAIY;AACZ,+BAA4B;AAG5B,MAAM,0BAA0B,GAAG;IACjC,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,YAAY;CACb,CAAC;AAEF,MAAM,0BAA0B,GAAG;IACjC,cAAc;IACd,gBAAgB;IAChB,YAAY;CACb,CAAC;AAEF,MAAM,0BAA0B,GAAG;IACjC,UAAU;CACX,CAAC;AAEF,SAAS,0BAA0B,CAAC,OAAoC;IACtE,MAAM,IAAI,GAAG,CAAE,GAAG,0BAA0B,CAAE,CAAC;IAC/C,IAAI,OAAO,CAAC,eAAe,EAAE;QAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAA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AAU,IAAI,0BAA0B,EAAE;gBACnD,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;aAC1C;SACF;QAED,OAAO;YACL,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;CAAA;AAvCD,8BAuCC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"title": "CopyClientSdk executor",
|
|
5
|
+
"description": "",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"clientSdkProject": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the client SDK project to copy"
|
|
11
|
+
},
|
|
12
|
+
"angular": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"description": "Whether to copy the files for an Angular project"
|
|
15
|
+
},
|
|
16
|
+
"nestjs": {
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"description": "Whether to copy the files for a NestJS project"
|
|
19
|
+
},
|
|
20
|
+
"outputDir": {
|
|
21
|
+
"default": "openapi",
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "The directory to copy the files to"
|
|
24
|
+
},
|
|
25
|
+
"skipDirectives": {
|
|
26
|
+
"type": "boolean",
|
|
27
|
+
"description": "Whether to skip copying the directives"
|
|
28
|
+
},
|
|
29
|
+
"skipDataSources": {
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"description": "Whether to skip copying the data sources"
|
|
32
|
+
},
|
|
33
|
+
"skipRemoteMethods": {
|
|
34
|
+
"type": "boolean",
|
|
35
|
+
"description": "Whether to skip copying the remote methods"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"required": [
|
|
39
|
+
"clientSdkProject"
|
|
40
|
+
]
|
|
41
|
+
}
|