@rxap/plugin-open-api 16.0.1-dev.6 → 16.1.0-dev.1

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 CHANGED
@@ -3,6 +3,25 @@
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.1 (2023-10-11)
7
+
8
+ ### Bug Fixes
9
+
10
+ - only clear source files ([7dddd96](https://gitlab.com/rxap/packages/commit/7dddd96dcaa8be256e5bc6c41a93881ca9ac19ee))
11
+ - peer dependency issue ([ee95415](https://gitlab.com/rxap/packages/commit/ee95415370d9ef2396916d6c25061a0df791034a))
12
+ - remove support for open-api client sdk packages ([0015878](https://gitlab.com/rxap/packages/commit/0015878e53cba42943d37354ef5c7d5f17828fd7))
13
+ - use prefix for directives if defined in project.json ([acaa916](https://gitlab.com/rxap/packages/commit/acaa91657e477221ed6f36c589fe8546bd17f277))
14
+
15
+ ### Features
16
+
17
+ - add the copy-client-sdk executor ([6742469](https://gitlab.com/rxap/packages/commit/674246926cb882ba6a94c5081e19bca8b74f3a59))
18
+
19
+ # [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)
20
+
21
+ ### Features
22
+
23
+ - add the copy-client-sdk executor ([6c5c46a](https://gitlab.com/rxap/packages/commit/6c5c46a6d1f8f12d3f0f77117aa6070d7c2507e2))
24
+
6
25
  ## [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)
7
26
 
8
27
  ### Bug Fixes
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 @nx/devkit@^16.5.0 @rxap/generator-utilities@* @rxap/plugin-library@* @rxap/utilities@* @rxap/workspace-open-api@* @rxap/workspace-ts-morph@* @rxap/workspace-utilities@* tslib@2.6.2
22
+ yarn add @nx/devkit@^16.5.0 @rxap/generator-utilities@^1.1.0-dev.17 @rxap/node-utilities@^1.1.0-dev.13 @rxap/plugin-library@^16.0.0-dev.35 @rxap/plugin-utilities@^16.1.0-dev.18 @rxap/utilities@^16.0.0-dev.21 @rxap/workspace-open-api@^0.0.2-dev.8 @rxap/workspace-ts-morph@^0.1.0-dev.9 @rxap/workspace-utilities@^0.1.0-dev.21 tslib@2.6.2
22
23
  ```
23
24
  # Generators
24
25
 
@@ -28,3 +29,19 @@ yarn add @nx/devkit@^16.5.0 @rxap/generator-utilities@* @rxap/plugin-library@* @
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
@@ -0,0 +1,9 @@
1
+ {
2
+ "executors": {
3
+ "copy-client-sdk": {
4
+ "implementation": "./src/executors/copy-client-sdk/executor",
5
+ "schema": "./src/executors/copy-client-sdk/schema.json",
6
+ "description": "copy-client-sdk executor"
7
+ }
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "16.0.1-dev.6",
2
+ "version": "16.1.0-dev.1",
3
3
  "name": "@rxap/plugin-open-api",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "dependencies": {
@@ -15,21 +15,21 @@
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@nx/devkit": "^16.5.0",
18
- "@rxap/generator-utilities": "*",
19
- "@rxap/plugin-library": "*",
20
- "@rxap/utilities": "*",
21
- "@rxap/workspace-open-api": "*",
22
- "@rxap/workspace-ts-morph": "*",
23
- "@rxap/workspace-utilities": "*",
18
+ "@rxap/generator-utilities": "^1.1.0-dev.17",
19
+ "@rxap/node-utilities": "^1.1.0-dev.13",
20
+ "@rxap/plugin-library": "^16.0.0-dev.35",
21
+ "@rxap/plugin-utilities": "^16.1.0-dev.18",
22
+ "@rxap/utilities": "^16.0.0-dev.21",
23
+ "@rxap/workspace-open-api": "^0.0.2-dev.8",
24
+ "@rxap/workspace-ts-morph": "^0.1.0-dev.9",
25
+ "@rxap/workspace-utilities": "^0.1.0-dev.21",
24
26
  "tslib": "2.6.2",
25
- "@rxap/generator-ts-morph": "1.0.1-dev.11",
26
- "@rxap/json-schema-to-typescript": "16.0.0-dev.13",
27
- "@rxap/node-utilities": "1.1.0-dev.9",
28
- "@rxap/plugin-angular": "16.1.0-dev.22",
29
- "@rxap/plugin-localazy": "16.1.0-dev.11",
30
- "@rxap/plugin-nestjs": "16.1.0-dev.20",
31
- "@rxap/plugin-utilities": "16.1.0-dev.14",
32
- "@rxap/ts-morph": "0.1.0-dev.9"
27
+ "@rxap/generator-ts-morph": "1.0.1-dev.13",
28
+ "@rxap/json-schema-to-typescript": "16.0.0-dev.17",
29
+ "@rxap/plugin-angular": "16.1.0-dev.50",
30
+ "@rxap/plugin-localazy": "16.1.0-dev.13",
31
+ "@rxap/plugin-nestjs": "16.1.0-dev.40",
32
+ "@rxap/ts-morph": "0.1.0-dev.15"
33
33
  },
34
34
  "author": {
35
35
  "name": "Merzough Münker",
@@ -39,6 +39,7 @@
39
39
  "url": "https://gitlab.com/rxap/packages/-/issues",
40
40
  "email": "incoming+rxap-packages-14898188-issue-@incoming.gitlab.com"
41
41
  },
42
+ "executors": "./executors.json",
42
43
  "generators": "./generators.json",
43
44
  "homepage": "https:/gitlab.com/rxap/packages/packages/plugin/open-api",
44
45
  "keywords": [
@@ -53,27 +54,35 @@
53
54
  "packageGroup": [
54
55
  {
55
56
  "package": "@rxap/generator-utilities",
56
- "version": "1.1.0-dev.12"
57
+ "version": "1.1.0-dev.17"
58
+ },
59
+ {
60
+ "package": "@rxap/node-utilities",
61
+ "version": "1.1.0-dev.13"
57
62
  },
58
63
  {
59
64
  "package": "@rxap/plugin-library",
60
- "version": "16.0.0-dev.24"
65
+ "version": "16.0.0-dev.35"
66
+ },
67
+ {
68
+ "package": "@rxap/plugin-utilities",
69
+ "version": "16.1.0-dev.18"
61
70
  },
62
71
  {
63
72
  "package": "@rxap/utilities",
64
- "version": "16.0.0-dev.17"
73
+ "version": "16.0.0-dev.21"
65
74
  },
66
75
  {
67
76
  "package": "@rxap/workspace-open-api",
68
- "version": "0.0.2-dev.4"
77
+ "version": "0.0.2-dev.8"
69
78
  },
70
79
  {
71
80
  "package": "@rxap/workspace-ts-morph",
72
- "version": "0.1.0-dev.7"
81
+ "version": "0.1.0-dev.9"
73
82
  },
74
83
  {
75
84
  "package": "@rxap/workspace-utilities",
76
- "version": "0.1.0-dev.12"
85
+ "version": "0.1.0-dev.21"
77
86
  }
78
87
  ]
79
88
  },
@@ -87,7 +96,7 @@
87
96
  "directory": "packages/plugin/open-api"
88
97
  },
89
98
  "type": "commonjs",
90
- "gitHead": "db8e53ef6cfd297abb6f8c4fb54f289f9c971fe4",
99
+ "gitHead": "cc79abe8b76799cf9e91a91b92e8172b23a74b13",
91
100
  "main": "./src/index.js",
92
101
  "types": "./src/index.d.ts"
93
102
  }
@@ -0,0 +1,5 @@
1
+ import { ExecutorContext } from '@nx/devkit';
2
+ import { CopyClientSdkExecutorSchema } from './schema';
3
+ export default function runExecutor(options: CopyClientSdkExecutorSchema, context: ExecutorContext): Promise<{
4
+ success: boolean;
5
+ }>;
@@ -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;IAC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AI,0BAA0B,EAAE;YACnD,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;SAC1C;QAED,IAAI,OAAO,CAAC,OAAO,EAAE;YACnB,KAAK,MAAM,UAAU,IAAI,0BAA0B,CAAC,OAAO,CAAC,EAAE;gBAC5D,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;aAC1C;SACF;QAED,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,KAAK,MAAM,UAAU,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,9 @@
1
+ export interface CopyClientSdkExecutorSchema {
2
+ clientSdkProject: string;
3
+ angular?: boolean;
4
+ nestJs?: boolean;
5
+ outputDir: string;
6
+ skipDataSources?: boolean;
7
+ skipDirectives?: boolean;
8
+ skipRemoteMethods?: boolean;
9
+ }
@@ -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
+ }