@asyncapi/cli 2.16.8 → 2.16.10
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.
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"asyncapi": "3.0.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "Account Service",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": "This service is in charge of processing user signups"
|
|
7
|
+
},
|
|
8
|
+
"channels": {
|
|
9
|
+
"userSignedUp": {
|
|
10
|
+
"address": "user/signedup",
|
|
11
|
+
"messages": {
|
|
12
|
+
"UserSignedUp": {
|
|
13
|
+
"$ref": "#/components/messages/UserSignedUp"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"operations": {
|
|
19
|
+
"onUserSignUp": {
|
|
20
|
+
"action": "receive",
|
|
21
|
+
"channel": {
|
|
22
|
+
"$ref": "#/channels/userSignedUp"
|
|
23
|
+
},
|
|
24
|
+
"messages": [
|
|
25
|
+
{
|
|
26
|
+
"$ref": "#/channels/userSignedUp/messages/UserSignedUp"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"components": {
|
|
32
|
+
"messages": {
|
|
33
|
+
"UserSignedUp": {
|
|
34
|
+
"payload": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"properties": {
|
|
37
|
+
"displayName": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"description": "Name of the user"
|
|
40
|
+
},
|
|
41
|
+
"email": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"format": "email",
|
|
44
|
+
"description": "Email of the user"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
package/lib/commands/new/file.js
CHANGED
|
@@ -11,7 +11,8 @@ const picocolors_1 = require("picocolors");
|
|
|
11
11
|
const file_flags_1 = require("../../core/flags/new/file.flags");
|
|
12
12
|
const { writeFile, readFile } = fs_1.promises;
|
|
13
13
|
const DEFAULT_ASYNCAPI_FILE_NAME = 'asyncapi.yaml';
|
|
14
|
-
const
|
|
14
|
+
const DEFAULT_ASYNCAPI_YAML_TEMPLATE = 'default-example.yaml';
|
|
15
|
+
const DEFAULT_ASYNCAPI_JSON_TEMPLATE = 'default-example.json';
|
|
15
16
|
function loadExampleFile() {
|
|
16
17
|
const exampleFiles = (0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '../../../assets/examples/examples.json'), { encoding: 'utf8' });
|
|
17
18
|
return JSON.parse(exampleFiles);
|
|
@@ -33,7 +34,15 @@ class NewFile extends base_1.default {
|
|
|
33
34
|
return this.runInteractive();
|
|
34
35
|
}
|
|
35
36
|
const fileName = flags['file-name'] || DEFAULT_ASYNCAPI_FILE_NAME;
|
|
36
|
-
|
|
37
|
+
// Determine template based on file extension
|
|
38
|
+
let default_template;
|
|
39
|
+
if (fileName.endsWith('.json')) {
|
|
40
|
+
default_template = DEFAULT_ASYNCAPI_JSON_TEMPLATE;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
default_template = DEFAULT_ASYNCAPI_YAML_TEMPLATE;
|
|
44
|
+
}
|
|
45
|
+
const template = flags['example'] || default_template;
|
|
37
46
|
yield this.createAsyncapiFile(fileName, template);
|
|
38
47
|
if (flags.studio) {
|
|
39
48
|
if (isTTY) {
|
|
@@ -107,7 +116,15 @@ class NewFile extends base_1.default {
|
|
|
107
116
|
}
|
|
108
117
|
}
|
|
109
118
|
fileName = fileName || DEFAULT_ASYNCAPI_FILE_NAME;
|
|
110
|
-
|
|
119
|
+
// Determine template based on file extension
|
|
120
|
+
let default_template;
|
|
121
|
+
if (fileName.endsWith('.json')) {
|
|
122
|
+
default_template = DEFAULT_ASYNCAPI_JSON_TEMPLATE;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
default_template = DEFAULT_ASYNCAPI_YAML_TEMPLATE;
|
|
126
|
+
}
|
|
127
|
+
selectedTemplate = selectedTemplate || default_template;
|
|
111
128
|
yield this.createAsyncapiFile(fileName, selectedTemplate);
|
|
112
129
|
fileName = fileName.includes('.') ? fileName : `${fileName}.yaml`;
|
|
113
130
|
if (openStudio) {
|
|
@@ -27,7 +27,7 @@ const hook = function (opts) {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
// now we we return if the command id are not there.
|
|
30
|
-
let binHelp = `${opts.config.bin} help`;
|
|
30
|
+
let binHelp = `${opts.config.bin} --help`;
|
|
31
31
|
const idSplit = opts.id.split(':');
|
|
32
32
|
if (opts.config.findTopic(idSplit[0])) {
|
|
33
33
|
// if valid topic, update binHelp with topic
|
package/oclif.manifest.json
CHANGED
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.10",
|
|
5
5
|
"author": "@asyncapi",
|
|
6
6
|
"bin": {
|
|
7
7
|
"asyncapi": "./bin/run_bin"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@asyncapi/parser": "^3.3.0",
|
|
20
20
|
"@asyncapi/protobuf-schema-parser": "^3.5.1",
|
|
21
21
|
"@asyncapi/raml-dt-schema-parser": "^4.0.24",
|
|
22
|
-
"@asyncapi/studio": "^0.23.
|
|
22
|
+
"@asyncapi/studio": "^0.23.1",
|
|
23
23
|
"@changesets/changelog-git": "^0.2.0",
|
|
24
24
|
"@clack/prompts": "^0.7.0",
|
|
25
25
|
"@oclif/core": "^4.2.9",
|