@asyncapi/cli 0.19.5 → 0.21.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.
package/README.md CHANGED
@@ -12,8 +12,11 @@ CLI to work with your AsyncAPI files. Currently supports validation, but it is u
12
12
 
13
13
  <!-- toc -->
14
14
 
15
- - [Requirements](#requirements)
16
- * [Installation](#installation)
15
+ - [Installation](#installation)
16
+ * [Using NPM and Node](#using-npm-and-node)
17
+ * [MacOS](#macos)
18
+ + [Using brew](#using-brew)
19
+ + [Using pkg](#using-pkg)
17
20
  - [Usage](#usage)
18
21
  - [Contributing](#contributing)
19
22
  * [Set up development environment](#set-up-development-environment)
@@ -22,7 +25,10 @@ CLI to work with your AsyncAPI files. Currently supports validation, but it is u
22
25
 
23
26
  <!-- tocstop -->
24
27
 
25
- ## Requirements
28
+ ## Installation
29
+
30
+ ### Using NPM and Node
31
+
26
32
  To run `@asyncapi/cli`, you'll need Node.js >=v10
27
33
 
28
34
  Run this terminal command to check your Node.js version:
@@ -30,21 +36,36 @@ Run this terminal command to check your Node.js version:
30
36
  node -v
31
37
  ```
32
38
 
33
- If you don't have Node.js installed or NPM, simply [install both via package manager](https://nodejs.org/en/download/package-manager/)
34
-
35
- ### Installation
36
-
37
- Run this command to install the CLI globally on your system:
39
+ > If you don't have Node.js installed or NPM, simply [install both via package manager](https://nodejs.org/en/download/package-manager/)
38
40
 
41
+ Install the CLI globaly on your system run CLI it from anywhere:
39
42
  ```
40
43
  npm install -g @asyncapi/cli
41
44
  ```
42
45
 
43
- This installs the cli globaly on your system allowing you to run it from anywhere. If you want to install it locally, just remove the `-g` flag.
46
+ ### MacOS
47
+
48
+ #### Using brew
44
49
 
45
- > Cli will be available for installation brew and other app managers for other systems.
50
+ You can install this CLI using [`brew`](https://brew.sh/) package manager.
46
51
 
52
+ ```bash
53
+ # Install brew
54
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
55
+ # Install AsyncAPI CLI
56
+ brew install asyncapi
57
+ ```
47
58
 
59
+ #### Using pkg
60
+
61
+ Each release of CLI produces a MacOS dedicated `pkg` file that enables you to install this CLI as MacOS application.
62
+
63
+ ```bash
64
+ # Download latest release. To download specific release, your link should look similar to https://github.com/asyncapi/cli/releases/download/v0.13.0/asyncapi.pkg. All releases are listed in https://github.com/asyncapi/cli/releases
65
+ curl -OL https://github.com/asyncapi/cli/releases/latest/download/asyncapi.pkg
66
+ # Install AsyncAPI CLI
67
+ sudo installer -pkg asyncapi.pkg -target /
68
+ ```
48
69
 
49
70
  ## Usage
50
71
 
@@ -66,14 +87,20 @@ USAGE
66
87
 
67
88
  COMMANDS
68
89
  config access configs
69
- diff find diff between two asyncapi files
70
- new creates a new asyncapi file
90
+ diff find diff between two AsyncAPI files
91
+ new creates a new AsyncAPI file
71
92
  start starts a new local instance of Studio
72
- validate validate asyncapi file
93
+ validate validate an AsyncAPI file
94
+ generate generate all kinds of stuff
95
+ models generate all the typed models for the message payloads defined in the AsyncAPI file
96
+ typescript generate the models for TypeScript
97
+ csharp generate the models for C#
98
+ golang generate the models for Go
99
+ java generate the models for Java
100
+ javascript generate the models for JavaScript
101
+ dart generate the models for Dart
73
102
  ```
74
103
 
75
-
76
-
77
104
  ## Contributing
78
105
 
79
106
  Read [CONTRIBUTING](https://github.com/asyncapi/.github/blob/master/CONTRIBUTING.md) guide.
@@ -83,7 +110,8 @@ Read [CONTRIBUTING](https://github.com/asyncapi/.github/blob/master/CONTRIBUTING
83
110
  Follow these steps:
84
111
  - Clone the repo.
85
112
  - Run `npm install` to install all the required dependencies
86
- - Run `npm run test` to make sure everything is properly set up.
113
+ - Run `npm run test` to make sure everything is properly set up
114
+ - Run `npm run build` and then `bin/run` to try new CLI locally
87
115
 
88
116
  UX developed for the CLI should be compliant with [Command Line Interface Guideline](https://clig.dev/)
89
117
 
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const core_1 = require("@oclif/core");
5
- const base_1 = (0, tslib_1.__importDefault)(require("../../../base"));
5
+ const base_1 = tslib_1.__importDefault(require("../../../base"));
6
6
  const Context_1 = require("../../../models/Context");
7
7
  class ContextAdd extends base_1.default {
8
8
  async run() {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const core_1 = require("@oclif/core");
5
- const base_1 = (0, tslib_1.__importDefault)(require("../../../base"));
5
+ const base_1 = tslib_1.__importDefault(require("../../../base"));
6
6
  const Context_1 = require("../../../models/Context");
7
7
  class ContextCurrent extends base_1.default {
8
8
  async run() {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const core_1 = require("@oclif/core");
5
- const base_1 = (0, tslib_1.__importDefault)(require("../../../base"));
5
+ const base_1 = tslib_1.__importDefault(require("../../../base"));
6
6
  class Context extends base_1.default {
7
7
  async run() {
8
8
  const Help = await (0, core_1.loadHelpClass)(this.config);
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const core_1 = require("@oclif/core");
5
- const base_1 = (0, tslib_1.__importDefault)(require("../../../base"));
5
+ const base_1 = tslib_1.__importDefault(require("../../../base"));
6
6
  const Context_1 = require("../../../models/Context");
7
7
  class ContextList extends base_1.default {
8
8
  async run() {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const core_1 = require("@oclif/core");
5
- const base_1 = (0, tslib_1.__importDefault)(require("../../../base"));
5
+ const base_1 = tslib_1.__importDefault(require("../../../base"));
6
6
  const Context_1 = require("../../../models/Context");
7
7
  class ContextRemove extends base_1.default {
8
8
  async run() {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const core_1 = require("@oclif/core");
5
- const base_1 = (0, tslib_1.__importDefault)(require("../../../base"));
5
+ const base_1 = tslib_1.__importDefault(require("../../../base"));
6
6
  const Context_1 = require("../../../models/Context");
7
7
  class ContextUse extends base_1.default {
8
8
  async run() {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const base_1 = (0, tslib_1.__importDefault)(require("../../base"));
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
5
  const core_1 = require("@oclif/core");
6
6
  class Config extends base_1.default {
7
7
  async run() {
@@ -4,13 +4,13 @@ const tslib_1 = require("tslib");
4
4
  /* eslint-disable @typescript-eslint/ban-ts-comment */
5
5
  const fs_1 = require("fs");
6
6
  const core_1 = require("@oclif/core");
7
- const base_1 = (0, tslib_1.__importDefault)(require("../base"));
7
+ const base_1 = tslib_1.__importDefault(require("../base"));
8
8
  const validation_error_1 = require("../errors/validation-error");
9
9
  const SpecificationFile_1 = require("../models/SpecificationFile");
10
10
  const specification_file_1 = require("../errors/specification-file");
11
11
  const converter_1 = require("@asyncapi/converter");
12
12
  // @ts-ignore
13
- const specs_1 = (0, tslib_1.__importDefault)(require("@asyncapi/specs"));
13
+ const specs_1 = tslib_1.__importDefault(require("@asyncapi/specs"));
14
14
  const latestVersion = Object.keys(specs_1.default).pop();
15
15
  class Convert extends base_1.default {
16
16
  async run() {
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  /* eslint-disable sonarjs/no-duplicate-string */
5
5
  const core_1 = require("@oclif/core");
6
- const diff = (0, tslib_1.__importStar)(require("@asyncapi/diff"));
7
- const parser = (0, tslib_1.__importStar)(require("@asyncapi/parser"));
6
+ const diff = tslib_1.__importStar(require("@asyncapi/diff"));
7
+ const parser = tslib_1.__importStar(require("@asyncapi/parser"));
8
8
  const fs_1 = require("fs");
9
9
  const SpecificationFile_1 = require("../models/SpecificationFile");
10
- const base_1 = (0, tslib_1.__importDefault)(require("../base"));
10
+ const base_1 = tslib_1.__importDefault(require("../base"));
11
11
  const validation_error_1 = require("../errors/validation-error");
12
12
  const specification_file_1 = require("../errors/specification-file");
13
13
  const diff_error_1 = require("../errors/diff-error");
@@ -0,0 +1,28 @@
1
+ import Command from '../../base';
2
+ export default class Models extends Command {
3
+ static description: string;
4
+ static args: ({
5
+ name: string;
6
+ description: string;
7
+ options: string[];
8
+ required: boolean;
9
+ } | {
10
+ name: string;
11
+ description: string;
12
+ required: boolean;
13
+ options?: undefined;
14
+ })[];
15
+ static flags: {
16
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
17
+ output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
18
+ /**
19
+ * Go and Java specific package name to use for the generated models
20
+ */
21
+ packageName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
22
+ /**
23
+ * C# specific options
24
+ */
25
+ namespace: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
26
+ };
27
+ run(): Promise<void>;
28
+ }
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const modelina_1 = require("@asyncapi/modelina");
5
+ const core_1 = require("@oclif/core");
6
+ const base_1 = tslib_1.__importDefault(require("../../base"));
7
+ const SpecificationFile_1 = require("../../models/SpecificationFile");
8
+ const parser_1 = require("@asyncapi/parser");
9
+ var Languages;
10
+ (function (Languages) {
11
+ Languages["typescript"] = "typescript";
12
+ Languages["csharp"] = "csharp";
13
+ Languages["golang"] = "golang";
14
+ Languages["java"] = "java";
15
+ Languages["javascript"] = "javascript";
16
+ Languages["dart"] = "dart";
17
+ })(Languages || (Languages = {}));
18
+ const possibleLanguageValues = Object.values(Languages).join(', ');
19
+ class Models extends base_1.default {
20
+ async run() {
21
+ const passedArguments = await this.parse(Models);
22
+ const { namespace, packageName, output } = passedArguments.flags;
23
+ const { language, file } = passedArguments.args;
24
+ const inputFile = await (0, SpecificationFile_1.load)(file) || await (0, SpecificationFile_1.load)();
25
+ const parsedInput = await (0, parser_1.parse)(inputFile.text());
26
+ modelina_1.Logger.setLogger({
27
+ info: this.log,
28
+ debug: this.debug,
29
+ warn: this.warn,
30
+ error: this.error,
31
+ });
32
+ let fileGenerator;
33
+ let fileOptions = {};
34
+ switch (language) {
35
+ case Languages.typescript:
36
+ fileGenerator = new modelina_1.TypeScriptFileGenerator();
37
+ break;
38
+ case Languages.csharp:
39
+ if (namespace === undefined) {
40
+ throw new Error('In order to generate models to C#, we need to know which namespace they are under. Add `--namespace=NAMESPACE` to set the desired namespace.');
41
+ }
42
+ fileGenerator = new modelina_1.CSharpFileGenerator();
43
+ fileOptions = {
44
+ namespace
45
+ };
46
+ break;
47
+ case Languages.golang:
48
+ if (packageName === undefined) {
49
+ throw new Error('In order to generate models to Go, we need to know which package they are under. Add `--packageName=PACKAGENAME` to set the desired package name.');
50
+ }
51
+ fileGenerator = new modelina_1.GoFileGenerator();
52
+ fileOptions = {
53
+ packageName
54
+ };
55
+ break;
56
+ case Languages.java:
57
+ if (packageName === undefined) {
58
+ throw new Error('In order to generate models to Java, we need to know which package they are under. Add `--packageName=PACKAGENAME` to set the desired package name.');
59
+ }
60
+ fileGenerator = new modelina_1.JavaFileGenerator();
61
+ fileOptions = {
62
+ packageName
63
+ };
64
+ break;
65
+ case Languages.javascript:
66
+ fileGenerator = new modelina_1.JavaScriptFileGenerator();
67
+ break;
68
+ case Languages.dart:
69
+ if (packageName === undefined) {
70
+ throw new Error('In order to generate models to Dart, we need to know which package they are under. Add `--packageName=PACKAGENAME` to set the desired package name.');
71
+ }
72
+ fileGenerator = new modelina_1.DartFileGenerator();
73
+ fileOptions = {
74
+ packageName
75
+ };
76
+ break;
77
+ default:
78
+ throw new Error(`Could not determine generator for language ${language}, are you using one of the following values ${possibleLanguageValues}?`);
79
+ }
80
+ let models;
81
+ if (output) {
82
+ models = await fileGenerator.generateToFiles(parsedInput, output, { ...fileOptions, });
83
+ const generatedModels = models.map((model) => { return model.modelName; });
84
+ this.log(`Successfully generated the following models: ${generatedModels.join(', ')}`);
85
+ }
86
+ else {
87
+ models = await fileGenerator.generateCompleteModels(parsedInput, { ...fileOptions });
88
+ const generatedModels = models.map((model) => {
89
+ return `
90
+ ## Model name: ${model.modelName}
91
+ ${model.result}
92
+ `;
93
+ });
94
+ this.log(`Successfully generated the following models: ${generatedModels.join('\n')}`);
95
+ }
96
+ }
97
+ }
98
+ exports.default = Models;
99
+ Models.description = 'Generates typed models';
100
+ Models.args = [
101
+ {
102
+ name: 'language',
103
+ description: 'The language you want the typed models generated for.',
104
+ options: Object.keys(Languages),
105
+ required: true
106
+ },
107
+ { name: 'file', description: 'Path or URL to the AsyncAPI document, or context-name', required: true },
108
+ ];
109
+ Models.flags = {
110
+ help: core_1.Flags.help({ char: 'h' }),
111
+ output: core_1.Flags.string({ char: 'o', description: 'The output directory where the models should be written to. Omitting this flag will write the models to `stdout`.', required: false }),
112
+ /**
113
+ * Go and Java specific package name to use for the generated models
114
+ */
115
+ packageName: core_1.Flags.string({ description: 'Go and Java specific, define the package to use for the generated models. This is required when language is `go` or `java`.', required: false }),
116
+ /**
117
+ * C# specific options
118
+ */
119
+ namespace: core_1.Flags.string({ description: 'C# specific, define the namespace to use for the generated models. This is required when language is `csharp`.', required: false }),
120
+ };
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const core_1 = require("@oclif/core");
5
5
  const fs_1 = require("fs");
6
- const base_1 = (0, tslib_1.__importDefault)(require("../base"));
7
- const inquirer = (0, tslib_1.__importStar)(require("inquirer"));
6
+ const base_1 = tslib_1.__importDefault(require("../base"));
7
+ const inquirer = tslib_1.__importStar(require("inquirer"));
8
8
  const Studio_1 = require("../models/Studio");
9
9
  const path_1 = require("path");
10
10
  const { writeFile, readFile } = fs_1.promises;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const base_1 = (0, tslib_1.__importDefault)(require("../../base"));
4
+ const base_1 = tslib_1.__importDefault(require("../../base"));
5
5
  const core_1 = require("@oclif/core");
6
6
  class Start extends base_1.default {
7
7
  async run() {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const core_1 = require("@oclif/core");
5
- const base_1 = (0, tslib_1.__importDefault)(require("../../base"));
5
+ const base_1 = tslib_1.__importDefault(require("../../base"));
6
6
  const Studio_1 = require("../../models/Studio");
7
7
  const SpecificationFile_1 = require("../../models/SpecificationFile");
8
8
  class StartStudio extends base_1.default {
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const core_1 = require("@oclif/core");
5
- const parser = (0, tslib_1.__importStar)(require("@asyncapi/parser"));
6
- const base_1 = (0, tslib_1.__importDefault)(require("../base"));
5
+ const parser = tslib_1.__importStar(require("@asyncapi/parser"));
6
+ const base_1 = tslib_1.__importDefault(require("../base"));
7
7
  const validation_error_1 = require("../errors/validation-error");
8
8
  const SpecificationFile_1 = require("../models/SpecificationFile");
9
9
  const globals_1 = require("../globals");
package/lib/globals.js CHANGED
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.specWatcher = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const chokidar_1 = (0, tslib_1.__importDefault)(require("chokidar"));
6
- const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
5
+ const chokidar_1 = tslib_1.__importDefault(require("chokidar"));
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
7
  const GreenLog = chalk_1.default.hex('#00FF00');
8
8
  const OrangeLog = chalk_1.default.hex('#FFA500');
9
9
  const CHOKIDAR_CONFIG = {
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadContextFile = exports.setCurrentContext = exports.getCurrentContext = exports.removeContext = exports.addContext = exports.loadContext = exports.DEFAULT_CONTEXT_FILE_PATH = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const fs_1 = require("fs");
6
- const path = (0, tslib_1.__importStar)(require("path"));
7
- const os = (0, tslib_1.__importStar)(require("os"));
6
+ const path = tslib_1.__importStar(require("path"));
7
+ const os = tslib_1.__importStar(require("os"));
8
8
  const context_error_1 = require("../errors/context-error");
9
9
  const { readFile, writeFile } = fs_1.promises;
10
10
  const CONTEXT_FILENAME = process.env.CONTEXT_FILENAME || '.asyncapi';
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fileExists = exports.isURL = exports.nameType = exports.load = exports.Specification = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const fs_1 = require("fs");
6
- const path = (0, tslib_1.__importStar)(require("path"));
7
- const node_fetch_1 = (0, tslib_1.__importDefault)(require("node-fetch"));
6
+ const path = tslib_1.__importStar(require("path"));
7
+ const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
8
8
  const Context_1 = require("./Context");
9
9
  const specification_file_1 = require("../errors/specification-file");
10
10
  const context_error_1 = require("../errors/context-error");
@@ -6,10 +6,10 @@ const fs_1 = require("fs");
6
6
  const specification_file_1 = require("../errors/specification-file");
7
7
  const path_1 = require("path");
8
8
  const http_1 = require("http");
9
- const serve_handler_1 = (0, tslib_1.__importDefault)(require("serve-handler"));
9
+ const serve_handler_1 = tslib_1.__importDefault(require("serve-handler"));
10
10
  const ws_1 = require("ws");
11
- const chokidar_1 = (0, tslib_1.__importDefault)(require("chokidar"));
12
- const open_1 = (0, tslib_1.__importDefault)(require("open"));
11
+ const chokidar_1 = tslib_1.__importDefault(require("chokidar"));
12
+ const open_1 = tslib_1.__importDefault(require("open"));
13
13
  const { readFile, writeFile } = fs_1.promises;
14
14
  const sockets = [];
15
15
  const messageQueue = [];
@@ -1 +1 @@
1
- {"version":"0.19.5","commands":{"convert":{"id":"convert","description":"convert asyncapi documents older to newer versions","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false},"output":{"name":"output","type":"option","char":"o","description":"path to the file where the result is saved","multiple":false},"target-version":{"name":"target-version","type":"option","char":"t","description":"asyncapi version to convert to","multiple":false,"default":"2.4.0"}},"args":[{"name":"spec-file","description":"spec path, url, or context-name","required":false}],"_globalFlags":{}},"diff":{"id":"diff","description":"find diff between two asyncapi files","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false},"format":{"name":"format","type":"option","char":"f","description":"format of the output","multiple":false,"options":["json","yaml","yml"],"default":"yaml"},"type":{"name":"type","type":"option","char":"t","description":"type of the output","multiple":false,"options":["breaking","non-breaking","unclassified","all"],"default":"all"},"overrides":{"name":"overrides","type":"option","char":"o","description":"path to JSON file containing the override properties","multiple":false},"watch":{"name":"watch","type":"boolean","char":"w","description":"Enable watch mode","allowNo":false}},"args":[{"name":"old","description":"old spec path, URL or context-name","required":true},{"name":"new","description":"new spec path, URL or context-name","required":true}],"_globalFlags":{}},"new":{"id":"new","description":"creates a new asyncapi file","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false},"file-name":{"name":"file-name","type":"option","char":"n","description":"name of the file","multiple":false},"example":{"name":"example","type":"option","char":"e","description":"name of the example to use","multiple":false},"studio":{"name":"studio","type":"boolean","char":"s","description":"open in Studio","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"port in which to start Studio","multiple":false},"no-tty":{"name":"no-tty","type":"boolean","description":"do not use an interactive terminal","allowNo":false}},"args":[],"_globalFlags":{}},"validate":{"id":"validate","description":"validate asyncapi file","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false},"watch":{"name":"watch","type":"boolean","char":"w","description":"Enable watch mode","allowNo":false}},"args":[{"name":"spec-file","description":"spec path, url, or context-name","required":false}],"_globalFlags":{}},"config":{"id":"config","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"start":{"id":"start","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"start:studio":{"id":"start:studio","description":"starts a new local instance of Studio","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false},"file":{"name":"file","type":"option","char":"f","description":"path to the AsyncAPI file to link with Studio","multiple":false},"port":{"name":"port","type":"option","char":"p","description":"port in which to start Studio","multiple":false}},"args":[],"_globalFlags":{}},"config:context:add":{"id":"config:context:add","description":"Add or modify a context in the store","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"context-name","description":"context name","required":true},{"name":"spec-file-path","description":"file path of the spec file","required":true}],"_globalFlags":{}},"config:context:current":{"id":"config:context:current","description":"Shows the current context that is being used","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[],"_globalFlags":{}},"config:context":{"id":"config:context","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"config:context:list":{"id":"config:context:list","description":"List all the stored context in the store","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[],"_globalFlags":{}},"config:context:remove":{"id":"config:context:remove","description":"Delete a context from the store","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"context-name","description":"Name of the context to delete","required":true}],"_globalFlags":{}},"config:context:use":{"id":"config:context:use","description":"Set a context as current","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"context-name","description":"name of the saved context","required":true}],"_globalFlags":{}}}}
1
+ {"version":"0.21.0","commands":{"convert":{"id":"convert","description":"convert asyncapi documents older to newer versions","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false},"output":{"name":"output","type":"option","char":"o","description":"path to the file where the result is saved","multiple":false},"target-version":{"name":"target-version","type":"option","char":"t","description":"asyncapi version to convert to","multiple":false,"default":"2.4.0"}},"args":[{"name":"spec-file","description":"spec path, url, or context-name","required":false}],"_globalFlags":{}},"diff":{"id":"diff","description":"find diff between two asyncapi files","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false},"format":{"name":"format","type":"option","char":"f","description":"format of the output","multiple":false,"options":["json","yaml","yml"],"default":"yaml"},"type":{"name":"type","type":"option","char":"t","description":"type of the output","multiple":false,"options":["breaking","non-breaking","unclassified","all"],"default":"all"},"overrides":{"name":"overrides","type":"option","char":"o","description":"path to JSON file containing the override properties","multiple":false},"watch":{"name":"watch","type":"boolean","char":"w","description":"Enable watch mode","allowNo":false}},"args":[{"name":"old","description":"old spec path, URL or context-name","required":true},{"name":"new","description":"new spec path, URL or context-name","required":true}],"_globalFlags":{}},"new":{"id":"new","description":"creates a new asyncapi file","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false},"file-name":{"name":"file-name","type":"option","char":"n","description":"name of the file","multiple":false},"example":{"name":"example","type":"option","char":"e","description":"name of the example to use","multiple":false},"studio":{"name":"studio","type":"boolean","char":"s","description":"open in Studio","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"port in which to start Studio","multiple":false},"no-tty":{"name":"no-tty","type":"boolean","description":"do not use an interactive terminal","allowNo":false}},"args":[],"_globalFlags":{}},"validate":{"id":"validate","description":"validate asyncapi file","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false},"watch":{"name":"watch","type":"boolean","char":"w","description":"Enable watch mode","allowNo":false}},"args":[{"name":"spec-file","description":"spec path, url, or context-name","required":false}],"_globalFlags":{}},"config":{"id":"config","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"generate:models":{"id":"generate:models","description":"Generates typed models","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false},"output":{"name":"output","type":"option","char":"o","description":"The output directory where the models should be written to. Omitting this flag will write the models to `stdout`.","required":false,"multiple":false},"packageName":{"name":"packageName","type":"option","description":"Go and Java specific, define the package to use for the generated models. This is required when language is `go` or `java`.","required":false,"multiple":false},"namespace":{"name":"namespace","type":"option","description":"C# specific, define the namespace to use for the generated models. This is required when language is `csharp`.","required":false,"multiple":false}},"args":[{"name":"language","description":"The language you want the typed models generated for.","required":true,"options":["typescript","csharp","golang","java","javascript","dart"]},{"name":"file","description":"Path or URL to the AsyncAPI document, or context-name","required":true}],"_globalFlags":{}},"start":{"id":"start","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"start:studio":{"id":"start:studio","description":"starts a new local instance of Studio","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false},"file":{"name":"file","type":"option","char":"f","description":"path to the AsyncAPI file to link with Studio","multiple":false},"port":{"name":"port","type":"option","char":"p","description":"port in which to start Studio","multiple":false}},"args":[],"_globalFlags":{}},"config:context:add":{"id":"config:context:add","description":"Add or modify a context in the store","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"context-name","description":"context name","required":true},{"name":"spec-file-path","description":"file path of the spec file","required":true}],"_globalFlags":{}},"config:context:current":{"id":"config:context:current","description":"Shows the current context that is being used","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[],"_globalFlags":{}},"config:context":{"id":"config:context","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"config:context:list":{"id":"config:context:list","description":"List all the stored context in the store","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[],"_globalFlags":{}},"config:context:remove":{"id":"config:context:remove","description":"Delete a context from the store","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"context-name","description":"Name of the context to delete","required":true}],"_globalFlags":{}},"config:context:use":{"id":"config:context:use","description":"Set a context as current","strict":true,"pluginName":"@asyncapi/cli","pluginAlias":"@asyncapi/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false}},"args":[{"name":"context-name","description":"name of the saved context","required":true}],"_globalFlags":{}}}}
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@asyncapi/cli",
3
3
  "description": "All in one CLI for all AsyncAPI tools",
4
- "version": "0.19.5",
4
+ "version": "0.21.0",
5
5
  "author": "@asyncapi",
6
6
  "bin": {
7
7
  "asyncapi": "./bin/run"
8
8
  },
9
9
  "bugs": "https://github.com/asyncapi/cli/issues",
10
10
  "dependencies": {
11
+ "@asyncapi/modelina": "^0.59.2",
11
12
  "@asyncapi/converter": "^1.0.0",
12
13
  "@asyncapi/diff": "^0.4.0",
13
14
  "@asyncapi/parser": "^1.15.1",
@@ -41,7 +42,7 @@
41
42
  "@types/lodash.template": "^4.4.4",
42
43
  "@types/mocha": "^5.2.7",
43
44
  "@types/node": "^10.17.60",
44
- "@types/node-fetch": "^2.0.2",
45
+ "@types/node-fetch": "^2.5.12",
45
46
  "@types/serve-handler": "^6.1.1",
46
47
  "@types/wrap-ansi": "^8.0.1",
47
48
  "@typescript-eslint/eslint-plugin": "^4.28.4",
@@ -63,6 +64,7 @@
63
64
  "rimraf": "^3.0.2",
64
65
  "semantic-release": "^17.4.3",
65
66
  "souvikns-oclif": "^2.5.0",
67
+ "simple-git": "^2.48.0",
66
68
  "ts-node": "^10.4.0",
67
69
  "tslib": "^2.3.1",
68
70
  "typescript": "^4.4.3"
@@ -89,6 +91,9 @@
89
91
  "plugins": [
90
92
  "@oclif/plugin-not-found"
91
93
  ],
94
+ "macos": {
95
+ "identifier": "com.asyncapi.cli"
96
+ },
92
97
  "topicSeparator": " ",
93
98
  "topics": {
94
99
  "config:context": {},
@@ -131,12 +136,17 @@
131
136
  "generate:readme:toc": "markdown-toc -i README.md",
132
137
  "lint": "eslint --max-warnings 0 --config .eslintrc .",
133
138
  "lint:fix": "eslint --max-warnings 5 --config .eslintrc . --fix",
139
+ "pack:macos": "oclif pack:macos && npm run pack:macos:rename",
140
+ "pack:linux": "oclif pack:deb",
141
+ "pack:windows": "oclif pack:win",
142
+ "pack:macos:rename": "node scripts/macosPackRename.js",
134
143
  "postpack": "rimraf oclif.manifest.json",
135
144
  "prepublishOnly": "npm run build && oclif manifest",
136
145
  "pretest": "npm run build",
137
146
  "pretest:coverage": "npm run build",
138
147
  "release": "semantic-release",
139
- "test": "cross-env TEST=1 CONTEXT_FILENAME=\"./test.asyncapi\" CONTEXT_FILE_PATH=\"./\" nyc --extension .ts mocha --require ts-node/register --require test/helpers/init.js --reporter spec --timeout 10000 \"test/**/*.test.ts\""
148
+ "test": "cross-env TEST=1 CONTEXT_FILENAME=\"./test.asyncapi\" CONTEXT_FILE_PATH=\"./\" nyc --extension .ts mocha --require ts-node/register --require test/helpers/init.js --reporter spec --timeout 10000 \"test/**/*.test.ts\"",
149
+ "get-version": "echo $npm_package_version"
140
150
  },
141
151
  "types": "lib/index.d.ts"
142
152
  }