@ama-sdk/schematics 9.0.0-alpha.9 → 9.1.0-alpha.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.
Files changed (52) hide show
  1. package/README.md +19 -14
  2. package/collection.json +0 -6
  3. package/package.json +15 -9
  4. package/schematics/code-generator/code-generator.d.ts +3 -1
  5. package/schematics/code-generator/code-generator.d.ts.map +1 -1
  6. package/schematics/code-generator/code-generator.js +2 -0
  7. package/schematics/code-generator/open-api-cli-generator/open-api-cli.generator.d.ts +6 -2
  8. package/schematics/code-generator/open-api-cli-generator/open-api-cli.generator.d.ts.map +1 -1
  9. package/schematics/code-generator/open-api-cli-generator/open-api-cli.generator.js +13 -7
  10. package/schematics/code-generator/open-api-cli-generator/open-api-cli.options.d.ts +2 -2
  11. package/schematics/code-generator/open-api-cli-generator/open-api-cli.options.d.ts.map +1 -1
  12. package/schematics/code-generator/open-api-cli-generator/open-api-cli.options.js +2 -2
  13. package/schematics/code-generator/swagger-java-generator/swagger-java.options.js +1 -1
  14. package/schematics/helpers/node-install.d.ts +62 -0
  15. package/schematics/helpers/node-install.d.ts.map +1 -0
  16. package/schematics/helpers/node-install.js +67 -0
  17. package/schematics/java/client-core/index.js +2 -2
  18. package/schematics/java/client-core/schema.d.ts +1 -1
  19. package/schematics/java/client-core/schema.d.ts.map +1 -1
  20. package/schematics/java/client-core/schema.json +2 -2
  21. package/schematics/java/client-core/swagger-codegen-java-client/target/javaClient-swagger-codegen-tests.jar +0 -0
  22. package/schematics/java/client-core/swagger-codegen-java-client/target/javaClient-swagger-codegen.jar +0 -0
  23. package/schematics/ng-add/index.d.ts.map +1 -1
  24. package/schematics/ng-add/index.js +108 -54
  25. package/schematics/typescript/core/index.d.ts.map +1 -1
  26. package/schematics/typescript/core/index.js +19 -14
  27. package/schematics/typescript/core/openapi-codegen-typescript/target/typescriptFetch-openapi-generator-tests.jar +0 -0
  28. package/schematics/typescript/core/openapi-codegen-typescript/target/typescriptFetch-openapi-generator.jar +0 -0
  29. package/schematics/typescript/core/schema.d.ts +6 -0
  30. package/schematics/typescript/core/schema.d.ts.map +1 -1
  31. package/schematics/typescript/core/schema.json +20 -0
  32. package/schematics/typescript/shell/index.d.ts.map +1 -1
  33. package/schematics/typescript/shell/index.js +31 -3
  34. package/schematics/typescript/shell/schema.d.ts +6 -0
  35. package/schematics/typescript/shell/schema.d.ts.map +1 -1
  36. package/schematics/typescript/shell/schema.json +20 -1
  37. package/schematics/typescript/shell/templates/base/.gitignore.template +68 -0
  38. package/schematics/typescript/shell/templates/base/.vscode/settings.json +20 -0
  39. package/schematics/typescript/shell/templates/base/jest.config.js +1 -1
  40. package/schematics/typescript/shell/templates/base/openapitools.json +2 -1
  41. package/schematics/typescript/shell/templates/base/{package.json → package.json.template} +2 -2
  42. package/schematics/typescript/create/index.d.ts +0 -9
  43. package/schematics/typescript/create/index.d.ts.map +0 -1
  44. package/schematics/typescript/create/index.js +0 -17
  45. package/schematics/typescript/create/schema.d.ts +0 -5
  46. package/schematics/typescript/create/schema.d.ts.map +0 -1
  47. package/schematics/typescript/create/schema.js +0 -3
  48. package/schematics/typescript/create/schema.json +0 -40
  49. package/schematics/typescript/shell/templates/base/.yarnrc.yml +0 -6
  50. /package/schematics/typescript/shell/templates/base/{.eslintignore → .eslintignore.template} +0 -0
  51. /package/schematics/typescript/shell/templates/base/{.eslintrc.js → .eslintrc.js.template} +0 -0
  52. /package/schematics/typescript/shell/templates/base/{.openapi-codegen-ignore → .openapi-generator-ignore} +0 -0
package/README.md CHANGED
@@ -4,33 +4,38 @@ This package provides `schematics` generators to create an SDK based on an API s
4
4
 
5
5
  ## Setup
6
6
 
7
- The Angular schematics package is required to use these generators:
7
+ ### Create a new repository
8
8
 
9
- if you are in an Angular project
9
+ Generate a new single SDK repository
10
10
 
11
11
  ```shell
12
- yarn ng add @ama-sdk/schematics
13
- yarn ng add @ama-sdk/core
12
+ npm create @ama-sdk typescript <project-name> -- [--spec-path=./path/to/spec.yaml]
14
13
  ```
14
+
15
15
  or
16
+
16
17
  ```shell
17
- npx -p @angular/cli ng add @ama-sdk/schematics
18
- npx -p @angular/cli ng add @ama-sdk/core
18
+ yarn create @ama-sdk typescript <project-name> [--spec-path=./path/to/spec.yaml]
19
19
  ```
20
20
 
21
- else
21
+ > **Note**: Get more information on the [@ama-sdk/create package](https://www.npmjs.com/package/@ama-sdk/create).
22
+
23
+ ### Create a new Otter workspace package
24
+
25
+ The Angular schematics package is required to use these generators:
26
+
27
+ if you are in an [Otter project](https://github.com/AmadeusITGroup/otter):
22
28
 
23
29
  ```shell
24
- # Install @angular-devkit/schematics-cli, @ama-sdk/core and the SDK generator
25
- yarn add --dev @angular-devkit/schematics-cli @ama-sdk/schematics @ama-sdk/core
26
- yarn schematics @ama-sdk/schematics:install
27
- yarn schematics @ama-sdk/core:install
30
+ yarn ng add @ama-sdk/schematics
31
+ yarn ng add @ama-sdk/core
28
32
  ```
33
+
29
34
  or
35
+
30
36
  ```shell
31
- npm i -D @angular-devkit/schematics-cli @ama-sdk/schematics @ama-sdk/core
32
- npx -p @angular-devkit/schematics-cli schematics @ama-sdk/schematics:install
33
- npx -p @angular-devkit/schematics-cli schematics @ama-sdk/core:install
37
+ npx -p @angular/cli ng add @ama-sdk/schematics
38
+ npx -p @angular/cli ng add @ama-sdk/core
34
39
  ```
35
40
 
36
41
  ## How to use?
package/collection.json CHANGED
@@ -27,12 +27,6 @@
27
27
  "factory": "./schematics/typescript/shell/index#ngGenerateTypescriptSDK",
28
28
  "schema": "./schematics/typescript/shell/schema.json"
29
29
  },
30
- "typescript-sdk": {
31
- "alias": ["typescript-create"],
32
- "description": "Generate a typescript SDK repository with code based on swagger specification",
33
- "factory": "./schematics/typescript/create/index#ngGenerateTypescriptSDK",
34
- "schema": "./schematics/typescript/create/schema.json"
35
- },
36
30
  "java-client-core": {
37
31
  "description": "Generate a Java SDK source code based on swagger specification",
38
32
  "factory": "./schematics/java/client-core/index#ngGenerateJavaClientCore",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ama-sdk/schematics",
3
- "version": "9.0.0-alpha.9",
3
+ "version": "9.1.0-alpha.0",
4
4
  "description": "Swagger specification SDK Generator by schematics",
5
5
  "scripts": {
6
6
  "nx": "nx",
@@ -33,12 +33,15 @@
33
33
  "@angular/compiler": {
34
34
  "optional": true
35
35
  },
36
+ "@o3r/schematics": {
37
+ "optional": true
38
+ },
36
39
  "@openapitools/openapi-generator-cli": {
37
40
  "optional": true
38
41
  }
39
42
  },
40
43
  "peerDependencies": {
41
- "@ama-sdk/core": "^9.0.0-alpha.9",
44
+ "@ama-sdk/core": "^9.1.0-alpha.0",
42
45
  "@angular-devkit/core": "~16.0.5",
43
46
  "@angular-devkit/schematics": "~16.0.5",
44
47
  "@angular-devkit/schematics-cli": "~16.0.5",
@@ -49,7 +52,8 @@
49
52
  "dependencies": {
50
53
  "@angular-devkit/core": "~16.0.5",
51
54
  "@angular-devkit/schematics": "~16.0.5",
52
- "@o3r/dev-tools": "^9.0.0-alpha.9",
55
+ "@o3r/dev-tools": "^9.1.0-alpha.0",
56
+ "js-yaml": "^4.1.0",
53
57
  "minimatch": "^9.0.0",
54
58
  "rxjs": "^7.8.1",
55
59
  "semver": "^7.5.2",
@@ -57,16 +61,18 @@
57
61
  "tslib": "^2.5.3"
58
62
  },
59
63
  "devDependencies": {
60
- "@ama-sdk/core": "^9.0.0-alpha.9",
64
+ "@ama-sdk/core": "^9.1.0-alpha.0",
61
65
  "@angular-devkit/schematics-cli": "~16.0.5",
62
66
  "@angular-eslint/eslint-plugin": "~16.0.3",
63
67
  "@angular/cli": "~16.0.5",
64
- "@nx/jest": "~16.3.2",
65
- "@o3r/build-helpers": "^9.0.0-alpha.9",
66
- "@o3r/eslint-plugin": "^9.0.0-alpha.9",
68
+ "@nx/jest": "~16.5.0",
69
+ "@o3r/build-helpers": "^9.1.0-alpha.0",
70
+ "@o3r/eslint-plugin": "^9.1.0-alpha.0",
71
+ "@o3r/schematics": "^9.1.0-alpha.0",
67
72
  "@openapitools/openapi-generator-cli": "~2.6.0",
68
73
  "@schematics/angular": "~16.0.5",
69
74
  "@types/jest": "~29.5.2",
75
+ "@types/js-yaml": "^4.0.5",
70
76
  "@types/minimatch": "^5.1.2",
71
77
  "@types/node": "^18.0.0",
72
78
  "@types/pid-from-port": "^1.1.0",
@@ -85,12 +91,12 @@
85
91
  "jest": "~29.6.0",
86
92
  "mem-fs": "^2.2.1",
87
93
  "npm-run-all": "^4.1.5",
88
- "nx": "~16.3.2",
94
+ "nx": "~16.5.0",
89
95
  "onchange": "^7.0.2",
90
96
  "pid-from-port": "^1.1.3",
91
97
  "semver": "^7.5.2",
92
98
  "ts-jest": "^29.1.0",
93
- "type-fest": "^3.6.1",
99
+ "type-fest": "^3.12.0",
94
100
  "typescript": "~5.0.2"
95
101
  },
96
102
  "openApiSupportedVersion": "~6.6.0",
@@ -12,7 +12,7 @@ export type CodegenTaskOptions = {
12
12
  /**
13
13
  * Path to the swagger configuration
14
14
  */
15
- specConfigPath: string | null;
15
+ specConfigPath: string;
16
16
  /**
17
17
  * Output path for the generated sdk
18
18
  */
@@ -42,6 +42,7 @@ export declare class CodeGenerator<T extends CodegenTaskOptions> {
42
42
  * Register the task in the rule's {@link SchematicContext}
43
43
  *
44
44
  * @param factoryOptions execution options (root directory for instance)
45
+ * @param factoryOptions.rootDirectory
45
46
  */
46
47
  private registerGeneratorExecutor;
47
48
  /**
@@ -52,6 +53,7 @@ export declare class CodeGenerator<T extends CodegenTaskOptions> {
52
53
  * Returns the schematic that will run the code generator
53
54
  *
54
55
  * @param _factoryOptions execution options (root directory for instance)
56
+ * @param _factoryOptions.rootDirectory
55
57
  */
56
58
  protected runCodeGeneratorFactory(_factoryOptions?: {
57
59
  rootDirectory?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"code-generator.d.ts","sourceRoot":"","sources":["../../../schematics/code-generator/code-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0E,YAAY,EAAQ,MAAM,4BAA4B,CAAC;AAGxI;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;GAOG;AACH,qBAAa,aAAa,CAAC,CAAC,SAAS,kBAAkB;IACrD;;OAEG;IACH,SAAS,CAAC,aAAa,EAAE,MAAM,CAAM;IAErC;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAcjC;;OAEG;IACH,SAAS,CAAC,iBAAiB,IAAI,CAAC;IAIhC;;;;OAIG;IACH,SAAS,CAAC,uBAAuB,CAAC,eAAe,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,YAAY,CAAC,CAAC,CAAC;IAMpG;;;;;;OAMG;IACI,wBAAwB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,cAAc,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO;CAU9G"}
1
+ {"version":3,"file":"code-generator.d.ts","sourceRoot":"","sources":["../../../schematics/code-generator/code-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0E,YAAY,EAAQ,MAAM,4BAA4B,CAAC;AAKxI;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;GAOG;AACH,qBAAa,aAAa,CAAC,CAAC,SAAS,kBAAkB;IACrD;;OAEG;IACH,SAAS,CAAC,aAAa,SAAM;IAE7B;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;;;;OAKG;IACH,OAAO,CAAC,yBAAyB;IAcjC;;OAEG;IACH,SAAS,CAAC,iBAAiB,IAAI,CAAC;IAIhC;;;;;OAKG;IACH,SAAS,CAAC,uBAAuB,CAAC,eAAe,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,YAAY,CAAC,CAAC,CAAC;IAMpG;;;;;;OAMG;IACI,wBAAwB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,cAAc,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO;CAU9G"}
@@ -39,6 +39,7 @@ class CodeGenerator {
39
39
  * Register the task in the rule's {@link SchematicContext}
40
40
  *
41
41
  * @param factoryOptions execution options (root directory for instance)
42
+ * @param factoryOptions.rootDirectory
42
43
  */
43
44
  registerGeneratorExecutor(factoryOptions) {
44
45
  return (tree, context) => {
@@ -62,6 +63,7 @@ class CodeGenerator {
62
63
  * Returns the schematic that will run the code generator
63
64
  *
64
65
  * @param _factoryOptions execution options (root directory for instance)
66
+ * @param _factoryOptions.rootDirectory
65
67
  */
66
68
  runCodeGeneratorFactory(_factoryOptions = {}) {
67
69
  return (_options) => {
@@ -4,9 +4,13 @@ import { OpenApiCliOptions } from './open-api-cli.options';
4
4
  * Manage the schematic to generate a sdk using the @openapitools/openapi-generator-cli
5
5
  */
6
6
  export declare class OpenApiCliGenerator extends CodeGenerator<OpenApiCliOptions> {
7
- private packageManager;
7
+ protected readonly packageManager: 'npm' | 'yarn';
8
+ protected get packageManagerRunner(): 'npx' | 'yarn';
8
9
  /** @inheritDoc */
9
- protected generatorName: string;
10
+ protected readonly generatorName = "openapi-codegen-npm-cli";
11
+ constructor(options?: {
12
+ packageManager?: 'npm' | 'yarn' | '';
13
+ });
10
14
  /**
11
15
  * Install the specified java open api generator
12
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"open-api-cli.generator.d.ts","sourceRoot":"","sources":["../../../../schematics/code-generator/open-api-cli-generator/open-api-cli.generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAoC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAE5F;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,aAAa,CAAC,iBAAiB,CAAC;IACvE,OAAO,CAAC,cAAc,CAA+G;IACrI,kBAAkB;IAClB,SAAS,CAAC,aAAa,SAA6B;IAEpD;;;;;OAKG;IACH,OAAO,CAAC,0BAA0B;IAelC;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAuBpB,kBAAkB;IAClB,SAAS,CAAC,iBAAiB,0BAA2C;IAEtE,kBAAkB;IAClB,SAAS,CAAC,uBAAuB,oBAAoB;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,yBAE5C,iBAAiB,wBAclD;CACH"}
1
+ {"version":3,"file":"open-api-cli.generator.d.ts","sourceRoot":"","sources":["../../../../schematics/code-generator/open-api-cli-generator/open-api-cli.generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAoC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAI5F;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,aAAa,CAAC,iBAAiB,CAAC;IAEvE,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,KAAK,GAAG,MAAM,CAAC;IAClD,SAAS,KAAK,oBAAoB,IAAI,KAAK,GAAG,MAAM,CAEnD;IAED,kBAAkB;IAClB,SAAS,CAAC,QAAQ,CAAC,aAAa,6BAA6B;gBAEjD,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,EAAE,CAAA;KAAE;IAK9D;;;;;OAKG;IACH,OAAO,CAAC,0BAA0B;IAelC;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAsBpB,kBAAkB;IAClB,SAAS,CAAC,iBAAiB,0BAA2C;IAEtE,kBAAkB;IAClB,SAAS,CAAC,uBAAuB,oBAAoB;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,yBAI5C,iBAAiB,wBAclD;CACH"}
@@ -4,20 +4,26 @@ exports.OpenApiCliGenerator = void 0;
4
4
  const code_generator_1 = require("../code-generator");
5
5
  const node_child_process_1 = require("node:child_process");
6
6
  const open_api_cli_options_1 = require("./open-api-cli.options");
7
+ const path = require("node:path");
8
+ const node_install_1 = require("../../helpers/node-install");
7
9
  /**
8
10
  * Manage the schematic to generate a sdk using the @openapitools/openapi-generator-cli
9
11
  */
10
12
  class OpenApiCliGenerator extends code_generator_1.CodeGenerator {
11
- constructor() {
12
- super(...arguments);
13
- this.packageManager = process.env && process.env.npm_execpath && process.env.npm_execpath.indexOf('yarn') === -1 ? 'npm' : 'yarn';
13
+ get packageManagerRunner() {
14
+ return this.packageManager === 'npm' ? 'npx' : 'yarn';
15
+ }
16
+ constructor(options) {
17
+ super();
14
18
  /** @inheritDoc */
15
19
  this.generatorName = 'openapi-codegen-npm-cli';
16
20
  /** @inheritDoc */
17
21
  this.getDefaultOptions = () => open_api_cli_options_1.defaultTypescriptGeneratorOptions;
18
22
  /** @inheritDoc */
19
23
  this.runCodeGeneratorFactory = (factoryOptions = {}) => {
20
- const rootDirectory = factoryOptions.rootDirectory || process.cwd();
24
+ const rootDirectory = factoryOptions.rootDirectory ?
25
+ (path.isAbsolute(factoryOptions.rootDirectory) ? factoryOptions.rootDirectory : path.resolve(process.cwd(), factoryOptions.rootDirectory)) :
26
+ process.cwd();
21
27
  return async (generatorOptions) => {
22
28
  if (!generatorOptions) {
23
29
  return Promise.reject('Missing options to run open api generator');
@@ -33,6 +39,7 @@ class OpenApiCliGenerator extends code_generator_1.CodeGenerator {
33
39
  await this.runGenerator(generatorOptions, spawnOptions);
34
40
  };
35
41
  };
42
+ this.packageManager = (0, node_install_1.getPackageManagerName)(options?.packageManager);
36
43
  }
37
44
  /**
38
45
  * Install the specified java open api generator
@@ -42,7 +49,7 @@ class OpenApiCliGenerator extends code_generator_1.CodeGenerator {
42
49
  */
43
50
  runInstallOpenApiGenerator(version, spawnOptions) {
44
51
  return new Promise((resolve, reject) => {
45
- (0, node_child_process_1.spawn)(this.packageManager, ['run', 'openapi-generator-cli', 'version-manager', 'set', version], spawnOptions).on('close', (code) => {
52
+ (0, node_child_process_1.spawn)(this.packageManagerRunner, ['openapi-generator-cli', 'version-manager', 'set', version], spawnOptions).on('close', (code) => {
46
53
  if (code === 0) {
47
54
  resolve();
48
55
  }
@@ -60,7 +67,6 @@ class OpenApiCliGenerator extends code_generator_1.CodeGenerator {
60
67
  */
61
68
  runGenerator(generatorOptions, spawnOptions) {
62
69
  const args = [
63
- 'run',
64
70
  'openapi-generator-cli',
65
71
  'generate',
66
72
  generatorOptions.generatorCustomPath ? `--custom-generator=${generatorOptions.generatorCustomPath}` : '',
@@ -70,7 +76,7 @@ class OpenApiCliGenerator extends code_generator_1.CodeGenerator {
70
76
  '-o', generatorOptions.outputPath
71
77
  ];
72
78
  return new Promise((resolve, reject) => {
73
- (0, node_child_process_1.spawn)(this.packageManager === 'npm' ? 'npx' : this.packageManager, args, spawnOptions)
79
+ (0, node_child_process_1.spawn)(this.packageManagerRunner, args, spawnOptions)
74
80
  .on('close', (code) => {
75
81
  if (code === 0) {
76
82
  resolve();
@@ -12,7 +12,7 @@ export type OpenApiCliOptions = CodegenTaskOptions & {
12
12
  *
13
13
  * @default null
14
14
  */
15
- generatorVersion: string | null;
15
+ generatorVersion: string;
16
16
  /**
17
17
  * The Open Api Generator to run
18
18
  *
@@ -24,7 +24,7 @@ export type OpenApiCliOptions = CodegenTaskOptions & {
24
24
  *
25
25
  * @default path to our own custom typescript generator
26
26
  */
27
- generatorCustomPath: string | null;
27
+ generatorCustomPath: string;
28
28
  };
29
29
  /**
30
30
  * Default options to run our custom typescript generator
@@ -1 +1 @@
1
- {"version":3,"file":"open-api-cli.options.d.ts","sourceRoot":"","sources":["../../../../schematics/code-generator/open-api-cli-generator/open-api-cli.options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAGrD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG;IACnD;;;;;;;OAOG;IACH,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iCAAiC,EAAE,iBAO/C,CAAC"}
1
+ {"version":3,"file":"open-api-cli.options.d.ts","sourceRoot":"","sources":["../../../../schematics/code-generator/open-api-cli-generator/open-api-cli.options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAGrD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG;IACnD;;;;;;;OAOG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iCAAiC,EAAE,iBAO/C,CAAC"}
@@ -6,11 +6,11 @@ const path = require("node:path");
6
6
  * Default options to run our custom typescript generator
7
7
  */
8
8
  exports.defaultTypescriptGeneratorOptions = {
9
- generatorVersion: null,
9
+ generatorVersion: '',
10
10
  generatorName: 'typescriptFetch',
11
11
  generatorCustomPath: path.join(__dirname, '..', '..', 'typescript', 'core', 'openapi-codegen-typescript', 'target', 'typescriptFetch-openapi-generator.jar'),
12
12
  specPath: 'swagger-spec.yaml',
13
13
  outputPath: '.',
14
- specConfigPath: null
14
+ specConfigPath: ''
15
15
  };
16
16
  //# sourceMappingURL=open-api-cli.options.js.map
@@ -12,6 +12,6 @@ exports.defaultOptions = {
12
12
  codegenLanguage: 'default',
13
13
  specPath: 'swagger-spec.yaml',
14
14
  outputPath: '.',
15
- specConfigPath: null
15
+ specConfigPath: ''
16
16
  };
17
17
  //# sourceMappingURL=swagger-java.options.js.map
@@ -0,0 +1,62 @@
1
+ import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
2
+ import type { SupportedPackageManagers } from '@o3r/schematics';
3
+ /**
4
+ * Get the Package Manager
5
+ *
6
+ * @param enforcedNpmManager package manager to enforce
7
+ */
8
+ export declare function getPackageManagerName(enforcedNpmManager?: SupportedPackageManagers | '' | undefined | null): SupportedPackageManagers;
9
+ /**
10
+ * Duplication of the interface not exposed by the @angular-devkit/schematics
11
+ */
12
+ export interface NodePackageInstallTaskOptions {
13
+ packageManager?: 'yarn' | 'npm' | '';
14
+ packageName?: string;
15
+ workingDirectory?: string;
16
+ quiet?: boolean;
17
+ hideOutput?: boolean;
18
+ allowScripts?: boolean;
19
+ }
20
+ /**
21
+ * Install dev dependency on your application
22
+ *
23
+ * Note: it should not be moved to other packages as it should run before the installation
24
+ * of peer dependencies
25
+ */
26
+ export declare class DevInstall extends NodePackageInstallTask {
27
+ quiet: boolean;
28
+ constructor(options?: NodePackageInstallTaskOptions);
29
+ /** @inheritdoc */
30
+ toConfiguration(): {
31
+ name: string;
32
+ options: {
33
+ command: string;
34
+ quiet: boolean;
35
+ workingDirectory: string | undefined;
36
+ packageName: string;
37
+ packageManager: string | undefined;
38
+ };
39
+ };
40
+ }
41
+ /**
42
+ * Run NPM Install
43
+ */
44
+ export declare class NpmInstall extends NodePackageInstallTask {
45
+ quiet: boolean;
46
+ constructor(options?: NodePackageInstallTaskOptions);
47
+ /** @inheritdoc */
48
+ toConfiguration(): {
49
+ name: string;
50
+ options: {
51
+ command: string;
52
+ quiet: boolean;
53
+ packageManager: string | undefined;
54
+ hideOutput?: boolean | undefined;
55
+ workingDirectory?: string | undefined;
56
+ packageName?: string | undefined;
57
+ allowScripts?: boolean | undefined;
58
+ };
59
+ dependencies?: import("@angular-devkit/schematics").TaskId[] | undefined;
60
+ };
61
+ }
62
+ //# sourceMappingURL=node-install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-install.d.ts","sourceRoot":"","sources":["../../../schematics/helpers/node-install.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAEhE;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,kBAAkB,CAAC,EAAE,wBAAwB,GAAG,EAAE,GAAG,SAAS,GAAG,IAAI,GAAG,wBAAwB,CAErI;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,cAAc,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,EAAE,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;GAKG;AACH,qBAAa,UAAW,SAAQ,sBAAsB;IAC7C,KAAK,UAAS;gBAET,OAAO,CAAC,EAAE,6BAA6B;IAMnD,kBAAkB;IACX,eAAe;;;;;;;;;;CAYvB;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,sBAAsB;IAC7C,KAAK,UAAS;gBAET,OAAO,CAAC,EAAE,6BAA6B;IAMnD,kBAAkB;IACX,eAAe;;;;;;;;;;;;;CAavB"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NpmInstall = exports.DevInstall = exports.getPackageManagerName = void 0;
4
+ const options_1 = require("@angular-devkit/schematics/tasks/package-manager/options");
5
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
6
+ /**
7
+ * Get the Package Manager
8
+ *
9
+ * @param enforcedNpmManager package manager to enforce
10
+ */
11
+ function getPackageManagerName(enforcedNpmManager) {
12
+ return enforcedNpmManager || (process.env?.npm_execpath?.includes('yarn') ? 'yarn' : 'npm');
13
+ }
14
+ exports.getPackageManagerName = getPackageManagerName;
15
+ /**
16
+ * Install dev dependency on your application
17
+ *
18
+ * Note: it should not be moved to other packages as it should run before the installation
19
+ * of peer dependencies
20
+ */
21
+ class DevInstall extends tasks_1.NodePackageInstallTask {
22
+ constructor(options) {
23
+ super(options);
24
+ this.quiet = false;
25
+ this.packageManager = getPackageManagerName(options?.packageManager);
26
+ }
27
+ /** @inheritdoc */
28
+ toConfiguration() {
29
+ return {
30
+ name: options_1.NodePackageName,
31
+ options: {
32
+ command: 'install',
33
+ quiet: this.quiet,
34
+ workingDirectory: this.workingDirectory,
35
+ packageName: `${this.packageName} ${this.packageManager === 'yarn' ? '--prefer-dev' : '-D'}`,
36
+ packageManager: this.packageManager
37
+ }
38
+ };
39
+ }
40
+ }
41
+ exports.DevInstall = DevInstall;
42
+ /**
43
+ * Run NPM Install
44
+ */
45
+ class NpmInstall extends tasks_1.NodePackageInstallTask {
46
+ constructor(options) {
47
+ super(options);
48
+ this.quiet = false;
49
+ this.packageManager = getPackageManagerName(options?.packageManager);
50
+ }
51
+ /** @inheritdoc */
52
+ toConfiguration() {
53
+ const config = super.toConfiguration();
54
+ return {
55
+ ...config,
56
+ name: options_1.NodePackageName,
57
+ options: {
58
+ ...config.options,
59
+ command: 'install',
60
+ quiet: this.quiet,
61
+ packageManager: this.packageManager
62
+ }
63
+ };
64
+ }
65
+ }
66
+ exports.NpmInstall = NpmInstall;
67
+ //# sourceMappingURL=node-install.js.map
@@ -22,7 +22,7 @@ function ngGenerateJavaClientCore(options) {
22
22
  * @param context
23
23
  */
24
24
  const clearGeneratedCode = async (tree, context) => {
25
- const swaggerConfig = options.swaggerConfigPath ? JSON.parse(await node_fs_1.promises.readFile(options.swaggerConfigPath, { encoding: 'utf8' })) : undefined;
25
+ const swaggerConfig = options.specConfigPath ? JSON.parse(await node_fs_1.promises.readFile(options.specConfigPath, { encoding: 'utf8' })) : undefined;
26
26
  if (swaggerConfig?.additionalProperties) {
27
27
  const modelPackage = swaggerConfig.additionalProperties?.basePackage;
28
28
  if (modelPackage) {
@@ -72,7 +72,7 @@ function ngGenerateJavaClientCore(options) {
72
72
  specPath,
73
73
  codegenLanguage: 'javaClient',
74
74
  apiTests: false,
75
- specConfigPath: options.swaggerConfigPath
75
+ specConfigPath: options.specConfigPath
76
76
  })
77
77
  ]);
78
78
  }
@@ -3,6 +3,6 @@ export interface NgGenerateJavaClientCoreSchematicsSchema extends JsonObject {
3
3
  /** Path to the swagger specification used to generate the SDK */
4
4
  specPath: string;
5
5
  /** Swagger config file */
6
- swaggerConfigPath: string | null;
6
+ specConfigPath: string;
7
7
  }
8
8
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../schematics/java/client-core/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,WAAW,wCAAyC,SAAQ,UAAU;IAC1E,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;IAEjB,0BAA0B;IAC1B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../schematics/java/client-core/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,WAAW,wCAAyC,SAAQ,UAAU;IAC1E,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;IAEjB,0BAA0B;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB"}
@@ -13,10 +13,10 @@
13
13
  "index": 0
14
14
  }
15
15
  },
16
- "swaggerConfigPath": {
16
+ "specConfigPath": {
17
17
  "type": "string",
18
18
  "description": "Swagger config file\nMore info: https://openapi-generator.tech/docs/generators/java/#config-options",
19
- "default": null
19
+ "default": ""
20
20
  }
21
21
  },
22
22
  "additionalProperties": true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4B,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAkCpG;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,IAiDtC,CAAC;AACF;;;;GAIG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAuB5B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAYpG;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,IAkDtC,CAAC;AA8FF;;;;GAIG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAW5B"}