@opra/cli 0.23.2 → 0.24.1
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/cjs/api-exporter/api-exporter.js +2 -2
- package/cjs/api-exporter/process-resources.js +1 -1
- package/cjs/api-exporter/process-types.js +1 -1
- package/cjs/oprimp-cli.js +2 -2
- package/esm/api-exporter/api-exporter.js +2 -2
- package/esm/api-exporter/process-resources.js +1 -1
- package/esm/api-exporter/process-types.js +1 -1
- package/esm/oprimp-cli.js +2 -2
- package/package.json +2 -2
- package/types/api-exporter/api-exporter.d.ts +1 -1
|
@@ -46,7 +46,7 @@ class ApiExporter {
|
|
|
46
46
|
this.logger.log(chalk_1.default.cyan(`Generating service interface ( ${chalk_1.default.whiteBright(this.serviceClassName)} )`));
|
|
47
47
|
node_fs_1.default.mkdirSync(this.outDir, { recursive: true });
|
|
48
48
|
await this.processTypes();
|
|
49
|
-
await this.
|
|
49
|
+
await this.processSources();
|
|
50
50
|
const { importExt } = this;
|
|
51
51
|
// Write files
|
|
52
52
|
for (const file of Object.values(this.files)) {
|
|
@@ -97,7 +97,7 @@ class ApiExporter {
|
|
|
97
97
|
}
|
|
98
98
|
exports.ApiExporter = ApiExporter;
|
|
99
99
|
(() => {
|
|
100
|
-
ApiExporter.prototype.
|
|
100
|
+
ApiExporter.prototype.processSources = process_resources_js_1.processResources;
|
|
101
101
|
ApiExporter.prototype.processTypes = process_types_js_1.processTypes;
|
|
102
102
|
ApiExporter.prototype.generateTypeFile = process_types_js_1.generateTypeFile;
|
|
103
103
|
ApiExporter.prototype.generateComplexTypeDefinition = process_types_js_1.generateComplexTypeDefinition;
|
|
@@ -22,7 +22,7 @@ async function processResources(targetDir = '') {
|
|
|
22
22
|
const jsDoc = `
|
|
23
23
|
/**
|
|
24
24
|
* ${(0, string_utils_js_1.wrapJSDocString)(resource.description || resource.name)}
|
|
25
|
-
* @url ${node_path_1.default.posix.join(this.client.serviceUrl, '
|
|
25
|
+
* @url ${node_path_1.default.posix.join(this.client.serviceUrl, '#resources/' + resource.name)}
|
|
26
26
|
*/`;
|
|
27
27
|
if (resource instanceof common_1.Collection) {
|
|
28
28
|
const typeName = resource.type.name || '';
|
|
@@ -52,7 +52,7 @@ async function generateTypeFile(dataType, targetDir = '') {
|
|
|
52
52
|
file.content += `\n/**\n * ${(0, string_utils_js_1.wrapJSDocString)(dataType.description || typeName)}
|
|
53
53
|
* @interface ${typeName}
|
|
54
54
|
* @kind ${dataType.kind}
|
|
55
|
-
* @url ${node_path_1.default.posix.join(this.client.serviceUrl, '
|
|
55
|
+
* @url ${node_path_1.default.posix.join(this.client.serviceUrl, '#types/' + typeName)}
|
|
56
56
|
*/\n`;
|
|
57
57
|
if (dataType instanceof common_1.SimpleType) {
|
|
58
58
|
file.content += `export type ${typeName} = ` + await this.generateSimpleTypeDefinition(file, dataType);
|
package/cjs/oprimp-cli.js
CHANGED
|
@@ -29,8 +29,8 @@ commander_1.program
|
|
|
29
29
|
importExt: options.ext,
|
|
30
30
|
fileHeader: '/* Generated by OPRA Service Generator, Version ' + pkgJson.version + '*/\n' +
|
|
31
31
|
'/* eslint-disable */\n'
|
|
32
|
-
})
|
|
33
|
-
|
|
32
|
+
}).then(() => console.log(chalk_1.default.greenBright('Completed')))
|
|
33
|
+
.catch(e => console.error(e.message));
|
|
34
34
|
});
|
|
35
35
|
if (process.argv.length < 3)
|
|
36
36
|
commander_1.program.help();
|
|
@@ -42,7 +42,7 @@ export class ApiExporter {
|
|
|
42
42
|
this.logger.log(chalk.cyan(`Generating service interface ( ${chalk.whiteBright(this.serviceClassName)} )`));
|
|
43
43
|
fs.mkdirSync(this.outDir, { recursive: true });
|
|
44
44
|
await this.processTypes();
|
|
45
|
-
await this.
|
|
45
|
+
await this.processSources();
|
|
46
46
|
const { importExt } = this;
|
|
47
47
|
// Write files
|
|
48
48
|
for (const file of Object.values(this.files)) {
|
|
@@ -92,7 +92,7 @@ export class ApiExporter {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
(() => {
|
|
95
|
-
ApiExporter.prototype.
|
|
95
|
+
ApiExporter.prototype.processSources = processResources;
|
|
96
96
|
ApiExporter.prototype.processTypes = processTypes;
|
|
97
97
|
ApiExporter.prototype.generateTypeFile = generateTypeFile;
|
|
98
98
|
ApiExporter.prototype.generateComplexTypeDefinition = generateComplexTypeDefinition;
|
|
@@ -18,7 +18,7 @@ export async function processResources(targetDir = '') {
|
|
|
18
18
|
const jsDoc = `
|
|
19
19
|
/**
|
|
20
20
|
* ${wrapJSDocString(resource.description || resource.name)}
|
|
21
|
-
* @url ${path.posix.join(this.client.serviceUrl, '
|
|
21
|
+
* @url ${path.posix.join(this.client.serviceUrl, '#resources/' + resource.name)}
|
|
22
22
|
*/`;
|
|
23
23
|
if (resource instanceof Collection) {
|
|
24
24
|
const typeName = resource.type.name || '';
|
|
@@ -47,7 +47,7 @@ export async function generateTypeFile(dataType, targetDir = '') {
|
|
|
47
47
|
file.content += `\n/**\n * ${wrapJSDocString(dataType.description || typeName)}
|
|
48
48
|
* @interface ${typeName}
|
|
49
49
|
* @kind ${dataType.kind}
|
|
50
|
-
* @url ${path.posix.join(this.client.serviceUrl, '
|
|
50
|
+
* @url ${path.posix.join(this.client.serviceUrl, '#types/' + typeName)}
|
|
51
51
|
*/\n`;
|
|
52
52
|
if (dataType instanceof SimpleType) {
|
|
53
53
|
file.content += `export type ${typeName} = ` + await this.generateSimpleTypeDefinition(file, dataType);
|
package/esm/oprimp-cli.js
CHANGED
|
@@ -26,8 +26,8 @@ program
|
|
|
26
26
|
importExt: options.ext,
|
|
27
27
|
fileHeader: '/* Generated by OPRA Service Generator, Version ' + pkgJson.version + '*/\n' +
|
|
28
28
|
'/* eslint-disable */\n'
|
|
29
|
-
})
|
|
30
|
-
|
|
29
|
+
}).then(() => console.log(chalk.greenBright('Completed')))
|
|
30
|
+
.catch(e => console.error(e.message));
|
|
31
31
|
});
|
|
32
32
|
if (process.argv.length < 3)
|
|
33
33
|
program.help();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"description": "Opra CLI tools",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"clean:cover": "rimraf ../../coverage/client"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@opra/client": "^0.
|
|
31
|
+
"@opra/client": "^0.24.1",
|
|
32
32
|
"chalk": "^5.3.0",
|
|
33
33
|
"commander": "^11.0.0",
|
|
34
34
|
"js-string-escape": "^1.0.1",
|
|
@@ -28,7 +28,7 @@ export declare class ApiExporter {
|
|
|
28
28
|
protected writer: IFileWriter;
|
|
29
29
|
protected files: Record<string, TsFile>;
|
|
30
30
|
protected importExt?: boolean;
|
|
31
|
-
protected
|
|
31
|
+
protected processSources: typeof processResources;
|
|
32
32
|
protected processTypes: typeof processTypes;
|
|
33
33
|
protected generateTypeFile: typeof generateTypeFile;
|
|
34
34
|
protected generateComplexTypeDefinition: typeof generateComplexTypeDefinition;
|