@ama-sdk/schematics 0.0.0-placeholder

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 (144) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +72 -0
  3. package/collection.json +42 -0
  4. package/package.json +148 -0
  5. package/schematics/api-extension/index.d.ts +9 -0
  6. package/schematics/api-extension/index.d.ts.map +1 -0
  7. package/schematics/api-extension/index.js +21 -0
  8. package/schematics/api-extension/index.js.map +1 -0
  9. package/schematics/api-extension/schema.d.ts +10 -0
  10. package/schematics/api-extension/schema.d.ts.map +1 -0
  11. package/schematics/api-extension/schema.js +3 -0
  12. package/schematics/api-extension/schema.js.map +1 -0
  13. package/schematics/api-extension/schema.json +37 -0
  14. package/schematics/api-extension/templates/.gitignore.template +38 -0
  15. package/schematics/api-extension/templates/.npmrc.template +4 -0
  16. package/schematics/api-extension/templates/package.json.template +16 -0
  17. package/schematics/api-extension/templates/src/API_swagger_template.yaml +269 -0
  18. package/schematics/api-extension/templates/src/definitions/__name__ExampleReply.yaml +20 -0
  19. package/schematics/api-extension/templates/src/generate.config.json +10 -0
  20. package/schematics/api-extension/templates/src/override/.gitkeep +0 -0
  21. package/schematics/api-extension/templates/src/products/Additional Products.yaml +25 -0
  22. package/schematics/helpers/execute-jars.d.ts +14 -0
  23. package/schematics/helpers/execute-jars.d.ts.map +1 -0
  24. package/schematics/helpers/execute-jars.js +62 -0
  25. package/schematics/helpers/execute-jars.js.map +1 -0
  26. package/schematics/helpers/generator-java.task.d.ts +59 -0
  27. package/schematics/helpers/generator-java.task.d.ts.map +1 -0
  28. package/schematics/helpers/generator-java.task.js +83 -0
  29. package/schematics/helpers/generator-java.task.js.map +1 -0
  30. package/schematics/helpers/read-package.d.ts +4 -0
  31. package/schematics/helpers/read-package.d.ts.map +1 -0
  32. package/schematics/helpers/read-package.js +12 -0
  33. package/schematics/helpers/read-package.js.map +1 -0
  34. package/schematics/helpers/tree-glob.d.ts +9 -0
  35. package/schematics/helpers/tree-glob.d.ts.map +1 -0
  36. package/schematics/helpers/tree-glob.js +27 -0
  37. package/schematics/helpers/tree-glob.js.map +1 -0
  38. package/schematics/java/client-core/index.d.ts +9 -0
  39. package/schematics/java/client-core/index.d.ts.map +1 -0
  40. package/schematics/java/client-core/index.js +74 -0
  41. package/schematics/java/client-core/index.js.map +1 -0
  42. package/schematics/java/client-core/schema.d.ts +8 -0
  43. package/schematics/java/client-core/schema.d.ts.map +1 -0
  44. package/schematics/java/client-core/schema.js +3 -0
  45. package/schematics/java/client-core/schema.js.map +1 -0
  46. package/schematics/java/client-core/schema.json +26 -0
  47. package/schematics/ng-add/index.d.ts +15 -0
  48. package/schematics/ng-add/index.d.ts.map +1 -0
  49. package/schematics/ng-add/index.js +106 -0
  50. package/schematics/ng-add/index.js.map +1 -0
  51. package/schematics/ng-add/schema.d.ts +6 -0
  52. package/schematics/ng-add/schema.d.ts.map +1 -0
  53. package/schematics/ng-add/schema.js +3 -0
  54. package/schematics/ng-add/schema.js.map +1 -0
  55. package/schematics/ng-add/schema.json +18 -0
  56. package/schematics/resources/swagger-codegen-cli.jar +0 -0
  57. package/schematics/typescript/core/index.d.ts +9 -0
  58. package/schematics/typescript/core/index.d.ts.map +1 -0
  59. package/schematics/typescript/core/index.js +109 -0
  60. package/schematics/typescript/core/index.js.map +1 -0
  61. package/schematics/typescript/core/schema.d.ts +6 -0
  62. package/schematics/typescript/core/schema.d.ts.map +1 -0
  63. package/schematics/typescript/core/schema.js +3 -0
  64. package/schematics/typescript/core/schema.js.map +1 -0
  65. package/schematics/typescript/core/schema.json +21 -0
  66. package/schematics/typescript/core/templates/src/spec/operation-adapter.ts.template +5 -0
  67. package/schematics/typescript/create/index.d.ts +9 -0
  68. package/schematics/typescript/create/index.d.ts.map +1 -0
  69. package/schematics/typescript/create/index.js +17 -0
  70. package/schematics/typescript/create/index.js.map +1 -0
  71. package/schematics/typescript/create/schema.d.ts +5 -0
  72. package/schematics/typescript/create/schema.d.ts.map +1 -0
  73. package/schematics/typescript/create/schema.js +3 -0
  74. package/schematics/typescript/create/schema.js.map +1 -0
  75. package/schematics/typescript/create/schema.json +40 -0
  76. package/schematics/typescript/mock/index.d.ts +15 -0
  77. package/schematics/typescript/mock/index.d.ts.map +1 -0
  78. package/schematics/typescript/mock/index.js +84 -0
  79. package/schematics/typescript/mock/index.js.map +1 -0
  80. package/schematics/typescript/mock/schema.d.ts +12 -0
  81. package/schematics/typescript/mock/schema.d.ts.map +1 -0
  82. package/schematics/typescript/mock/schema.js +3 -0
  83. package/schematics/typescript/mock/schema.js.map +1 -0
  84. package/schematics/typescript/mock/schema.json +42 -0
  85. package/schematics/typescript/mock/templates/__dasherizeModelName__.mock.ts +85 -0
  86. package/schematics/typescript/mock/templates/__dasherizeModelName__.spec.ts +51 -0
  87. package/schematics/typescript/mock/templates/index.ts +1 -0
  88. package/schematics/typescript/shell/index.d.ts +7 -0
  89. package/schematics/typescript/shell/index.d.ts.map +1 -0
  90. package/schematics/typescript/shell/index.js +54 -0
  91. package/schematics/typescript/shell/index.js.map +1 -0
  92. package/schematics/typescript/shell/schema.d.ts +10 -0
  93. package/schematics/typescript/shell/schema.d.ts.map +1 -0
  94. package/schematics/typescript/shell/schema.js +3 -0
  95. package/schematics/typescript/shell/schema.js.map +1 -0
  96. package/schematics/typescript/shell/schema.json +30 -0
  97. package/schematics/typescript/shell/templates/base/.commitlintrc.json +37 -0
  98. package/schematics/typescript/shell/templates/base/.editorconfig +13 -0
  99. package/schematics/typescript/shell/templates/base/.eslintignore +9 -0
  100. package/schematics/typescript/shell/templates/base/.eslintrc.js +46 -0
  101. package/schematics/typescript/shell/templates/base/.husky/commit-msg +4 -0
  102. package/schematics/typescript/shell/templates/base/.husky/pre-commit +4 -0
  103. package/schematics/typescript/shell/templates/base/.renovaterc.json +93 -0
  104. package/schematics/typescript/shell/templates/base/.swagger-codegen-ignore +1 -0
  105. package/schematics/typescript/shell/templates/base/.swcrc +16 -0
  106. package/schematics/typescript/shell/templates/base/.versionrc.json +9 -0
  107. package/schematics/typescript/shell/templates/base/.yarnrc.yml +6 -0
  108. package/schematics/typescript/shell/templates/base/CONTRIBUTING.md +4 -0
  109. package/schematics/typescript/shell/templates/base/configs/tsconfig.test.json +21 -0
  110. package/schematics/typescript/shell/templates/base/jest.config.js +23 -0
  111. package/schematics/typescript/shell/templates/base/package.json +119 -0
  112. package/schematics/typescript/shell/templates/base/readme.md +134 -0
  113. package/schematics/typescript/shell/templates/base/scripts/clear-index.js +30 -0
  114. package/schematics/typescript/shell/templates/base/scripts/files-pack.js +74 -0
  115. package/schematics/typescript/shell/templates/base/scripts/override-readme.js +15 -0
  116. package/schematics/typescript/shell/templates/base/scripts/restore-readme.js +14 -0
  117. package/schematics/typescript/shell/templates/base/src/fixtures/jest/index.ts +1 -0
  118. package/schematics/typescript/shell/templates/base/src/fixtures/jest/package.json +10 -0
  119. package/schematics/typescript/shell/templates/base/src/helpers/index.ts +1 -0
  120. package/schematics/typescript/shell/templates/base/src/helpers/package.json +10 -0
  121. package/schematics/typescript/shell/templates/base/src/index.ts +4 -0
  122. package/schematics/typescript/shell/templates/base/src/models/base/index.ts +0 -0
  123. package/schematics/typescript/shell/templates/base/src/models/core/enums.ts +2 -0
  124. package/schematics/typescript/shell/templates/base/src/models/core/index.ts +2 -0
  125. package/schematics/typescript/shell/templates/base/src/models/core/patterns.ts +2 -0
  126. package/schematics/typescript/shell/templates/base/src/models/custom/enums.ts +2 -0
  127. package/schematics/typescript/shell/templates/base/src/models/custom/index.ts +1 -0
  128. package/schematics/typescript/shell/templates/base/src/models/custom/patterns.ts +2 -0
  129. package/schematics/typescript/shell/templates/base/src/models/enums.ts +4 -0
  130. package/schematics/typescript/shell/templates/base/src/models/index.ts +6 -0
  131. package/schematics/typescript/shell/templates/base/src/models/patterns.ts +4 -0
  132. package/schematics/typescript/shell/templates/base/src/spec/index.ts +3 -0
  133. package/schematics/typescript/shell/templates/base/src/spec/mock-factory/index.ts +2 -0
  134. package/schematics/typescript/shell/templates/base/src/spec/package.json +10 -0
  135. package/schematics/typescript/shell/templates/base/testing/tsconfig.spec.json +24 -0
  136. package/schematics/typescript/shell/templates/base/tsconfig.build.json +44 -0
  137. package/schematics/typescript/shell/templates/base/tsconfig.doc.json +20 -0
  138. package/schematics/typescript/shell/templates/base/tsconfig.json +14 -0
  139. package/schematics/typescript/shell/templates/base/tsconfigs/esm2020/tsconfig.jest.json +16 -0
  140. package/schematics/typescript/shell/templates/base/tsconfigs/esm2020/tsconfig.json +10 -0
  141. package/schematics/typescript/shell/templates/base/tsconfigs/esm2020/tsconfig.source.json +11 -0
  142. package/schematics/typescript/shell/templates/base/tsconfigs/tsconfig.jest.json +20 -0
  143. package/schematics/typescript/shell/templates/base/tsconfigs/tsconfig.source.json +13 -0
  144. package/schematics/typescript/shell/templates/base/typedoc.json +12 -0
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/swcrc",
3
+ "jsc": {
4
+ "parser": {
5
+ "syntax": "typescript",
6
+ "tsx": false,
7
+ "decorators": false,
8
+ "dynamicImport": false
9
+ },
10
+ "transform": null,
11
+ "target": "es2015",
12
+ "externalHelpers": true
13
+ },
14
+ "sourceMaps": true,
15
+ "inlineSourcesContent": false
16
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "skip": {
3
+ "bump": true,
4
+ "commit": true,
5
+ "tag": true
6
+ },
7
+ "header": "",
8
+ "tag-prefix": ""
9
+ }
@@ -0,0 +1,6 @@
1
+ nodeLinker: pnp
2
+
3
+ packageExtensions:
4
+ "@ama-sdk/schematics@*":
5
+ dependencies:
6
+ isomorphic-fetch: ~2.2.1
@@ -0,0 +1,4 @@
1
+ # <%=projectName%> <%=projectPackageName%> - How to contribute
2
+
3
+ This file has been generated.
4
+ You should fill it with your own contribution process.
@@ -0,0 +1,21 @@
1
+ {
2
+ "extends": "../tsconfig",
3
+ "compilerOptions": {
4
+ "module": "commonjs",
5
+ "target": "es6",
6
+ "noImplicitAny": false,
7
+ "emitDecoratorMetadata": true,
8
+ "experimentalDecorators": true,
9
+ "strictNullChecks": false,
10
+ "noEmitHelpers": true,
11
+ "importHelpers": true,
12
+ "sourceMap": true,
13
+ "declaration": true,
14
+ "outDir": "test",
15
+ "lib": [ "dom", "es2015", "dom.iterable", "scripthost", "es2017.object" ]
16
+ },
17
+ "include": [
18
+ "../src/**/*.ts"
19
+ ],
20
+ "exclude": []
21
+ }
@@ -0,0 +1,23 @@
1
+ /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2
+ module.exports = {
3
+ displayName: require('./package.json').name,
4
+ preset: 'ts-jest',
5
+ rootDir: '.',
6
+ roots: ['<rootDir>/src/'],
7
+ reporters: [
8
+ 'default',
9
+ ['jest-junit', { outputDirectory: '<rootDir>/dist-test', suiteName: '@<%=projectName%>/<%=projectPackageName%> unit tests' }]
10
+ ],
11
+ moduleNameMapper: {
12
+ '^@<%=projectName%>/<%=projectPackageName%>$': ['<rootDir>/dist/cjs', '<rootDir>/src'],
13
+ '^@<%=projectName%>/<%=projectPackageName%>/(.*)$': ['<rootDir>/dist/cjs/$1', '<rootDir>/src/$1'],
14
+ },
15
+ globals: {
16
+ // eslint-disable-next-line @typescript-eslint/naming-convention
17
+ 'ts-jest': {
18
+ tsconfig: '<rootDir>/testing/tsconfig.spec.json',
19
+ isolatedModules: true,
20
+ stringifyContentPathRegex: '\\.html$',
21
+ }
22
+ }
23
+ };
@@ -0,0 +1,119 @@
1
+ {
2
+ "name": "@<%=projectName%>/<%=projectPackageName%>",
3
+ "version": "0.0.0",
4
+ "description": "<%=projectPackageName%> - SDK",
5
+ "source": "src/index.ts",
6
+ "main": "cjs/index.js",
7
+ "module": "esm2020/index.js",
8
+ "node": "cjs/index.js",
9
+ "es2020": "esm2020/index.js",
10
+ "esm2020": "esm2020/index.js",
11
+ "es2015": "esm2015/index.js",
12
+ "esm2015": "esm2015/index.js",
13
+ "types": "index.d.ts",
14
+ "sideEffects": false,
15
+ "exports": {
16
+ "./package.json": {
17
+ "default": "./package.json"
18
+ },
19
+ ".": {
20
+ "main": "./cjs/index.js",
21
+ "module": "./esm2020/index.js",
22
+ "es2020": "./esm2020/index.js",
23
+ "esm2020": "./esm2020/index.js",
24
+ "node": "./cjs/index.js",
25
+ "default": "./esm2020/index.js",
26
+ "typings": "./index.d.ts",
27
+ "import": "./esm2020/index.js",
28
+ "require": "./esm2020/index.js"
29
+ }
30
+ },
31
+ "scripts": {
32
+ "clean": "rimraf test/ test-dev/ dist/ dist-dev/ dist-test/ build/",
33
+ "lint:ci": "eslint '**/*[jt]s' --quiet --format junit --output-file ./dist-lint/result.xml",
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",
37
+ "build:cjs": "swc src -d dist/cjs -C module.type=commonjs -q",
38
+ "build:esm2015": "swc src -d dist/esm2015 -C module.type=es6 -q",
39
+ "build:esm2020": "tsc -b tsconfigs/esm2020",
40
+ "set:version": "set-version --placeholder 0.0.0",
41
+ "resolve": "node -e 'process.stdout.write(require.resolve(process.argv[1]));'",
42
+ "generate": "schematics @ama-sdk/schematics:typescript-core --swagger-spec-path ./swagger-spec.yaml",
43
+ "swagger:regen": "schematics @ama-sdk/schematics:typescript-core --swagger-spec-path ./swagger-spec.yaml && yarn clear-index",
44
+ "clear-index": "node scripts/clear-index.js",
45
+ "files:pack": "node scripts/files-pack.js",
46
+ "test": "jest --passWithNoTests",
47
+ "publish:package": "npm publish ./dist",
48
+ "postinstall": "husky install",
49
+ "generate:mock": "schematics @ama-sdk/schematics:mock",
50
+ "doc:generate": "node scripts/override-readme.js && typedoc && node scripts/restore-readme.js",
51
+ "tools:changelog": "standard-version"
52
+ },
53
+ "lint-staged": {
54
+ "**/*.(js|ts)": [
55
+ "yarn eslint --quiet --fix --global fast"
56
+ ]
57
+ },
58
+ "dependencies": {
59
+ "@o3r/dev-tools": "~<%= sdkCoreVersion %>",
60
+ "@swc/helpers": "^0.5.0",
61
+ "tslib": "<%= versions['tslib'] %>"
62
+ },
63
+ "peerDependenciesMeta": {
64
+ "isomorphic-fetch": {
65
+ "optional": true
66
+ }
67
+ },
68
+ "devDependencies": {
69
+ "@angular-devkit/core": "<%= angularVersion %>",
70
+ "@angular-devkit/schematics": "<%= angularVersion %>",
71
+ "@angular-devkit/schematics-cli": "<%= angularVersion %>",
72
+ "@angular-eslint/eslint-plugin": "<%= angularVersion %>",
73
+ "@angular-eslint/eslint-plugin-template": "<%= angularVersion %>",
74
+ "@angular-eslint/utils": "<%= angularVersion %>",
75
+ "@angular/compiler": "<%= angularVersion %>",
76
+ "@commitlint/cli": "^11.0.0",
77
+ "@schematics/angular": "<%= angularVersion %>",
78
+ "@commitlint/config-conventional": "^11.0.0",
79
+ "@ama-sdk/schematics": "~<%= sdkCoreVersion %>",
80
+ "@ama-sdk/core": "~<%= sdkCoreVersion %>",
81
+ "@o3r/eslint-config-otter": "^<%= sdkCoreVersion %>",
82
+ "@o3r/eslint-plugin": "^<%= sdkCoreVersion %>",
83
+ "@swc/cli": "^0.1.57",
84
+ "@swc/core": "^1.2.249",
85
+ "@types/jest": "<%= versions['@types/jest'] %>",
86
+ "@types/node": "<%= versions['@types/node'] %>",
87
+ "@typescript-eslint/eslint-plugin": "<%= versions['@typescript-eslint/eslint-plugin'] %>",
88
+ "@typescript-eslint/parser": "<%= versions['@typescript-eslint/parser'] %>",
89
+ "cpx": "^1.5.0",
90
+ "eslint": "<%= versions['eslint'] %>",
91
+ "eslint-plugin-jest": "<%= versions['eslint-plugin-jest'] %>",
92
+ "eslint-plugin-jsdoc": "<%= versions['eslint-plugin-jsdoc'] %>",
93
+ "eslint-plugin-prefer-arrow": "<%= versions['eslint-plugin-prefer-arrow'] %>",
94
+ "eslint-plugin-unicorn": "<%= versions['eslint-plugin-unicorn'] %>",
95
+ "glob": "^8.0.0",
96
+ "husky": "^6.0.0",
97
+ "isomorphic-fetch": "<%= versions['isomorphic-fetch'] %>",
98
+ "jest": "<%= versions['jest'] %>",
99
+ "jest-junit": "^14.0.0",
100
+ "lint-staged": "^10.4.0",
101
+ "minimist": "^1.2.6",
102
+ "rimraf": "^3.0.2",
103
+ "standard-version": "^9.0.0",
104
+ "ts-jest": "<%= versions['ts-jest'] %>",
105
+ "typedoc": "~0.24.0",
106
+ "tsc-watch": "^6.0.0",
107
+ "typescript": "<%= versions['typescript'] %>"
108
+ },
109
+ "peerDependencies": {
110
+ "@ama-sdk/core": "~<%= sdkCoreVersion %>",
111
+ "isomorphic-fetch": "<%= versions['isomorphic-fetch'] %>"
112
+ },
113
+ "engines": {
114
+ "node": "<%= engineVersions['node'] %>",
115
+ "npm": "<%= engineVersions['npm'] %>",
116
+ "yarn": "<%= engineVersions['yarn'] %>"
117
+ },
118
+ "packageManager": "yarn@3.6.0"
119
+ }
@@ -0,0 +1,134 @@
1
+ # <%=projectDescription%>
2
+
3
+ ### Based on Swagger spec 0.0.0
4
+
5
+ The SDK contains 2 different parts:
6
+
7
+ * Auto generated code (based on Swagger Spec)
8
+ * Specific code dedicated to this SDK
9
+
10
+ ## Structure
11
+
12
+ ### Auto Generated code
13
+
14
+ A main part of the SDK is automatically generated from a Swagger Spec.
15
+ The following folders contain the generated code:
16
+
17
+ * **src/api**: Containing the API calls files
18
+ * **src/models/base**: Models based of swagger definitions
19
+
20
+ The Code can be regenerated by running the following command:
21
+
22
+ ```shell
23
+ yarn schematics @ama-sdk/sdk:typescript-core --swagger-spec-path [path to your swagger file]
24
+ ```
25
+
26
+ ***
27
+
28
+ ### Where to put my custom code?
29
+
30
+ There are 2 places where we can add custom code:
31
+
32
+ * **src/helpers**: should contain the helper functions to transform the data.
33
+ * **src/models/custom**: should contain the models specific to this SDK (mainly the helper functions return type).
34
+
35
+ ### How to extend a Model?
36
+
37
+ You can extend a base model in 3 steps:
38
+
39
+ * Redirect the default model to your override:
40
+
41
+ ```typescript
42
+ // src/models/base/<model name>/index.ts
43
+ export * from "../../core/<model name>";
44
+ ```
45
+
46
+ * Indicate to Swagger CodeGen that you have override the base model:
47
+
48
+ ```gitignore
49
+ # in .swagger-codegen-ignore
50
+ src/models/base/<model name>/index.ts
51
+ ```
52
+
53
+ * Create your core models
54
+
55
+ ```typescript
56
+ // src/models/core/<model name>/index.ts
57
+ export * from "./<model name>.ts";
58
+ export * from "./<model name>.reviver.ts";
59
+ ```
60
+
61
+ ```typescript
62
+ // src/models/core/<model name>/<model name>.ts
63
+ import { <model name> as Base<model name> } from "../../base/<model name>/<model name>";
64
+
65
+ export interface <model name> extends BaseB<model name> {
66
+ // Additional fields
67
+ }
68
+ ```
69
+
70
+ ```typescript
71
+ // src/models/core/<model name>/<model name>.reviver.ts
72
+ import { yourFunction } from "../../../helpers/<model name>";
73
+ import { revive<model name> as Base<model name> } from "../../base/<model name>/<model name>.reviver";
74
+ import { <model name> } from "./<model name>";
75
+
76
+ import {Reviver, utils} from "@ama-sdk/core";
77
+
78
+ export function revive<model name><T extends <model name> = <model name>>(data: any, dictionary?: any) {
79
+ // TODO: use BaseRevive<T> when ready
80
+ const revivedData: T | undefined = Base<model name>(data, dictionary) as T | undefined;
81
+
82
+ if (!revivedData) { return ; }
83
+
84
+ if (!revivedData.yourField) {
85
+ revivedData.yourField = yourFunction(revivedData);
86
+ }
87
+
88
+ return revivedData;
89
+ }
90
+ ```
91
+
92
+ ***
93
+
94
+ ## Commands
95
+
96
+ Some commands are provided to keep your SDK up-to-date.
97
+
98
+ ### Generate SDK from a Swagger specification
99
+
100
+ ```shell
101
+ yarn swagger:regen
102
+ ```
103
+
104
+ ### Run Unit Tests
105
+
106
+ You can build and run UT with:
107
+
108
+ ```shell
109
+ yarn test
110
+ ```
111
+
112
+ ## Vendor extensions
113
+
114
+ These are some of the available configurations using vendor extensions in the swagger spec
115
+
116
+ ### Manage timezone in date
117
+
118
+ In order to add the timezone to your timestamp property you can add the x-date-timezone extension in your yaml, for example:
119
+
120
+ ```yaml
121
+ properties:
122
+ timestamp:
123
+ title: timestamp
124
+ description: >-
125
+ Timestamp when event is triggered. UTC time (server time), with a
126
+ format similar to yyyy-MM-ddThh:mm:ss.sTZD. Refer to the pattern
127
+ type: string
128
+ format: date-time
129
+ x-date-timezone:
130
+ description: If this vendor extension is present send dates with the timezone
131
+ pattern: >-
132
+ ^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{1,3}([Z]|([+][0-9]{2}:?[0-9]{2}$))
133
+ example: '2013-12-31T19:20:30.45+01:00'
134
+ ```
@@ -0,0 +1,30 @@
1
+ /*
2
+ * Remove deleted models' exports
3
+ */
4
+
5
+ const fs = require('node:fs');
6
+ const path = require('node:path');
7
+
8
+ const baseDir = path.resolve(__dirname, '..', 'src', 'models', 'base');
9
+
10
+ void (async () => {
11
+ const models = await new Promise((resolve, reject) => fs.readdir(baseDir, (err, files) => err ? reject(err) : resolve(files)));
12
+ const shouldRemoveModels = (
13
+ await Promise.all(
14
+ models
15
+ .filter((file) => fs.statSync(path.resolve(baseDir, file)).isDirectory())
16
+ .map((model) => new Promise(
17
+ (resolve, reject) => fs.readdir(path.resolve(baseDir, model), (err, files) => err ? reject(err) : resolve({ model, removeIndex: files.length === 1 })))
18
+ )
19
+ )
20
+ ).filter(({ removeIndex }) => removeIndex)
21
+ .map(({ model }) => model);
22
+
23
+ await Promise.all(
24
+ shouldRemoveModels
25
+ .map((model) => {
26
+ console.warn(`Removing ${model} model`);
27
+ return new Promise((resolve, reject) => fs.unlink(path.resolve(baseDir, model, 'index.ts'), (err) => err ? reject(err) : resolve()));
28
+ })
29
+ );
30
+ })();
@@ -0,0 +1,74 @@
1
+ const cpx = require('cpx');
2
+ const minimist = require('minimist');
3
+ const path = require('node:path');
4
+ const { sync } = require('glob');
5
+ const fs = require('node:fs').promises;
6
+ const promisify = require('util').promisify;
7
+
8
+ const argv = minimist(process.argv.slice(2));
9
+ const distFolder = argv.dist || 'dist';
10
+ const {watch, noExports} = argv;
11
+
12
+ const baseDir = path.resolve(__dirname, '..');
13
+
14
+ const files = [
15
+ 'README.md',
16
+ 'LICENSE',
17
+ 'package.json',
18
+ 'src/**/package.json'
19
+ ];
20
+
21
+ /** Update package.json exports */
22
+ const updateExports = async () => {
23
+ const packageJson = JSON.parse(await fs.readFile(path.posix.join(baseDir, 'package.json'), { encoding: 'utf8' }));
24
+ const packageJsonFiles = sync(path.posix.join(baseDir, distFolder, '*', '**', 'package.json'), {absolute: true});
25
+ packageJson.exports = packageJson.exports || {};
26
+ for (const packageJsonFile of packageJsonFiles) {
27
+ try {
28
+ const subPackageJson = JSON.parse(await fs.readFile(packageJsonFile, { encoding: 'utf8' }));
29
+ const folder = './' + path.relative(path.posix.join(baseDir, distFolder), path.dirname(packageJsonFile)).replace(/[/\\]+/g, '/');
30
+ packageJson.exports[folder] = packageJson.exports[folder] || {};
31
+ Object.entries(subPackageJson).forEach(([key, value]) => {
32
+ if (['name', 'sideEffects'].includes(key)) {
33
+ return;
34
+ }
35
+ packageJson.exports[folder][key] = './' + path.relative(path.posix.join(baseDir, distFolder), path.resolve(path.dirname(packageJsonFile), value)).replace(/[/\\]+/g, '/');
36
+ });
37
+ packageJson.exports[folder].import = packageJson.exports[folder].module || packageJson.exports[folder].esm2020 || packageJson.exports[folder].esm2015 || packageJson.exports[folder].node;
38
+ packageJson.exports[folder].require = packageJson.exports[folder].node;
39
+ packageJson.exports[folder].main = packageJson.exports[folder].import || packageJson.exports[folder].require;
40
+ } catch (e) {
41
+ if (watch) {
42
+ console.warn(`Exception in ${packageJsonFile}`, e);
43
+ } else {
44
+ throw e;
45
+ }
46
+ }
47
+ }
48
+ delete packageJson.scripts;
49
+ await fs.writeFile(path.posix.join(baseDir, distFolder, 'package.json'), JSON.stringify(packageJson, null, 2));
50
+ };
51
+
52
+ (async () => {
53
+
54
+ // Move files into the dist folder
55
+ const copies = files.reduce((acc, glob) => {
56
+ acc.push(
57
+ watch ?
58
+ // eslint-disable-next-line no-console
59
+ cpx.watch(path.posix.join(baseDir, glob), distFolder).on('copy', (e) => {
60
+ console.log(`${e.srcPath} copied to ${e.dstPath}`);
61
+ if (!noExports) {
62
+ void updateExports()
63
+ }
64
+ }) :
65
+ promisify(cpx.copy)(path.posix.join(baseDir, glob), distFolder));
66
+ return acc;
67
+ }, []);
68
+ await Promise.all(copies);
69
+
70
+ // Edit package.json exports
71
+ if (!noExports && !watch) {
72
+ await updateExports();
73
+ }
74
+ })();
@@ -0,0 +1,15 @@
1
+ const cpx = require('cpx');
2
+ const path = require('node:path');
3
+ const util = require('util');
4
+ const minimist = require('minimist');
5
+
6
+ const copyFile = util.promisify(cpx.copy);
7
+
8
+ const root = path.resolve(__dirname, '..');
9
+ const argv = minimist(process.argv.slice(2));
10
+ const folderName = argv.folderName || '@<%=projectName%>/<%=projectPackageName%>';
11
+
12
+ (async () => {
13
+ await copyFile(path.posix.join(root, 'readme.md'), path.posix.join(root, '.readme-backup'));
14
+ await copyFile(path.posix.join(root, 'packages', folderName, 'readme.md'), root);
15
+ })();
@@ -0,0 +1,14 @@
1
+ const cpx = require('cpx');
2
+ const path = require('node:path');
3
+ const util = require('util');
4
+ const rimraf = require('rimraf');
5
+
6
+ const copyFile = util.promisify(cpx.copy);
7
+ const rimrafDir = util.promisify(rimraf);
8
+
9
+ const root = path.resolve(__dirname, '..');
10
+
11
+ (async () => {
12
+ await copyFile(path.posix.join(root, '.readme-backup', 'readme.md'), root);
13
+ await rimrafDir(path.posix.join(root, '.readme-backup'));
14
+ })();
@@ -0,0 +1 @@
1
+ export * from '../../api/fixtures.jest';
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@<%=projectName%>/<%=projectPackageName%>/jest",
3
+ "main": "../../cjs/api/fixtures.jest.js",
4
+ "module": "../../esm2020/api/fixtures.jest.js",
5
+ "es2020": "../../esm2020/api/fixtures.jest.js",
6
+ "esm2020": "../../esm2020/api/fixtures.jest.js",
7
+ "node": "../../cjs/api/fixtures.jest.js",
8
+ "default": "../../esm2020/api/fixtures.jest.js",
9
+ "typings": "./index.d.ts"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@<%=projectName%>/<%=projectPackageName%>/helpers",
3
+ "main": "../cjs/helpers/index.js",
4
+ "module": "../esm2020/helpers/index.js",
5
+ "es2020": "../esm2020/helpers/index.js",
6
+ "esm2020": "../esm2020/helpers/index.js",
7
+ "node": "../cjs/helpers/index.js",
8
+ "default": "../esm2020/helpers/index.js",
9
+ "typings": "./index.d.ts"
10
+ }
@@ -0,0 +1,4 @@
1
+ export * from './api';
2
+ export * from './helpers';
3
+ export * from './models';
4
+
@@ -0,0 +1,2 @@
1
+ // Export your core enums here
2
+ export type { };
@@ -0,0 +1,2 @@
1
+ // Export your core models here
2
+ export type { };
@@ -0,0 +1,2 @@
1
+ // Export your core patterns here
2
+ export { };
@@ -0,0 +1,2 @@
1
+ // Export your custom enums here
2
+ export { };
@@ -0,0 +1,2 @@
1
+ // Export your custom patterns here
2
+ export { };
@@ -0,0 +1,4 @@
1
+ export * from './base/enums';
2
+ export * from './core/enums';
3
+ export * from './custom/enums';
4
+
@@ -0,0 +1,6 @@
1
+ export * from './base';
2
+ export * from './core';
3
+ export * from './custom';
4
+
5
+ export * from './enums';
6
+ export * from './patterns';
@@ -0,0 +1,4 @@
1
+ export * from './base/patterns';
2
+ export * from './core/patterns';
3
+ export * from './custom/patterns';
4
+
@@ -0,0 +1,3 @@
1
+ export * from './operation-adapter';
2
+ export * from './api-mock';
3
+ export * from './mock-factory/index';
@@ -0,0 +1,2 @@
1
+ // dummy export for mock factory
2
+ export {};
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@<%=projectName%>/<%=projectPackageName%>/spec",
3
+ "main": "../cjs/spec/index.js",
4
+ "module": "../esm2020/spec/index.js",
5
+ "es2020": "../esm2020/spec/index.js",
6
+ "esm2020": "../esm2020/spec/index.js",
7
+ "node": "../cjs/spec/index.js",
8
+ "default": "../esm2020/spec/index.js",
9
+ "typings": "./index.d.ts"
10
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "extends": "../tsconfig.build",
3
+ "compilerOptions": {
4
+ "types": [
5
+ "jest",
6
+ "node"
7
+ ],
8
+ "esModuleInterop": true,
9
+ "strictNullChecks": false,
10
+ "noImplicitAny": false,
11
+ "incremental": false,
12
+ "composite": false,
13
+ "declaration": false,
14
+ "declarationMap": false,
15
+ "strict": false,
16
+ "skipLibCheck": true,
17
+ "module": "ES2020",
18
+ "target": "ES2020"
19
+ },
20
+ "include": [
21
+ "../src/**/*.spec.ts",
22
+ "../src/**/*.perf.ts"
23
+ ]
24
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "compilerOptions": {
3
+ "types": [],
4
+ "moduleResolution": "node",
5
+ "noImplicitAny": true,
6
+ "emitDecoratorMetadata": true,
7
+ "experimentalDecorators": true,
8
+ "noEmitHelpers": true,
9
+ "importHelpers": true,
10
+ "strict": true,
11
+ "sourceMap": true,
12
+ "removeComments": false,
13
+ "lib": [
14
+ "dom",
15
+ "es2015",
16
+ "dom.iterable",
17
+ "scripthost",
18
+ "es2017.object"
19
+ ],
20
+ "incremental": true,
21
+ "composite": true,
22
+ "declaration": true,
23
+ "declarationMap": false,
24
+ "rootDir": "./src",
25
+ "baseUrl": ".",
26
+ "paths": {
27
+ "@<%=projectName%>/<%=projectPackageName%>/helpers/*": [
28
+ "./src/helpers/*"
29
+ ],
30
+ "@<%=projectName%>/<%=projectPackageName%>/helpers": [
31
+ "./src/helpers/index"
32
+ ],
33
+ "@<%=projectName%>/<%=projectPackageName%>": [
34
+ "./src/index"
35
+ ],
36
+ "@<%=projectName%>/<%=projectPackageName%>/*": [
37
+ "./src/*"
38
+ ],
39
+ "@<%=projectName%>/<%=projectPackageName%>/spec": [
40
+ "./src/spec/index"
41
+ ]
42
+ }
43
+ }
44
+ }