@ama-sdk/schematics 9.1.0-alpha.30 → 9.1.0-alpha.32

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 (23) hide show
  1. package/package.json +7 -7
  2. package/schematics/java/client-core/swagger-codegen-java-client/target/javaClient-swagger-codegen-tests.jar +0 -0
  3. package/schematics/java/client-core/swagger-codegen-java-client/target/javaClient-swagger-codegen.jar +0 -0
  4. package/schematics/typescript/core/index.js +5 -5
  5. package/schematics/typescript/core/openapi-codegen-typescript/target/typescriptFetch-openapi-generator-tests.jar +0 -0
  6. package/schematics/typescript/core/openapi-codegen-typescript/target/typescriptFetch-openapi-generator.jar +0 -0
  7. package/schematics/typescript/shell/index.d.ts.map +1 -1
  8. package/schematics/typescript/shell/index.js +17 -14
  9. package/schematics/typescript/shell/schema.json +1 -1
  10. package/schematics/typescript/shell/templates/base/.gitignore.template +2 -6
  11. package/schematics/typescript/shell/templates/base/.husky/commit-msg +1 -1
  12. package/schematics/typescript/shell/templates/base/.husky/pre-commit +1 -1
  13. package/schematics/typescript/shell/templates/base/.renovaterc.json +3 -3
  14. package/schematics/typescript/shell/templates/base/.vscode/settings.json +3 -1
  15. package/schematics/typescript/shell/templates/base/package.json.template +5 -6
  16. package/schematics/typescript/shell/templates/base/readme.md +1 -0
  17. package/schematics/typescript/shell/templates/base/src/api/fixtures.jest.ts +2 -0
  18. package/schematics/typescript/shell/templates/base/src/api/index.ts +1 -0
  19. package/schematics/typescript/shell/templates/base/src/models/base/enums.ts +2 -0
  20. package/schematics/typescript/shell/templates/base/src/models/base/index.ts +1 -0
  21. package/schematics/typescript/shell/templates/base/src/models/base/patterns.ts +2 -0
  22. package/schematics/typescript/shell/templates/base/src/spec/api-mock.ts +2 -0
  23. package/schematics/typescript/shell/templates/base/src/spec/operation-adapter.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ama-sdk/schematics",
3
- "version": "9.1.0-alpha.30",
3
+ "version": "9.1.0-alpha.32",
4
4
  "description": "Swagger specification SDK Generator by schematics",
5
5
  "scripts": {
6
6
  "nx": "nx",
@@ -38,7 +38,7 @@
38
38
  }
39
39
  },
40
40
  "peerDependencies": {
41
- "@ama-sdk/core": "^9.1.0-alpha.30",
41
+ "@ama-sdk/core": "^9.1.0-alpha.32",
42
42
  "@angular-devkit/core": "^16.0.5",
43
43
  "@angular-devkit/schematics": "^16.0.5",
44
44
  "@angular-devkit/schematics-cli": "^16.0.5",
@@ -48,7 +48,7 @@
48
48
  "dependencies": {
49
49
  "@angular-devkit/core": "~16.0.5",
50
50
  "@angular-devkit/schematics": "~16.0.5",
51
- "@o3r/dev-tools": "^9.1.0-alpha.30",
51
+ "@o3r/dev-tools": "^9.1.0-alpha.32",
52
52
  "js-yaml": "^4.1.0",
53
53
  "minimatch": "^9.0.0",
54
54
  "rxjs": "^7.8.1",
@@ -57,14 +57,14 @@
57
57
  "tslib": "^2.5.3"
58
58
  },
59
59
  "devDependencies": {
60
- "@ama-sdk/core": "^9.1.0-alpha.30",
60
+ "@ama-sdk/core": "^9.1.0-alpha.32",
61
61
  "@angular-devkit/schematics-cli": "~16.0.5",
62
62
  "@angular-eslint/eslint-plugin": "~16.0.3",
63
63
  "@angular/cli": "~16.0.5",
64
64
  "@nx/jest": "~16.5.0",
65
- "@o3r/build-helpers": "^9.1.0-alpha.30",
66
- "@o3r/eslint-plugin": "^9.1.0-alpha.30",
67
- "@o3r/schematics": "^9.1.0-alpha.30",
65
+ "@o3r/build-helpers": "^9.1.0-alpha.32",
66
+ "@o3r/eslint-plugin": "^9.1.0-alpha.32",
67
+ "@o3r/schematics": "^9.1.0-alpha.32",
68
68
  "@openapitools/openapi-generator-cli": "~2.7.0",
69
69
  "@schematics/angular": "~16.0.5",
70
70
  "@types/jest": "~29.5.2",
@@ -24,7 +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
+ const targetPath = options.directory || '';
28
28
  const globalProperty = options.globalProperty;
29
29
  const generateOperationFinder = async () => {
30
30
  const swayOptions = {
@@ -51,10 +51,10 @@ function ngGenerateTypescriptSDK(options) {
51
51
  * @param _context
52
52
  */
53
53
  const clearGeneratedCode = (tree, _context) => {
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', 'api', '**', '*.ts')).forEach((file) => tree.delete(file));
56
- (0, tree_glob_1.treeGlob)(tree, path.join(targetPath, 'src', 'models', 'base', '**', '!(index).ts')).forEach((file) => tree.delete(file));
57
- (0, tree_glob_1.treeGlob)(tree, path.join(targetPath, 'src', 'spec', '!(operation-adapter|index).ts')).forEach((file) => tree.delete(file));
54
+ (0, tree_glob_1.treeGlob)(tree, path.posix.join(targetPath, 'src', 'api', '**', '*.ts')).forEach((file) => tree.delete(file));
55
+ (0, tree_glob_1.treeGlob)(tree, path.posix.join(targetPath, 'src', 'api', '**', '*.ts')).forEach((file) => tree.delete(file));
56
+ (0, tree_glob_1.treeGlob)(tree, path.posix.join(targetPath, 'src', 'models', 'base', '**', '!(index).ts')).forEach((file) => tree.delete(file));
57
+ (0, tree_glob_1.treeGlob)(tree, path.posix.join(targetPath, 'src', 'spec', '!(operation-adapter|index).ts')).forEach((file) => tree.delete(file));
58
58
  return tree;
59
59
  };
60
60
  /**
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/typescript/shell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,IAAI,EAIL,MAAM,4BAA4B,CAAC;AAKpC,OAAO,KAAK,EAAC,4CAA4C,EAAC,MAAM,UAAU,CAAC;AAE3E;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,4CAA4C,GAAG,IAAI,CAoFnG"}
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ngGenerateTypescriptSDK = void 0;
4
4
  const schematics_1 = require("@angular-devkit/schematics");
5
5
  const js_yaml_1 = require("js-yaml");
6
- const read_package_1 = require("../../helpers/read-package");
7
6
  const node_path_1 = require("node:path");
8
7
  const node_install_1 = require("../../helpers/node-install");
8
+ const read_package_1 = require("../../helpers/read-package");
9
9
  /**
10
10
  * @param options
11
11
  */
@@ -47,6 +47,7 @@ function ngGenerateTypescriptSDK(options) {
47
47
  projectName: options.name,
48
48
  projectPackageName: options.package,
49
49
  projectDescription: options.description,
50
+ packageManager: (0, node_install_1.getPackageManagerName)(options.packageManager),
50
51
  projectHosting: options.hosting,
51
52
  sdkCoreVersion: amaSdkSchematicsPackageJson.version,
52
53
  angularVersion: amaSdkSchematicsPackageJson.dependencies['@angular-devkit/core'],
@@ -56,20 +57,22 @@ function ngGenerateTypescriptSDK(options) {
56
57
  engineVersions,
57
58
  empty: ''
58
59
  };
59
- const yarnrcPath = '.yarnrc.yml';
60
- const yarnrc = ((0, js_yaml_1.load)(tree.exists(yarnrcPath) ? tree.readText(yarnrcPath) : '') || {});
61
- yarnrc.nodeLinker ||= 'pnp';
62
- yarnrc.packageExtensions ||= {};
63
- yarnrc.packageExtensions['@ama-sdk/schematics@*'] = {
64
- dependencies: {
65
- 'isomorphic-fetch': '~2.2.1'
60
+ if (properties.packageManager === 'yarn') {
61
+ const yarnrcPath = '.yarnrc.yml';
62
+ const yarnrc = ((0, js_yaml_1.load)(tree.exists(yarnrcPath) ? tree.readText(yarnrcPath) : '') || {});
63
+ yarnrc.nodeLinker ||= 'pnp';
64
+ yarnrc.packageExtensions ||= {};
65
+ yarnrc.packageExtensions['@ama-sdk/schematics@*'] = {
66
+ dependencies: {
67
+ 'isomorphic-fetch': '~2.2.1'
68
+ }
69
+ };
70
+ if (tree.exists(yarnrcPath)) {
71
+ tree.overwrite(yarnrcPath, (0, js_yaml_1.dump)(yarnrc, { indent: 2 }));
72
+ }
73
+ else {
74
+ tree.create(yarnrcPath, (0, js_yaml_1.dump)(yarnrc, { indent: 2 }));
66
75
  }
67
- };
68
- if (tree.exists(yarnrcPath)) {
69
- tree.overwrite(yarnrcPath, (0, js_yaml_1.dump)(yarnrc, { indent: 2 }));
70
- }
71
- else {
72
- tree.create(yarnrcPath, (0, js_yaml_1.dump)(yarnrc, { indent: 2 }));
73
76
  }
74
77
  const targetPath = options.directory || tree.root.path;
75
78
  const baseRule = (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./templates/base'), [
@@ -36,7 +36,7 @@
36
36
  "yarn"
37
37
  ],
38
38
  "description": "Package manager to be used in the generated SDK",
39
- "default": ""
39
+ "x-prompt": "Packaged manager used in the generated SDK ?"
40
40
  }
41
41
  },
42
42
  "additionalProperties": true,
@@ -6,9 +6,6 @@
6
6
  /generated-*
7
7
  /build
8
8
 
9
- # Local configurations
10
- .custom.yo-rc.json
11
-
12
9
  # Open API
13
10
  .openapi-generator
14
11
 
@@ -38,6 +35,7 @@
38
35
  .history
39
36
  .ionide
40
37
 
38
+ <% if (packageManager === 'yarn') { %>
41
39
  # Support for Project snippet scope
42
40
 
43
41
  ### yarn ###
@@ -56,10 +54,8 @@
56
54
 
57
55
  # and uncomment the following lines
58
56
  .pnp.*
59
-
60
- ### Yeoman ###
57
+ <% } %>
61
58
  node_modules/
62
- bower_components/
63
59
  *.log
64
60
 
65
61
  build/
@@ -1,4 +1,4 @@
1
1
  #!/bin/sh
2
2
  . "$(dirname "$0")/_/husky.sh"
3
3
 
4
- yarn commitlint --edit $1
4
+ <%=packageManager%> exec commitlint --edit $1
@@ -1,4 +1,4 @@
1
1
  #!/bin/sh
2
2
  . "$(dirname "$0")/_/husky.sh"
3
3
 
4
- yarn lint-staged
4
+ <%=packageManager%> exec lint-staged
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "updateInternalDeps": true,
28
28
  "postUpdateOptions": [
29
- "yarnDedupeHighest"
29
+ <% if (packageManager === 'yarn') { %>"yarnDedupeHighest",<% } %>
30
30
  ],
31
31
  "rangeStrategy": "replace",
32
32
  "automerge": true,
@@ -39,8 +39,8 @@
39
39
  ],
40
40
  "postUpgradeTasks": {
41
41
  "commands": [
42
- "yarn install",
43
- "yarn run swagger:generate"
42
+ "<%=packageManager%> install",
43
+ "<%=packageManager%> run generate"
44
44
  ],
45
45
  "executionMode": "branch"
46
46
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "typescript.preferences.importModuleSpecifier": "relative",
3
3
  "typescript.preferences.quoteStyle": "single",
4
- "jest.jestCommandLine": "yarn jest",
4
+ "jest.jestCommandLine": "<%=packageManager%> exec jest",
5
5
  "jest.autoRun": {
6
6
  "watch": false,
7
7
  "onSave": "test-file"
@@ -9,8 +9,10 @@
9
9
  "files.readonlyFromPermissions": true,
10
10
  "files.readonlyInclude": {
11
11
  "**/.cache/**": true,
12
+ <% if (packageManager === 'yarn') { %>
12
13
  "**/.pnp.*": true,
13
14
  "**/.yarn/**": true,
15
+ <% } %>
14
16
  "**/node_modules/**": true,
15
17
  "src/base/*/*.ts": true
16
18
  },
@@ -32,15 +32,15 @@
32
32
  "clean": "rimraf test/ test-dev/ dist/ dist-dev/ dist-test/ build/",
33
33
  "lint:ci": "eslint '**/*[jt]s' --quiet --format junit --output-file ./dist-lint/result.xml",
34
34
  "lint": "eslint '**/*[jt]s' --cache",
35
- "start": "tsc-watch -b tsconfigs/esm2020 --noClear --onFirstSuccess \"yarn files:pack --watch\"",
36
- "build": "yarn build:cjs && yarn build:esm2015 && yarn build:esm2020 && yarn files:pack",
35
+ "start": "tsc-watch -b tsconfigs/esm2020 --noClear --onFirstSuccess \"<%=packageManager%> run files:pack --watch\"",
36
+ "build": "<%=packageManager%> run build:cjs && <%=packageManager%> run build:esm2015 && <%=packageManager%> run build:esm2020 && <%=packageManager%> run files:pack",
37
37
  "build:cjs": "swc src -d dist/cjs -C module.type=commonjs -q",
38
38
  "build:esm2015": "swc src -d dist/esm2015 -C module.type=es6 -q",
39
39
  "build:esm2020": "tsc -b tsconfigs/esm2020",
40
40
  "set:version": "set-version --placeholder 0.0.0",
41
41
  "resolve": "node -e 'process.stdout.write(require.resolve(process.argv[1]));'",
42
42
  "generate": "schematics @ama-sdk/schematics:typescript-core --spec-path ./swagger-spec.yaml",
43
- "spec:regen": "schematics @ama-sdk/schematics:typescript-core --spec-path ./swagger-spec.yaml && yarn clear-index",
43
+ "spec:regen": "<%=packageManager%> run generate && <%=packageManager%> exec clear-index",
44
44
  "clear-index": "node scripts/clear-index.js",
45
45
  "files:pack": "node scripts/files-pack.js",
46
46
  "test": "jest --passWithNoTests",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "lint-staged": {
54
54
  "**/*.(js|ts)": [
55
- "yarn eslint --quiet --fix --global fast"
55
+ "<%=packageManager%> exec eslint --quiet --fix --global fast"
56
56
  ]
57
57
  },
58
58
  "dependencies": {
@@ -115,6 +115,5 @@
115
115
  "node": "<%= engineVersions['node'] %>",
116
116
  "npm": "<%= engineVersions['npm'] %>",
117
117
  "yarn": "<%= engineVersions['yarn'] %>"
118
- },
119
- "packageManager": "yarn@3.6.1"
118
+ }
120
119
  }
@@ -22,6 +22,7 @@ The Code can be regenerated by running the following command:
22
22
  ```shell
23
23
  yarn schematics @ama-sdk/sdk:typescript-core --spec-path [path to your swagger file]
24
24
  ```
25
+ Note that you can use ```npm exec``` instead of ```yarn``` for every command specified in this documentation.
25
26
 
26
27
  ***
27
28
 
@@ -0,0 +1,2 @@
1
+ // This contains testing helpers for api endpoints, will be filled when the sdk is generated from a spec.
2
+ export type { };
@@ -0,0 +1 @@
1
+ export type { };
@@ -0,0 +1,2 @@
1
+ // This contains enums from the spec, will be filled when the sdk is generated.
2
+ export { };
@@ -0,0 +1,2 @@
1
+ // This contains patterns from the spec, will be filled when the sdk is generated.
2
+ export { };
@@ -0,0 +1,2 @@
1
+ // This contains testing helpers for api endpoints, will be filled when the sdk is generated from a spec.
2
+ export { };