@ama-sdk/schematics 9.0.0-alpha.26 → 9.0.0-alpha.28

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 (41) hide show
  1. package/README.md +19 -14
  2. package/collection.json +0 -6
  3. package/package.json +7 -7
  4. package/schematics/code-generator/code-generator.d.ts +2 -0
  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/helpers/node-install.d.ts +62 -0
  11. package/schematics/helpers/node-install.d.ts.map +1 -0
  12. package/schematics/helpers/node-install.js +67 -0
  13. package/schematics/java/client-core/swagger-codegen-java-client/target/javaClient-swagger-codegen-tests.jar +0 -0
  14. package/schematics/java/client-core/swagger-codegen-java-client/target/javaClient-swagger-codegen.jar +0 -0
  15. package/schematics/ng-add/index.d.ts.map +1 -1
  16. package/schematics/ng-add/index.js +4 -32
  17. package/schematics/typescript/core/index.d.ts.map +1 -1
  18. package/schematics/typescript/core/index.js +15 -13
  19. package/schematics/typescript/core/openapi-codegen-typescript/target/typescriptFetch-openapi-generator-tests.jar +0 -0
  20. package/schematics/typescript/core/openapi-codegen-typescript/target/typescriptFetch-openapi-generator.jar +0 -0
  21. package/schematics/typescript/core/schema.d.ts +4 -0
  22. package/schematics/typescript/core/schema.d.ts.map +1 -1
  23. package/schematics/typescript/core/schema.json +15 -0
  24. package/schematics/typescript/shell/index.d.ts.map +1 -1
  25. package/schematics/typescript/shell/index.js +15 -3
  26. package/schematics/typescript/shell/schema.d.ts +6 -0
  27. package/schematics/typescript/shell/schema.d.ts.map +1 -1
  28. package/schematics/typescript/shell/schema.json +20 -1
  29. package/schematics/typescript/shell/templates/base/.gitignore.template +68 -0
  30. package/schematics/typescript/shell/templates/base/.vscode/settings.json +20 -0
  31. package/schematics/typescript/shell/templates/base/jest.config.js +1 -1
  32. package/schematics/typescript/create/index.d.ts +0 -9
  33. package/schematics/typescript/create/index.d.ts.map +0 -1
  34. package/schematics/typescript/create/index.js +0 -17
  35. package/schematics/typescript/create/schema.d.ts +0 -5
  36. package/schematics/typescript/create/schema.d.ts.map +0 -1
  37. package/schematics/typescript/create/schema.js +0 -3
  38. package/schematics/typescript/create/schema.json +0 -40
  39. /package/schematics/typescript/shell/templates/base/{.eslintignore → .eslintignore.template} +0 -0
  40. /package/schematics/typescript/shell/templates/base/{.eslintrc.js → .eslintrc.js.template} +0 -0
  41. /package/schematics/typescript/shell/templates/base/{package.json → package.json.template} +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.26",
3
+ "version": "9.0.0-alpha.28",
4
4
  "description": "Swagger specification SDK Generator by schematics",
5
5
  "scripts": {
6
6
  "nx": "nx",
@@ -41,19 +41,18 @@
41
41
  }
42
42
  },
43
43
  "peerDependencies": {
44
- "@ama-sdk/core": "^9.0.0-alpha.26",
44
+ "@ama-sdk/core": "^9.0.0-alpha.28",
45
45
  "@angular-devkit/core": "~16.0.5",
46
46
  "@angular-devkit/schematics": "~16.0.5",
47
47
  "@angular-devkit/schematics-cli": "~16.0.5",
48
48
  "@angular/cli": "~16.0.5",
49
- "@o3r/schematics": "^9.0.0-alpha.26",
50
49
  "@openapitools/openapi-generator-cli": "~2.6.0",
51
50
  "@schematics/angular": "~16.0.5"
52
51
  },
53
52
  "dependencies": {
54
53
  "@angular-devkit/core": "~16.0.5",
55
54
  "@angular-devkit/schematics": "~16.0.5",
56
- "@o3r/dev-tools": "^9.0.0-alpha.26",
55
+ "@o3r/dev-tools": "^9.0.0-alpha.28",
57
56
  "js-yaml": "^4.1.0",
58
57
  "minimatch": "^9.0.0",
59
58
  "rxjs": "^7.8.1",
@@ -62,13 +61,14 @@
62
61
  "tslib": "^2.5.3"
63
62
  },
64
63
  "devDependencies": {
65
- "@ama-sdk/core": "^9.0.0-alpha.26",
64
+ "@ama-sdk/core": "^9.0.0-alpha.28",
66
65
  "@angular-devkit/schematics-cli": "~16.0.5",
67
66
  "@angular-eslint/eslint-plugin": "~16.0.3",
68
67
  "@angular/cli": "~16.0.5",
69
68
  "@nx/jest": "~16.5.0",
70
- "@o3r/build-helpers": "^9.0.0-alpha.26",
71
- "@o3r/eslint-plugin": "^9.0.0-alpha.26",
69
+ "@o3r/build-helpers": "^9.0.0-alpha.28",
70
+ "@o3r/eslint-plugin": "^9.0.0-alpha.28",
71
+ "@o3r/schematics": "^9.0.0-alpha.28",
72
72
  "@openapitools/openapi-generator-cli": "~2.6.0",
73
73
  "@schematics/angular": "~16.0.5",
74
74
  "@types/jest": "~29.5.2",
@@ -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,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,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();
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAuCpG;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,IAiDtC,CAAC;AA6FF;;;;GAIG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAW5B"}
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,IAiDtC,CAAC;AA6FF;;;;GAIG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAW5B"}
@@ -3,42 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ngAdd = exports.updatePackageJsonScripts = void 0;
4
4
  const core_1 = require("@angular-devkit/core");
5
5
  const schematics_1 = require("@angular-devkit/schematics");
6
- const tasks_1 = require("@angular-devkit/schematics/tasks");
7
- const options_1 = require("@angular-devkit/schematics/tasks/package-manager/options");
8
- const node_fs_1 = require("node:fs");
9
6
  const path = require("node:path");
7
+ const node_fs_1 = require("node:fs");
10
8
  const rxjs_1 = require("rxjs");
9
+ const node_install_1 = require("../helpers/node-install");
11
10
  const packageJsonPath = '/package.json';
12
11
  const swaggerIgnorePath = '/.swagger-codegen-ignore';
13
12
  const openApiIgnorePath = '/.openapi-generator-ignore';
14
13
  const openApiConfigPath = 'openapitools.json';
15
- const packageManager = process.env && process.env.npm_execpath && process.env.npm_execpath.indexOf('yarn') === -1 ? 'npm' : 'yarn';
16
- /**
17
- * Install dev dependency on your application
18
- *
19
- * Note: it should not be moved to other packages as it should run before the installation
20
- * of peer dependencies
21
- */
22
- class DevInstall extends tasks_1.NodePackageInstallTask {
23
- constructor() {
24
- super(...arguments);
25
- this.quiet = false;
26
- }
27
- /** @inheritdoc */
28
- toConfiguration() {
29
- const installOptions = packageManager;
30
- return {
31
- name: options_1.NodePackageName,
32
- options: {
33
- command: 'install',
34
- quiet: this.quiet,
35
- workingDirectory: this.workingDirectory,
36
- packageName: `${this.packageName} ${installOptions === 'yarn' ? '--prefer-dev' : '-D'}`,
37
- packageManager: installOptions
38
- }
39
- };
40
- }
41
- }
42
14
  /**
43
15
  * Rule to update package.json scripts using yeoman generator from `@ama-sdk/generator-sdk`
44
16
  *
@@ -119,7 +91,7 @@ const installOpenApiToolsCli = async (tree, context) => {
119
91
  const amaSdkSchematicsOpenApiCliVersion = amaSdkSchematicsPackageJsonContent.peerDependencies?.['@openapitools/openapi-generator-cli'] || '';
120
92
  // eslint-disable-next-line @typescript-eslint/naming-convention
121
93
  packageJsonContent.devDependencies = { ...packageJsonContent.devDependencies, '@openapitools/openapi-generator-cli': amaSdkSchematicsOpenApiCliVersion };
122
- context.addTask(new DevInstall({
94
+ context.addTask(new node_install_1.DevInstall({
123
95
  packageName: `@openapitools/openapi-generator-cli@${amaSdkSchematicsOpenApiCliVersion}`,
124
96
  hideOutput: false,
125
97
  quiet: false
@@ -148,7 +120,7 @@ const registerPackageSchematics = async (tree, context) => {
148
120
  const amaSdkSchematicsVersion = amaSdkSchematicsPackageJsonContent.version ? `@${amaSdkSchematicsPackageJsonContent.version}` : '';
149
121
  const schematicsDependencies = ['@o3r/dev-tools', '@o3r/schematics'];
150
122
  for (const dependency of schematicsDependencies) {
151
- context.addTask(new DevInstall({
123
+ context.addTask(new node_install_1.DevInstall({
152
124
  packageName: dependency + amaSdkSchematicsVersion,
153
125
  hideOutput: false,
154
126
  quiet: false
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/typescript/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,IAAI,EAKL,MAAM,4BAA4B,CAAC;AASpC,OAAO,EAAE,2CAA2C,EAAE,MAAM,UAAU,CAAC;AAgBvE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,2CAA2C,GAAG,IAAI,CA0GlG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/typescript/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,IAAI,EAKL,MAAM,4BAA4B,CAAC;AASpC,OAAO,EAAE,2CAA2C,EAAE,MAAM,UAAU,CAAC;AAgBvE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,2CAA2C,GAAG,IAAI,CA4GlG"}
@@ -24,6 +24,7 @@ const getPathObjectTemplate = (pathObj) => {
24
24
  */
25
25
  function ngGenerateTypescriptSDK(options) {
26
26
  const specPath = path.resolve(process.cwd(), options.specPath);
27
+ const targetPath = options.directory || '/';
27
28
  const generateOperationFinder = async () => {
28
29
  const swayOptions = {
29
30
  definition: path.resolve(options.specPath)
@@ -49,10 +50,10 @@ function ngGenerateTypescriptSDK(options) {
49
50
  * @param _context
50
51
  */
51
52
  const clearGeneratedCode = (tree, _context) => {
52
- (0, tree_glob_1.treeGlob)(tree, path.join('src', 'api', '**', '*.ts')).forEach((file) => tree.delete(file));
53
- (0, tree_glob_1.treeGlob)(tree, path.join('src', 'api', '**', '*.ts')).forEach((file) => tree.delete(file));
54
- (0, tree_glob_1.treeGlob)(tree, path.join('src', 'models', 'base', '**', '!(index).ts')).forEach((file) => tree.delete(file));
55
- (0, tree_glob_1.treeGlob)(tree, path.join('src', 'spec', '!(operation-adapter|index).ts')).forEach((file) => tree.delete(file));
53
+ (0, tree_glob_1.treeGlob)(tree, path.join(targetPath, 'src', 'api', '**', '*.ts')).forEach((file) => tree.delete(file));
54
+ (0, tree_glob_1.treeGlob)(tree, path.join(targetPath, 'src', 'api', '**', '*.ts')).forEach((file) => tree.delete(file));
55
+ (0, tree_glob_1.treeGlob)(tree, path.join(targetPath, 'src', 'models', 'base', '**', '!(index).ts')).forEach((file) => tree.delete(file));
56
+ (0, tree_glob_1.treeGlob)(tree, path.join(targetPath, 'src', 'spec', '!(operation-adapter|index).ts')).forEach((file) => tree.delete(file));
56
57
  return tree;
57
58
  };
58
59
  /**
@@ -70,7 +71,7 @@ function ngGenerateTypescriptSDK(options) {
70
71
  swayOperationAdapter,
71
72
  empty: ''
72
73
  }),
73
- (0, schematics_1.move)('/'),
74
+ (0, schematics_1.move)(targetPath),
74
75
  (0, schematics_1.renameTemplateFiles)()
75
76
  ]), schematics_1.MergeStrategy.Overwrite);
76
77
  };
@@ -81,19 +82,20 @@ function ngGenerateTypescriptSDK(options) {
81
82
  * @param _context
82
83
  */
83
84
  const updateSpec = (tree, _context) => {
85
+ const readmeFile = path.join(targetPath, 'readme.md');
84
86
  const specContent = (0, node_fs_1.readFileSync)(specPath).toString();
85
- if (tree.exists('/readme.md')) {
87
+ if (tree.exists(readmeFile)) {
86
88
  const swaggerVersion = /version: ([0-9]+\.[0-9]+\.[0-9]+)/.exec(specContent);
87
89
  if (swaggerVersion) {
88
- const readmeContent = tree.read('/readme.md').toString('utf8');
89
- tree.overwrite('/readme.md', readmeContent.replace(/Based on Swagger spec .*/i, `Based on Swagger spec ${swaggerVersion[1]}`));
90
+ const readmeContent = tree.read(readmeFile).toString('utf8');
91
+ tree.overwrite(readmeFile, readmeContent.replace(/Based on Swagger spec .*/i, `Based on Swagger spec ${swaggerVersion[1]}`));
90
92
  }
91
93
  }
92
- if (tree.exists('/swagger-spec.yaml')) {
93
- tree.overwrite('/swagger-spec.yaml', specContent);
94
+ if (tree.exists(path.join(targetPath, 'swagger-spec.yaml'))) {
95
+ tree.overwrite(path.join(targetPath, 'swagger-spec.yaml'), specContent);
94
96
  }
95
97
  else {
96
- tree.create('/swagger-spec.yaml', specContent);
98
+ tree.create(path.join(targetPath, 'swagger-spec.yaml'), specContent);
97
99
  }
98
100
  return () => tree;
99
101
  };
@@ -103,7 +105,7 @@ function ngGenerateTypescriptSDK(options) {
103
105
  const packageOpenApiSupportedVersion = packageJsonFile.openApiSupportedVersion?.replace(/\^|~/, '');
104
106
  let openApiVersion = '';
105
107
  try {
106
- openApiVersion = tree.readJson('openapitools.json')?.['generator-cli']?.version;
108
+ openApiVersion = tree.readJson(path.join(targetPath, 'openapitools.json'))?.['generator-cli']?.version;
107
109
  }
108
110
  catch {
109
111
  context.logger.warn('No openapitools.json file found in the project');
@@ -111,7 +113,7 @@ function ngGenerateTypescriptSDK(options) {
111
113
  if (!!packageOpenApiSupportedVersion && semver.valid(packageOpenApiSupportedVersion) && (!packageOpenApiSupportedVersion || !semver.satisfies(openApiVersion, packageOpenApiSupportedVersion))) {
112
114
  generatorOptions.generatorVersion = packageOpenApiSupportedVersion;
113
115
  }
114
- return () => (new open_api_cli_generator_1.OpenApiCliGenerator()).getGeneratorRunSchematic(generatorOptions);
116
+ return () => (new open_api_cli_generator_1.OpenApiCliGenerator(options)).getGeneratorRunSchematic(generatorOptions, { rootDirectory: options.directory || undefined });
115
117
  };
116
118
  return (0, schematics_1.chain)([
117
119
  clearGeneratedCode,
@@ -2,5 +2,9 @@ import type { JsonObject } from '@angular-devkit/core';
2
2
  export interface NgGenerateTypescriptSDKCoreSchematicsSchema extends JsonObject {
3
3
  /** Path to the swagger specification used to generate the SDK */
4
4
  specPath: string;
5
+ /** Directory where to generate the SDK */
6
+ directory: string;
7
+ /** Package manager to be used in the generated SDK */
8
+ packageManager: 'npm' | 'yarn' | '';
5
9
  }
6
10
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../schematics/typescript/core/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,WAAW,2CAA4C,SAAQ,UAAU;IAC7E,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;CAClB"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../schematics/typescript/core/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,WAAW,2CAA4C,SAAQ,UAAU;IAC7E,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;IAEjB,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAElB,sDAAsD;IACtD,cAAc,EAAE,KAAK,GAAG,MAAM,GAAG,EAAE,CAAC;CACrC"}
@@ -12,6 +12,21 @@
12
12
  "$source": "argv",
13
13
  "index": 0
14
14
  }
15
+ },
16
+ "directory": {
17
+ "type": "string",
18
+ "description": "Directory where to generate the SDK",
19
+ "default": ""
20
+ },
21
+ "packageManager": {
22
+ "type": "string",
23
+ "enum": [
24
+ "",
25
+ "npm",
26
+ "yarn"
27
+ ],
28
+ "description": "Package manager to be used in the generated SDK",
29
+ "default": ""
15
30
  }
16
31
  },
17
32
  "additionalProperties": true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/typescript/shell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EAIL,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,4CAA4C,EAAE,MAAM,UAAU,CAAC;AAE7E;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,4CAA4C,GAAG,IAAI,CAqEnG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/typescript/shell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,IAAI,EAIL,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,4CAA4C,EAAE,MAAM,UAAU,CAAC;AAI7E;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,4CAA4C,GAAG,IAAI,CAiFnG"}
@@ -4,11 +4,18 @@ exports.ngGenerateTypescriptSDK = void 0;
4
4
  const schematics_1 = require("@angular-devkit/schematics");
5
5
  const js_yaml_1 = require("js-yaml");
6
6
  const read_package_1 = require("../../helpers/read-package");
7
+ const node_path_1 = require("node:path");
8
+ const node_install_1 = require("../../helpers/node-install");
7
9
  /**
8
10
  * @param options
9
11
  */
10
12
  function ngGenerateTypescriptSDK(options) {
11
- return async (tree, context) => {
13
+ const installRule = (_tree, context) => {
14
+ const workingDirectory = options.directory ? ((0, node_path_1.isAbsolute)(options.directory) ? (0, node_path_1.relative)(process.cwd(), options.directory) : options.directory) : '.';
15
+ const installTask = new node_install_1.NpmInstall({ workingDirectory, packageManager: options.packageManager, allowScripts: false });
16
+ context.addTask(installTask);
17
+ };
18
+ const setupRule = async (tree, context) => {
12
19
  const amaSdkSchematicsPackageJson = await (0, read_package_1.readPackageJson)();
13
20
  /* eslint-disable @typescript-eslint/naming-convention */
14
21
  const versions = {
@@ -64,13 +71,18 @@ function ngGenerateTypescriptSDK(options) {
64
71
  else {
65
72
  tree.create(yarnrcPath, (0, js_yaml_1.dump)(yarnrc, { indent: 2 }));
66
73
  }
74
+ const targetPath = options.directory || tree.root.path;
67
75
  const baseRule = (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./templates/base'), [
68
76
  (0, schematics_1.template)(properties),
69
- (0, schematics_1.move)(tree.root.path),
77
+ (0, schematics_1.move)(targetPath),
70
78
  (0, schematics_1.renameTemplateFiles)()
71
79
  ]), schematics_1.MergeStrategy.Overwrite);
72
- return baseRule;
80
+ return baseRule(tree, context);
73
81
  };
82
+ return (0, schematics_1.chain)([
83
+ setupRule,
84
+ ...(options.skipInstall ? [] : [installRule])
85
+ ]);
74
86
  }
75
87
  exports.ngGenerateTypescriptSDK = ngGenerateTypescriptSDK;
76
88
  //# sourceMappingURL=index.js.map
@@ -6,5 +6,11 @@ export interface NgGenerateTypescriptSDKShellSchematicsSchema extends JsonObject
6
6
  package: string;
7
7
  /** Project description */
8
8
  description: string;
9
+ /** Directory where to generate the SDK */
10
+ directory: string;
11
+ /** Package manager to be used in the generated SDK */
12
+ packageManager: 'npm' | 'yarn' | '';
13
+ /** Skip NPM install */
14
+ skipInstall: boolean;
9
15
  }
10
16
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../schematics/typescript/shell/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,WAAW,4CAA6C,SAAQ,UAAU;IAC9E,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IAEb,mBAAmB;IACnB,OAAO,EAAE,MAAM,CAAC;IAEhB,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../schematics/typescript/shell/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,WAAW,4CAA6C,SAAQ,UAAU;IAC9E,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IAEb,mBAAmB;IACnB,OAAO,EAAE,MAAM,CAAC;IAEhB,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAC;IAEpB,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAElB,sDAAsD;IACtD,cAAc,EAAE,KAAK,GAAG,MAAM,GAAG,EAAE,CAAC;IAEpC,uBAAuB;IACvB,WAAW,EAAE,OAAO,CAAC;CACtB"}
@@ -17,9 +17,28 @@
17
17
  },
18
18
  "description": {
19
19
  "type": "string",
20
- "alias": "package",
21
20
  "description": "Project description",
22
21
  "default": ""
22
+ },
23
+ "directory": {
24
+ "type": "string",
25
+ "description": "Directory where to generate the SDK",
26
+ "default": ""
27
+ },
28
+ "skipInstall": {
29
+ "type": "boolean",
30
+ "description": "Skip NPM install",
31
+ "default": false
32
+ },
33
+ "packageManager": {
34
+ "type": "string",
35
+ "enum": [
36
+ "",
37
+ "npm",
38
+ "yarn"
39
+ ],
40
+ "description": "Package manager to be used in the generated SDK",
41
+ "default": ""
23
42
  }
24
43
  },
25
44
  "additionalProperties": true,
@@ -0,0 +1,68 @@
1
+ # Build results
2
+ /dist-*
3
+ /dist
4
+ /test-*
5
+ /test
6
+ /generated-*
7
+ /build
8
+
9
+ # Local configurations
10
+ .custom.yo-rc.json
11
+
12
+ # Open API
13
+ .openapi-generator
14
+
15
+ # Optional eslint cache
16
+ .eslintcache
17
+
18
+
19
+ ### Intellij ###
20
+ .idea/
21
+
22
+ ### VisualStudioCode ###
23
+ .vscode/*
24
+ !.vscode/settings.json
25
+ !.vscode/tasks.json
26
+ !.vscode/launch.json
27
+ !.vscode/extensions.json
28
+ !.vscode/*.code-snippets
29
+
30
+ # Local History for Visual Studio Code
31
+ .history/
32
+
33
+ # Built Visual Studio Code Extensions
34
+ *.vsix
35
+
36
+ ### VisualStudioCode Patch ###
37
+ # Ignore all local history of files
38
+ .history
39
+ .ionide
40
+
41
+ # Support for Project snippet scope
42
+
43
+ ### yarn ###
44
+ # https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
45
+
46
+ .yarn/*
47
+ !.yarn/releases
48
+ !.yarn/patches
49
+ !.yarn/plugins
50
+ !.yarn/sdks
51
+ !.yarn/versions
52
+
53
+ # if you are NOT using Zero-installs, then:
54
+ # comment the following lines
55
+ .yarn/cache
56
+
57
+ # and uncomment the following lines
58
+ .pnp.*
59
+
60
+ ### Yeoman ###
61
+ node_modules/
62
+ bower_components/
63
+ *.log
64
+
65
+ build/
66
+ dist/
67
+
68
+ # End of https://www.toptal.com/developers/gitignore/api/yeoman,visualstudiocode,yarn
@@ -0,0 +1,20 @@
1
+ {
2
+ "typescript.preferences.importModuleSpecifier": "relative",
3
+ "typescript.preferences.quoteStyle": "single",
4
+ "jest.jestCommandLine": "yarn jest",
5
+ "jest.autoRun": {
6
+ "watch": false,
7
+ "onSave": "test-file"
8
+ },
9
+ "files.readonlyFromPermissions": true,
10
+ "files.readonlyInclude": {
11
+ "**/.cache/**": true,
12
+ "**/.pnp.*": true,
13
+ "**/.yarn/**": true,
14
+ "**/node_modules/**": true,
15
+ "src/base/*/*.ts": true
16
+ },
17
+ "files.readonlyExclude": {
18
+ "src/base/*/index.ts": true
19
+ }
20
+ }
@@ -1,4 +1,4 @@
1
- /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
1
+ /** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
2
2
  module.exports = {
3
3
  displayName: require('./package.json').name,
4
4
  preset: 'ts-jest',
@@ -1,9 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { NgGenerateTypescriptSDKCreateSchematicsSchema } from './schema';
3
- /**
4
- * Generate a typescript SDK repository and source code base on swagger specification
5
- *
6
- * @param options
7
- */
8
- export declare function ngGenerateTypescriptSDK(options: NgGenerateTypescriptSDKCreateSchematicsSchema): Rule;
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/typescript/create/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAAa,MAAM,4BAA4B,CAAC;AAGpE,OAAO,EAAE,6CAA6C,EAAE,MAAM,UAAU,CAAC;AAEzE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,6CAA6C,GAAG,IAAI,CAKpG"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ngGenerateTypescriptSDK = void 0;
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- /**
6
- * Generate a typescript SDK repository and source code base on swagger specification
7
- *
8
- * @param options
9
- */
10
- function ngGenerateTypescriptSDK(options) {
11
- return (0, schematics_1.chain)([
12
- (0, schematics_1.schematic)('typescript-shell', options),
13
- (0, schematics_1.schematic)('typescript-core', options)
14
- ]);
15
- }
16
- exports.ngGenerateTypescriptSDK = ngGenerateTypescriptSDK;
17
- //# sourceMappingURL=index.js.map
@@ -1,5 +0,0 @@
1
- import { NgGenerateTypescriptSDKCoreSchematicsSchema } from '../core/schema';
2
- import { NgGenerateTypescriptSDKShellSchematicsSchema } from '../shell/schema';
3
- export interface NgGenerateTypescriptSDKCreateSchematicsSchema extends NgGenerateTypescriptSDKCoreSchematicsSchema, NgGenerateTypescriptSDKShellSchematicsSchema {
4
- }
5
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../schematics/typescript/create/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2CAA2C,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,4CAA4C,EAAE,MAAM,iBAAiB,CAAC;AAE/E,MAAM,WAAW,6CAA8C,SAAQ,2CAA2C,EAAE,4CAA4C;CAE/J"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=schema.js.map
@@ -1,40 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "NgGenerateTypescriptSDKCreateSchematicsSchema",
4
- "title": "Generate Typescript SDK",
5
- "description": "ng generate typescript-sdk",
6
- "properties": {
7
- "specPath": {
8
- "type": "string",
9
- "description": "Path to the swagger specification used to generate the SDK",
10
- "x-prompt": "Path to the swagger spec",
11
- "$default": {
12
- "$source": "argv",
13
- "index": 0
14
- }
15
- },
16
- "name": {
17
- "type": "string",
18
- "description": "Project name (NPM package scope)",
19
- "x-prompt": "Project name (NPM package scope)?"
20
- },
21
- "package": {
22
- "type": "string",
23
- "description": "Package name",
24
- "x-prompt": "Package name?",
25
- "default": "sdk"
26
- },
27
- "description": {
28
- "type": "string",
29
- "alias": "package",
30
- "description": "Project description",
31
- "default": ""
32
- }
33
- },
34
- "required": [
35
- "name",
36
- "package",
37
- "specPath"
38
- ],
39
- "additionalProperties": true
40
- }