@ama-sdk/schematics 9.0.0-alpha.2 → 9.0.0-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +16 -10
- package/schematics/java/client-core/swagger-codegen-java-client/target/javaClient-swagger-codegen-tests.jar +0 -0
- package/schematics/java/client-core/swagger-codegen-java-client/target/javaClient-swagger-codegen.jar +0 -0
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +103 -23
- package/schematics/typescript/core/index.js +1 -1
- package/schematics/typescript/core/openapi-codegen-typescript/target/typescriptFetch-openapi-generator-tests.jar +0 -0
- package/schematics/typescript/core/openapi-codegen-typescript/target/typescriptFetch-openapi-generator.jar +0 -0
- package/schematics/typescript/shell/index.d.ts.map +1 -1
- package/schematics/typescript/shell/index.js +16 -0
- package/schematics/typescript/shell/templates/base/openapitools.json +2 -1
- package/schematics/typescript/shell/templates/base/package.json +2 -2
- package/schematics/typescript/shell/templates/base/.yarnrc.yml +0 -6
- /package/schematics/typescript/shell/templates/base/{.openapi-codegen-ignore → .openapi-generator-ignore} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ama-sdk/schematics",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.24",
|
|
4
4
|
"description": "Swagger specification SDK Generator by schematics",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"nx": "nx",
|
|
@@ -33,23 +33,28 @@
|
|
|
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.
|
|
44
|
+
"@ama-sdk/core": "^9.0.0-alpha.24",
|
|
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",
|
|
45
48
|
"@angular/cli": "~16.0.5",
|
|
49
|
+
"@o3r/schematics": "^9.0.0-alpha.24",
|
|
46
50
|
"@openapitools/openapi-generator-cli": "~2.6.0",
|
|
47
51
|
"@schematics/angular": "~16.0.5"
|
|
48
52
|
},
|
|
49
53
|
"dependencies": {
|
|
50
54
|
"@angular-devkit/core": "~16.0.5",
|
|
51
55
|
"@angular-devkit/schematics": "~16.0.5",
|
|
52
|
-
"@o3r/dev-tools": "^9.0.0-alpha.
|
|
56
|
+
"@o3r/dev-tools": "^9.0.0-alpha.24",
|
|
57
|
+
"js-yaml": "^4.1.0",
|
|
53
58
|
"minimatch": "^9.0.0",
|
|
54
59
|
"rxjs": "^7.8.1",
|
|
55
60
|
"semver": "^7.5.2",
|
|
@@ -57,16 +62,17 @@
|
|
|
57
62
|
"tslib": "^2.5.3"
|
|
58
63
|
},
|
|
59
64
|
"devDependencies": {
|
|
60
|
-
"@ama-sdk/core": "^9.0.0-alpha.
|
|
65
|
+
"@ama-sdk/core": "^9.0.0-alpha.24",
|
|
61
66
|
"@angular-devkit/schematics-cli": "~16.0.5",
|
|
62
67
|
"@angular-eslint/eslint-plugin": "~16.0.3",
|
|
63
68
|
"@angular/cli": "~16.0.5",
|
|
64
|
-
"@nx/jest": "~16.
|
|
65
|
-
"@o3r/build-helpers": "^9.0.0-alpha.
|
|
66
|
-
"@o3r/eslint-plugin": "^9.0.0-alpha.
|
|
69
|
+
"@nx/jest": "~16.5.0",
|
|
70
|
+
"@o3r/build-helpers": "^9.0.0-alpha.24",
|
|
71
|
+
"@o3r/eslint-plugin": "^9.0.0-alpha.24",
|
|
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",
|
|
@@ -82,15 +88,15 @@
|
|
|
82
88
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
83
89
|
"eslint-plugin-unicorn": "^47.0.0",
|
|
84
90
|
"isomorphic-fetch": "~3.0.0",
|
|
85
|
-
"jest": "~29.
|
|
91
|
+
"jest": "~29.6.0",
|
|
86
92
|
"mem-fs": "^2.2.1",
|
|
87
93
|
"npm-run-all": "^4.1.5",
|
|
88
|
-
"nx": "~16.
|
|
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.
|
|
99
|
+
"type-fest": "^3.12.0",
|
|
94
100
|
"typescript": "~5.0.2"
|
|
95
101
|
},
|
|
96
102
|
"openApiSupportedVersion": "~6.6.0",
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ngAdd = exports.updatePackageJsonScripts = void 0;
|
|
4
4
|
const core_1 = require("@angular-devkit/core");
|
|
5
|
-
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
6
5
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
7
7
|
const options_1 = require("@angular-devkit/schematics/tasks/package-manager/options");
|
|
8
|
-
const path = require("node:path");
|
|
9
8
|
const node_fs_1 = require("node:fs");
|
|
9
|
+
const path = require("node:path");
|
|
10
10
|
const rxjs_1 = require("rxjs");
|
|
11
11
|
const packageJsonPath = '/package.json';
|
|
12
|
+
const swaggerIgnorePath = '/.swagger-codegen-ignore';
|
|
13
|
+
const openApiIgnorePath = '/.openapi-generator-ignore';
|
|
14
|
+
const openApiConfigPath = 'openapitools.json';
|
|
15
|
+
const packageManager = process.env && process.env.npm_execpath && process.env.npm_execpath.indexOf('yarn') === -1 ? 'npm' : 'yarn';
|
|
12
16
|
/**
|
|
13
17
|
* Install dev dependency on your application
|
|
14
18
|
*
|
|
@@ -22,7 +26,7 @@ class DevInstall extends tasks_1.NodePackageInstallTask {
|
|
|
22
26
|
}
|
|
23
27
|
/** @inheritdoc */
|
|
24
28
|
toConfiguration() {
|
|
25
|
-
const installOptions =
|
|
29
|
+
const installOptions = packageManager;
|
|
26
30
|
return {
|
|
27
31
|
name: options_1.NodePackageName,
|
|
28
32
|
options: {
|
|
@@ -74,33 +78,109 @@ const updatePackageJsonScripts = (tree, context) => {
|
|
|
74
78
|
return tree;
|
|
75
79
|
};
|
|
76
80
|
exports.updatePackageJsonScripts = updatePackageJsonScripts;
|
|
81
|
+
/**
|
|
82
|
+
* Create or udpate the OpenApi configuration with the version supported by the application
|
|
83
|
+
* Set a storage directory for the generator jar to avoid any issue with pnp setups as it would try to install it directly in the node_module
|
|
84
|
+
*
|
|
85
|
+
* @param tree
|
|
86
|
+
*/
|
|
87
|
+
const createOpenApiToolsConfig = (tree) => {
|
|
88
|
+
const amaSdkSchematicsPackageJsonContent = JSON.parse((0, node_fs_1.readFileSync)(path.resolve(__dirname, '..', '..', 'package.json'), { encoding: 'utf-8' }));
|
|
89
|
+
const openApiGeneratorVersion = amaSdkSchematicsPackageJsonContent.openApiSupportedVersion.replace(/\^|~/, '');
|
|
90
|
+
const openApiDefaultStorageDir = '.openapi-generator';
|
|
91
|
+
if (tree.exists(openApiConfigPath)) {
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
93
|
+
const openapitoolsConfig = tree.readJson(openApiConfigPath) || {};
|
|
94
|
+
openapitoolsConfig['generator-cli'] = { storageDir: openApiDefaultStorageDir, ...openapitoolsConfig['generator-cli'], version: openApiGeneratorVersion };
|
|
95
|
+
tree.overwrite(openApiConfigPath, JSON.stringify(openapitoolsConfig));
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
tree.create(openApiConfigPath, JSON.stringify({
|
|
99
|
+
$schema: 'https://raw.githubusercontent.com/OpenAPITools/openapi-generator-cli/master/apps/generator-cli/src/config.schema.json',
|
|
100
|
+
spaces: 2,
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
102
|
+
'generator-cli': {
|
|
103
|
+
version: openApiGeneratorVersion,
|
|
104
|
+
storageDir: openApiDefaultStorageDir
|
|
105
|
+
}
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
return tree;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Install the npm open api generator cli package
|
|
112
|
+
*
|
|
113
|
+
* @param tree
|
|
114
|
+
* @param context
|
|
115
|
+
*/
|
|
116
|
+
const installOpenApiToolsCli = async (tree, context) => {
|
|
117
|
+
const packageJsonContent = tree.readJson(packageJsonPath);
|
|
118
|
+
const amaSdkSchematicsPackageJsonContent = JSON.parse((0, node_fs_1.readFileSync)(path.resolve(__dirname, '..', '..', 'package.json'), { encoding: 'utf-8' }));
|
|
119
|
+
const amaSdkSchematicsOpenApiCliVersion = amaSdkSchematicsPackageJsonContent.peerDependencies?.['@openapitools/openapi-generator-cli'] || '';
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
121
|
+
packageJsonContent.devDependencies = { ...packageJsonContent.devDependencies, '@openapitools/openapi-generator-cli': amaSdkSchematicsOpenApiCliVersion };
|
|
122
|
+
context.addTask(new DevInstall({
|
|
123
|
+
packageName: `@openapitools/openapi-generator-cli@${amaSdkSchematicsOpenApiCliVersion}`,
|
|
124
|
+
hideOutput: false,
|
|
125
|
+
quiet: false
|
|
126
|
+
}));
|
|
127
|
+
await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
|
|
128
|
+
return () => tree;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Replace the swagger ignore file with an openapi one
|
|
132
|
+
*
|
|
133
|
+
* @param tree
|
|
134
|
+
*/
|
|
135
|
+
const replaceSwaggerIgnore = (tree) => {
|
|
136
|
+
const swaggerIgnoreContent = tree.exists(swaggerIgnorePath) && tree.readText(swaggerIgnorePath);
|
|
137
|
+
if (swaggerIgnoreContent && !tree.exists(openApiIgnorePath)) {
|
|
138
|
+
tree.create(openApiIgnorePath, swaggerIgnoreContent);
|
|
139
|
+
tree.delete(swaggerIgnorePath);
|
|
140
|
+
}
|
|
141
|
+
return tree;
|
|
142
|
+
};
|
|
143
|
+
const registerPackageSchematics = async (tree, context) => {
|
|
144
|
+
if (!tree.exists('angular.json')) {
|
|
145
|
+
return () => tree;
|
|
146
|
+
}
|
|
147
|
+
const amaSdkSchematicsPackageJsonContent = JSON.parse((0, node_fs_1.readFileSync)(path.resolve(__dirname, '..', '..', 'package.json'), { encoding: 'utf-8' }));
|
|
148
|
+
const amaSdkSchematicsVersion = amaSdkSchematicsPackageJsonContent.version ? `@${amaSdkSchematicsPackageJsonContent.version}` : '';
|
|
149
|
+
const schematicsDependencies = ['@o3r/dev-tools', '@o3r/schematics'];
|
|
150
|
+
for (const dependency of schematicsDependencies) {
|
|
151
|
+
context.addTask(new DevInstall({
|
|
152
|
+
packageName: dependency + amaSdkSchematicsVersion,
|
|
153
|
+
hideOutput: false,
|
|
154
|
+
quiet: false
|
|
155
|
+
}));
|
|
156
|
+
const packageJsonContent = tree.readJson('package.json');
|
|
157
|
+
packageJsonContent.devDependencies = { ...packageJsonContent.devDependencies, [dependency]: amaSdkSchematicsVersion };
|
|
158
|
+
tree.overwrite('package.json', JSON.stringify(packageJsonContent));
|
|
159
|
+
await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
|
|
160
|
+
}
|
|
161
|
+
return () => (0, schematics_1.chain)([
|
|
162
|
+
...schematicsDependencies.map((dep) => (0, schematics_1.externalSchematic)(dep, 'ng-add', {})),
|
|
163
|
+
async (t, c) => {
|
|
164
|
+
const { registerPackageCollectionSchematics } = await Promise.resolve().then(() => require('@o3r/schematics'));
|
|
165
|
+
return () => registerPackageCollectionSchematics(amaSdkSchematicsPackageJsonContent)(t, c);
|
|
166
|
+
}
|
|
167
|
+
]);
|
|
168
|
+
};
|
|
77
169
|
/**
|
|
78
170
|
* Add Otter ama-sdk-schematics to a Project
|
|
79
171
|
*
|
|
80
172
|
* @param options
|
|
81
173
|
*/
|
|
82
174
|
function ngAdd() {
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
hideOutput: false,
|
|
91
|
-
quiet: false
|
|
92
|
-
}));
|
|
93
|
-
await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
|
|
175
|
+
return (tree, context) => (0, schematics_1.chain)([
|
|
176
|
+
registerPackageSchematics,
|
|
177
|
+
exports.updatePackageJsonScripts,
|
|
178
|
+
(t) => {
|
|
179
|
+
const packageJson = tree.readText(packageJsonPath);
|
|
180
|
+
const needsToInstallOpenApiGeneratorCli = packageJson.match(/@ama-sdk\/schematics:typescript-.*--spec-path ([.\\/a-zA-Z-]+) /)?.[1];
|
|
181
|
+
return needsToInstallOpenApiGeneratorCli ? (0, schematics_1.chain)([replaceSwaggerIgnore, installOpenApiToolsCli, createOpenApiToolsConfig]) : t;
|
|
94
182
|
}
|
|
95
|
-
|
|
96
|
-
...schematicsDependencies.map((dep) => (0, schematics_1.externalSchematic)(dep, 'ng-add', {})),
|
|
97
|
-
async (t, c) => {
|
|
98
|
-
const { registerPackageCollectionSchematics } = await Promise.resolve().then(() => require('@o3r/schematics'));
|
|
99
|
-
return () => registerPackageCollectionSchematics(amaSdkSchematicsPackageJsonContent)(t, c);
|
|
100
|
-
},
|
|
101
|
-
exports.updatePackageJsonScripts
|
|
102
|
-
])(tree, context);
|
|
103
|
-
};
|
|
183
|
+
])(tree, context);
|
|
104
184
|
}
|
|
105
185
|
exports.ngAdd = ngAdd;
|
|
106
186
|
//# sourceMappingURL=index.js.map
|
|
@@ -12,7 +12,7 @@ const getRegexpTemplate = (regexp) => `new RegExp('${regexp.toString().replace(/
|
|
|
12
12
|
const getPathObjectTemplate = (pathObj) => {
|
|
13
13
|
return `{
|
|
14
14
|
${Object.keys(pathObj).map((propName) => {
|
|
15
|
-
const value = propName === 'regexp' ? getRegexpTemplate(pathObj[propName]) : JSON.stringify(pathObj[propName]);
|
|
15
|
+
const value = (propName) === 'regexp' ? getRegexpTemplate(pathObj[propName]) : JSON.stringify(pathObj[propName]);
|
|
16
16
|
return `${propName}: ${value}`;
|
|
17
17
|
}).join(',')}
|
|
18
18
|
}`;
|
|
Binary file
|
|
Binary file
|
|
@@ -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;
|
|
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"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ngGenerateTypescriptSDK = void 0;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const js_yaml_1 = require("js-yaml");
|
|
5
6
|
const read_package_1 = require("../../helpers/read-package");
|
|
6
7
|
/**
|
|
7
8
|
* @param options
|
|
@@ -48,6 +49,21 @@ function ngGenerateTypescriptSDK(options) {
|
|
|
48
49
|
engineVersions,
|
|
49
50
|
empty: ''
|
|
50
51
|
};
|
|
52
|
+
const yarnrcPath = '.yarnrc.yml';
|
|
53
|
+
const yarnrc = ((0, js_yaml_1.load)(tree.exists(yarnrcPath) ? tree.readText(yarnrcPath) : '') || {});
|
|
54
|
+
yarnrc.nodeLinker ||= 'pnp';
|
|
55
|
+
yarnrc.packageExtensions ||= {};
|
|
56
|
+
yarnrc.packageExtensions['@ama-sdk/schematics@*'] = {
|
|
57
|
+
dependencies: {
|
|
58
|
+
'isomorphic-fetch': '~2.2.1'
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
if (tree.exists(yarnrcPath)) {
|
|
62
|
+
tree.overwrite(yarnrcPath, (0, js_yaml_1.dump)(yarnrc, { indent: 2 }));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
tree.create(yarnrcPath, (0, js_yaml_1.dump)(yarnrc, { indent: 2 }));
|
|
66
|
+
}
|
|
51
67
|
const baseRule = (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./templates/base'), [
|
|
52
68
|
(0, schematics_1.template)(properties),
|
|
53
69
|
(0, schematics_1.move)(tree.root.path),
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/OpenAPITools/openapi-generator-cli/master/apps/generator-cli/src/config.schema.json",
|
|
3
3
|
"spaces": 2,
|
|
4
4
|
"generator-cli": {
|
|
5
|
-
"version": "<%= openApiSupportedVersion %>"
|
|
5
|
+
"version": "<%= openApiSupportedVersion %>",
|
|
6
|
+
"storageDir": ".openapi-generator"
|
|
6
7
|
}
|
|
7
8
|
}
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@o3r/eslint-plugin": "^<%= sdkCoreVersion %>",
|
|
83
83
|
"@openapitools/openapi-generator-cli": "<%= versions['@openapitools/openapi-generator-cli'] %>",
|
|
84
84
|
"@swc/cli": "^0.1.57",
|
|
85
|
-
"@swc/core": "^1.
|
|
85
|
+
"@swc/core": "^1.3.66",
|
|
86
86
|
"@types/jest": "<%= versions['@types/jest'] %>",
|
|
87
87
|
"@types/node": "<%= versions['@types/node'] %>",
|
|
88
88
|
"@typescript-eslint/eslint-plugin": "<%= versions['@typescript-eslint/eslint-plugin'] %>",
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"npm": "<%= engineVersions['npm'] %>",
|
|
117
117
|
"yarn": "<%= engineVersions['yarn'] %>"
|
|
118
118
|
},
|
|
119
|
-
"packageManager": "yarn@3.6.
|
|
119
|
+
"packageManager": "yarn@3.6.1"
|
|
120
120
|
}
|
|
File without changes
|