@opra/cli 0.21.0 → 0.23.0
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.
|
@@ -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 ${
|
|
25
|
+
* @url ${node_path_1.default.posix.join(this.client.serviceUrl, '$metadata#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 ${
|
|
55
|
+
* @url ${node_path_1.default.posix.join(this.client.serviceUrl, '$metadata#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);
|
|
@@ -174,7 +174,7 @@ async function generateEnumTypeDefinition(file, dataType) {
|
|
|
174
174
|
out += `/**\n${jsDoc}*/\n`;
|
|
175
175
|
out += `${k}`;
|
|
176
176
|
if (v)
|
|
177
|
-
out += ' = ' + (typeof v === 'number' ? v : ('"' + (
|
|
177
|
+
out += ' = ' + (typeof v === 'number' ? v : ('"' + (String(v)).replace('"', '\\"')) + '"');
|
|
178
178
|
out += ',\n\n';
|
|
179
179
|
}
|
|
180
180
|
return out + '\b}';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { Collection,
|
|
3
|
+
import { Collection, Singleton } from '@opra/common';
|
|
4
4
|
import { wrapJSDocString } from '../utils/string-utils.js';
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
@@ -18,7 +18,7 @@ export async function processResources(targetDir = '') {
|
|
|
18
18
|
const jsDoc = `
|
|
19
19
|
/**
|
|
20
20
|
* ${wrapJSDocString(resource.description || resource.name)}
|
|
21
|
-
* @url ${
|
|
21
|
+
* @url ${path.posix.join(this.client.serviceUrl, '$metadata#resources/' + resource.name)}
|
|
22
22
|
*/`;
|
|
23
23
|
if (resource instanceof Collection) {
|
|
24
24
|
const typeName = resource.type.name || '';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { ComplexType, EnumType,
|
|
3
|
+
import { ComplexType, EnumType, MappedType, SimpleType, UnionType } from '@opra/common';
|
|
4
4
|
import { wrapJSDocString } from '../utils/string-utils.js';
|
|
5
5
|
const internalTypeNames = ['any', 'boolean', 'bigint', 'number', 'null', 'string'];
|
|
6
6
|
/**
|
|
@@ -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 ${
|
|
50
|
+
* @url ${path.posix.join(this.client.serviceUrl, '$metadata#types/' + typeName)}
|
|
51
51
|
*/\n`;
|
|
52
52
|
if (dataType instanceof SimpleType) {
|
|
53
53
|
file.content += `export type ${typeName} = ` + await this.generateSimpleTypeDefinition(file, dataType);
|
|
@@ -165,7 +165,7 @@ export async function generateEnumTypeDefinition(file, dataType) {
|
|
|
165
165
|
out += `/**\n${jsDoc}*/\n`;
|
|
166
166
|
out += `${k}`;
|
|
167
167
|
if (v)
|
|
168
|
-
out += ' = ' + (typeof v === 'number' ? v : ('"' + (
|
|
168
|
+
out += ' = ' + (typeof v === 'number' ? v : ('"' + (String(v)).replace('"', '\\"')) + '"');
|
|
169
169
|
out += ',\n\n';
|
|
170
170
|
}
|
|
171
171
|
return out + '\b}';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
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.23.0",
|
|
32
32
|
"chalk": "^5.3.0",
|
|
33
33
|
"commander": "^11.0.0",
|
|
34
34
|
"js-string-escape": "^1.0.1",
|