@asyncapi/cli 2.16.5 → 2.16.6
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/bin/run +2 -2
- package/bin/run_bin +2 -2
- package/lib/commands/generate/fromTemplate.d.ts +2 -2
- package/lib/commands/generate/fromTemplate.js +5 -3
- package/lib/commands/optimize.js +8 -3
- package/lib/core/errors/validation-error.d.ts +1 -1
- package/lib/core/errors/validation-error.js +3 -0
- package/oclif.manifest.json +3 -3
- package/package.json +4 -4
package/bin/run
CHANGED
|
@@ -7,6 +7,6 @@ const oclif = require('@oclif/core');
|
|
|
7
7
|
oclif.run()
|
|
8
8
|
.then(require('@oclif/core/flush'))
|
|
9
9
|
.catch((err) => {
|
|
10
|
-
const
|
|
11
|
-
return
|
|
10
|
+
const { handle } = require('@oclif/core/handle');
|
|
11
|
+
return handle(err);
|
|
12
12
|
});
|
package/bin/run_bin
CHANGED
|
@@ -8,6 +8,6 @@ const oclif = require('@oclif/core');
|
|
|
8
8
|
oclif.run()
|
|
9
9
|
.then(require('@oclif/core/flush'))
|
|
10
10
|
.catch((err) => {
|
|
11
|
-
const
|
|
12
|
-
return
|
|
11
|
+
const { handle } = require('@oclif/core/handle');
|
|
12
|
+
return handle(err);
|
|
13
13
|
});
|
|
@@ -23,8 +23,8 @@ export default class Template extends Command {
|
|
|
23
23
|
'use-new-generator': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
24
24
|
};
|
|
25
25
|
static args: {
|
|
26
|
-
asyncapi: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
27
|
-
template: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
26
|
+
asyncapi: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
27
|
+
template: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
28
28
|
};
|
|
29
29
|
parser: Parser;
|
|
30
30
|
run(): Promise<void>;
|
|
@@ -75,10 +75,12 @@ class Template extends base_1.default {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
run() {
|
|
78
|
+
var _a, _b;
|
|
78
79
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
79
80
|
const { args, flags } = yield this.parse(Template); // NOSONAR
|
|
80
81
|
const interactive = !flags['no-interactive'];
|
|
81
|
-
let
|
|
82
|
+
let asyncapi = (_a = args['asyncapi']) !== null && _a !== void 0 ? _a : '';
|
|
83
|
+
let template = (_b = args['template']) !== null && _b !== void 0 ? _b : '';
|
|
82
84
|
let output = flags.output;
|
|
83
85
|
const { proxyPort, proxyHost } = flags;
|
|
84
86
|
if (interactive) {
|
|
@@ -392,6 +394,6 @@ Template.examples = [
|
|
|
392
394
|
];
|
|
393
395
|
Template.flags = Object.assign(Object.assign({}, (0, fromTemplate_flags_1.fromTemplateFlags)()), (0, proxy_flags_1.proxyFlags)());
|
|
394
396
|
Template.args = {
|
|
395
|
-
asyncapi: core_1.Args.string({ description: '- Local path, url or context-name pointing to AsyncAPI file', required:
|
|
396
|
-
template: core_1.Args.string({ description: '- Name of the generator template like for example @asyncapi/html-template or https://github.com/asyncapi/html-template', required:
|
|
397
|
+
asyncapi: core_1.Args.string({ description: '- Local path, url or context-name pointing to AsyncAPI file', required: false }),
|
|
398
|
+
template: core_1.Args.string({ description: '- Name of the generator template like for example @asyncapi/html-template or https://github.com/asyncapi/html-template', required: false }),
|
|
397
399
|
};
|
package/lib/commands/optimize.js
CHANGED
|
@@ -55,12 +55,17 @@ class Optimize extends base_1.default {
|
|
|
55
55
|
if (err.message.includes('Failed to download')) {
|
|
56
56
|
throw new Error('Proxy Connection Error: Unable to establish a connection to the proxy check hostName or PortNumber.');
|
|
57
57
|
}
|
|
58
|
-
else {
|
|
58
|
+
else if (filePath) {
|
|
59
59
|
this.error(new validation_error_1.ValidationError({
|
|
60
60
|
type: 'invalid-file',
|
|
61
61
|
filepath: filePath,
|
|
62
62
|
}));
|
|
63
63
|
}
|
|
64
|
+
else {
|
|
65
|
+
this.error(new validation_error_1.ValidationError({
|
|
66
|
+
type: 'no-spec-found'
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
64
69
|
}
|
|
65
70
|
let optimizer;
|
|
66
71
|
let report;
|
|
@@ -70,8 +75,8 @@ class Optimize extends base_1.default {
|
|
|
70
75
|
}
|
|
71
76
|
catch (err) {
|
|
72
77
|
this.error(new validation_error_1.ValidationError({
|
|
73
|
-
type: 'invalid-file',
|
|
74
|
-
filepath:
|
|
78
|
+
type: 'invalid-syntax-file',
|
|
79
|
+
filepath: this.specFile.getFilePath(),
|
|
75
80
|
}));
|
|
76
81
|
}
|
|
77
82
|
this.isInteractive = !flags['no-tty'];
|
|
@@ -10,6 +10,9 @@ class ValidationError extends Error {
|
|
|
10
10
|
if (error.type === 'invalid-file') {
|
|
11
11
|
this.message = `There is no file or context with name "${error.filepath}".`;
|
|
12
12
|
}
|
|
13
|
+
if (error.type === 'invalid-syntax-file') {
|
|
14
|
+
this.message = `Syntax Error in "${error.filepath}".`;
|
|
15
|
+
}
|
|
13
16
|
if (error.type === 'no-spec-found') {
|
|
14
17
|
this.message = 'Unable to perform validation. Specify what AsyncAPI file should be validated.\n\nThese are your options to specify in the CLI what AsyncAPI file should be used:\n- You can provide a path to the AsyncAPI file: asyncapi validate path/to/file/asyncapi.yml\n- You can also pass a saved context that points to your AsyncAPI file: asyncapi validate mycontext\n- In case you did not specify a context that you want to use, the CLI checks if there is a default context and uses it. To set default context run: asyncapi context use mycontext\n- In case you did not provide any reference to AsyncAPI file and there is no default context, the CLI detects if in your current working directory you have files like asyncapi.json, asyncapi.yaml, asyncapi.yml. Just rename your file accordingly.';
|
|
15
18
|
}
|
package/oclif.manifest.json
CHANGED
|
@@ -721,12 +721,12 @@
|
|
|
721
721
|
"asyncapi": {
|
|
722
722
|
"description": "- Local path, url or context-name pointing to AsyncAPI file",
|
|
723
723
|
"name": "asyncapi",
|
|
724
|
-
"required":
|
|
724
|
+
"required": false
|
|
725
725
|
},
|
|
726
726
|
"template": {
|
|
727
727
|
"description": "- Name of the generator template like for example @asyncapi/html-template or https://github.com/asyncapi/html-template",
|
|
728
728
|
"name": "template",
|
|
729
|
-
"required":
|
|
729
|
+
"required": false
|
|
730
730
|
}
|
|
731
731
|
},
|
|
732
732
|
"description": "Generates whatever you want using templates compatible with AsyncAPI Generator.",
|
|
@@ -1771,5 +1771,5 @@
|
|
|
1771
1771
|
]
|
|
1772
1772
|
}
|
|
1773
1773
|
},
|
|
1774
|
-
"version": "2.16.
|
|
1774
|
+
"version": "2.16.6"
|
|
1775
1775
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asyncapi/cli",
|
|
3
3
|
"description": "All in one CLI for all AsyncAPI tools",
|
|
4
|
-
"version": "2.16.
|
|
4
|
+
"version": "2.16.6",
|
|
5
5
|
"author": "@asyncapi",
|
|
6
6
|
"bin": {
|
|
7
7
|
"asyncapi": "./bin/run_bin"
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"@asyncapi/openapi-schema-parser": "^3.0.24",
|
|
18
18
|
"@asyncapi/optimizer": "^1.0.4",
|
|
19
19
|
"@asyncapi/parser": "^3.3.0",
|
|
20
|
-
"@asyncapi/protobuf-schema-parser": "^3.
|
|
20
|
+
"@asyncapi/protobuf-schema-parser": "^3.5.1",
|
|
21
21
|
"@asyncapi/raml-dt-schema-parser": "^4.0.24",
|
|
22
22
|
"@asyncapi/studio": "^0.20.0",
|
|
23
23
|
"@changesets/changelog-git": "^0.2.0",
|
|
24
24
|
"@clack/prompts": "^0.7.0",
|
|
25
|
-
"@oclif/core": "^4.
|
|
25
|
+
"@oclif/core": "^4.2.8",
|
|
26
26
|
"@smoya/asyncapi-adoption-metrics": "^2.4.9",
|
|
27
27
|
"@stoplight/spectral-cli": "6.9.0",
|
|
28
28
|
"chalk": "^4.1.0",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
],
|
|
112
112
|
"hooks": {
|
|
113
113
|
"command_not_found": [
|
|
114
|
-
"./lib/hooks/command_not_found/myhook"
|
|
114
|
+
"./lib/core/hooks/command_not_found/myhook"
|
|
115
115
|
]
|
|
116
116
|
},
|
|
117
117
|
"macos": {
|