@asyncapi/cli 0.14.0 → 0.16.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 +2 -1
- package/bin/dev +18 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +2 -4
- package/lib/base.d.ts +1 -1
- package/lib/base.js +2 -3
- package/lib/commands/config/context/add.d.ts +1 -1
- package/lib/commands/config/context/add.js +5 -5
- package/lib/commands/config/context/current.d.ts +1 -1
- package/lib/commands/config/context/current.js +4 -4
- package/lib/commands/config/context/index.d.ts +4 -0
- package/lib/commands/config/context/index.js +13 -0
- package/lib/commands/config/context/list.d.ts +1 -1
- package/lib/commands/config/context/list.js +4 -4
- package/lib/commands/config/context/remove.d.ts +1 -1
- package/lib/commands/config/context/remove.js +5 -5
- package/lib/commands/config/context/use.d.ts +1 -1
- package/lib/commands/config/context/use.js +5 -5
- package/lib/commands/config/index.d.ts +4 -0
- package/lib/commands/config/index.js +13 -0
- package/lib/commands/diff.d.ts +5 -6
- package/lib/commands/diff.js +12 -12
- package/lib/commands/new.d.ts +6 -7
- package/lib/commands/new.js +16 -16
- package/lib/commands/start/index.d.ts +4 -0
- package/lib/commands/start/index.js +13 -0
- package/lib/commands/start/studio.d.ts +3 -4
- package/lib/commands/start/studio.js +8 -8
- package/lib/commands/validate.d.ts +2 -2
- package/lib/commands/validate.js +7 -7
- package/lib/flags.d.ts +1 -1
- package/lib/flags.js +2 -2
- package/lib/globals.js +4 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -2
- package/lib/models/Context.js +2 -2
- package/lib/models/SpecificationFile.js +4 -4
- package/lib/models/Studio.js +7 -7
- package/oclif.manifest.json +1 -1
- package/package.json +21 -22
- package/lib/commands/config/context.d.ts +0 -7
- package/lib/commands/config/context.js +0 -14
- package/lib/commands/config.d.ts +0 -8
- package/lib/commands/config.js +0 -16
- package/lib/commands/start.d.ts +0 -8
- package/lib/commands/start.js +0 -16
package/README.md
CHANGED
|
@@ -113,8 +113,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
113
113
|
</tr>
|
|
114
114
|
<tr>
|
|
115
115
|
<td align="center"><a href="https://github.com/mihirterna"><img src="https://avatars.githubusercontent.com/u/31316452?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mihir Kulkarni</b></sub></a><br /><a href="https://github.com/asyncapi/cli/commits?author=mihirterna" title="Code">💻</a></td>
|
|
116
|
-
<td align="center"><a href="https://imabp.github.io/resume/"><img src="https://avatars.githubusercontent.com/u/53480076?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Abir</b></sub></a><br /><a href="https://github.com/asyncapi/cli/commits?author=imabp" title="Tests">⚠️</a></td>
|
|
116
|
+
<td align="center"><a href="https://imabp.github.io/resume/"><img src="https://avatars.githubusercontent.com/u/53480076?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Abir</b></sub></a><br /><a href="https://github.com/asyncapi/cli/commits?author=imabp" title="Tests">⚠️</a> <a href="https://github.com/asyncapi/cli/commits?author=imabp" title="Code">💻</a></td>
|
|
117
117
|
<td align="center"><a href="https://github.com/peter-rr"><img src="https://avatars.githubusercontent.com/u/81691177?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Peter Ramos</b></sub></a><br /><a href="https://github.com/asyncapi/cli/commits?author=peter-rr" title="Code">💻</a></td>
|
|
118
|
+
<td align="center"><a href="https://samridhi-98.github.io/Portfolio"><img src="https://avatars.githubusercontent.com/u/54466041?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Samriddhi</b></sub></a><br /><a href="https://github.com/asyncapi/cli/commits?author=Samridhi-98" title="Tests">⚠️</a></td>
|
|
118
119
|
</tr>
|
|
119
120
|
</table>
|
|
120
121
|
|
package/bin/dev
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env nod
|
|
2
|
+
|
|
3
|
+
const oclif = require('@oclif/core')
|
|
4
|
+
|
|
5
|
+
const path = require('path')
|
|
6
|
+
const project = path.join(__dirname, '..', 'tsconfig.json')
|
|
7
|
+
|
|
8
|
+
// In dev mode -> use ts-node and dev plugins
|
|
9
|
+
process.env.NODE_ENV = 'development'
|
|
10
|
+
|
|
11
|
+
require('ts-node').register({project})
|
|
12
|
+
|
|
13
|
+
// In dev mode, always show stack traces
|
|
14
|
+
oclif.settings.debug = true;
|
|
15
|
+
|
|
16
|
+
// Start the CLI
|
|
17
|
+
oclif.run().then(oclif.flush).catch(oclif.Errors.handle)
|
|
18
|
+
|
package/bin/dev.cmd
ADDED
package/bin/run
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
require('
|
|
3
|
+
const oclif = require('@oclif/core')
|
|
4
4
|
|
|
5
|
-
require('@oclif/
|
|
6
|
-
.then(require('@oclif/command/flush'))
|
|
7
|
-
.catch(require('@oclif/errors/handle'))
|
|
5
|
+
oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'))
|
package/lib/base.d.ts
CHANGED
package/lib/base.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
class default_1 extends command_1.default {
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
class default_1 extends core_1.Command {
|
|
6
5
|
async catch(e) {
|
|
7
6
|
console.error(`${e.name}: ${e.message}`);
|
|
8
7
|
}
|
|
@@ -2,7 +2,7 @@ import Command from '../../../base';
|
|
|
2
2
|
export default class ContextAdd extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
-
help: import("@oclif/
|
|
5
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
6
|
};
|
|
7
7
|
static args: {
|
|
8
8
|
name: string;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const base_1 = (0, 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() {
|
|
9
|
-
const { args } = this.parse(ContextAdd);
|
|
9
|
+
const { args } = await this.parse(ContextAdd);
|
|
10
10
|
const contextName = args['context-name'];
|
|
11
11
|
const specFilePath = args['spec-file-path'];
|
|
12
|
-
await Context_1.addContext(contextName, specFilePath);
|
|
12
|
+
await (0, Context_1.addContext)(contextName, specFilePath);
|
|
13
13
|
this.log(`Added context "${contextName}".\n\nYou can set it as your current context: asyncapi context use ${contextName}\nYou can use this context when needed by passing ${contextName} as a parameter: asyncapi validate ${contextName}`);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.default = ContextAdd;
|
|
17
17
|
ContextAdd.description = 'Add or modify a context in the store';
|
|
18
18
|
ContextAdd.flags = {
|
|
19
|
-
help:
|
|
19
|
+
help: core_1.Flags.help({ char: 'h' })
|
|
20
20
|
};
|
|
21
21
|
ContextAdd.args = [
|
|
22
22
|
{ name: 'context-name', description: 'context name', required: true },
|
|
@@ -2,7 +2,7 @@ import Command from '../../../base';
|
|
|
2
2
|
export default class ContextCurrent extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
-
help: import("@oclif/
|
|
5
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
6
|
};
|
|
7
7
|
run(): Promise<void>;
|
|
8
8
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const base_1 = (0, 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() {
|
|
9
|
-
const { current, context } = await Context_1.getCurrentContext();
|
|
9
|
+
const { current, context } = await (0, Context_1.getCurrentContext)();
|
|
10
10
|
this.log(`${current}: ${context}`);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.default = ContextCurrent;
|
|
14
14
|
ContextCurrent.description = 'Shows the current context that is being used';
|
|
15
15
|
ContextCurrent.flags = {
|
|
16
|
-
help:
|
|
16
|
+
help: core_1.Flags.help({ char: 'h' })
|
|
17
17
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const base_1 = (0, tslib_1.__importDefault)(require("../../../base"));
|
|
6
|
+
class Context extends base_1.default {
|
|
7
|
+
async run() {
|
|
8
|
+
const Help = await (0, core_1.loadHelpClass)(this.config);
|
|
9
|
+
const help = new Help(this.config);
|
|
10
|
+
help.showHelp(['config', 'context', '--help']);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.default = Context;
|
|
@@ -2,7 +2,7 @@ import Command from '../../../base';
|
|
|
2
2
|
export default class ContextList extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
-
help: import("@oclif/
|
|
5
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
6
|
};
|
|
7
7
|
run(): Promise<void>;
|
|
8
8
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const base_1 = (0, 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() {
|
|
9
|
-
const fileContent = await Context_1.loadContextFile();
|
|
9
|
+
const fileContent = await (0, Context_1.loadContextFile)();
|
|
10
10
|
for (const [contextName, filePath] of Object.entries(fileContent.store)) {
|
|
11
11
|
this.log(`${contextName}: ${filePath}`);
|
|
12
12
|
}
|
|
@@ -15,5 +15,5 @@ class ContextList extends base_1.default {
|
|
|
15
15
|
exports.default = ContextList;
|
|
16
16
|
ContextList.description = 'List all the stored context in the store';
|
|
17
17
|
ContextList.flags = {
|
|
18
|
-
help:
|
|
18
|
+
help: core_1.Flags.help({ char: 'h' })
|
|
19
19
|
};
|
|
@@ -2,7 +2,7 @@ import Command from '../../../base';
|
|
|
2
2
|
export default class ContextRemove extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
-
help: import("@oclif/
|
|
5
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
6
|
};
|
|
7
7
|
static args: {
|
|
8
8
|
name: string;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const base_1 = (0, 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() {
|
|
9
|
-
const { args } = this.parse(ContextRemove);
|
|
9
|
+
const { args } = await this.parse(ContextRemove);
|
|
10
10
|
const contextName = args['context-name'];
|
|
11
11
|
try {
|
|
12
|
-
await Context_1.removeContext(contextName);
|
|
12
|
+
await (0, Context_1.removeContext)(contextName);
|
|
13
13
|
this.log(`${contextName} successfully deleted`);
|
|
14
14
|
}
|
|
15
15
|
catch (err) {
|
|
@@ -20,7 +20,7 @@ class ContextRemove extends base_1.default {
|
|
|
20
20
|
exports.default = ContextRemove;
|
|
21
21
|
ContextRemove.description = 'Delete a context from the store';
|
|
22
22
|
ContextRemove.flags = {
|
|
23
|
-
help:
|
|
23
|
+
help: core_1.Flags.help({ char: 'h' })
|
|
24
24
|
};
|
|
25
25
|
ContextRemove.args = [
|
|
26
26
|
{ name: 'context-name', description: 'Name of the context to delete', required: true }
|
|
@@ -2,7 +2,7 @@ import Command from '../../../base';
|
|
|
2
2
|
export default class ContextUse extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
-
help: import("@oclif/
|
|
5
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
6
|
};
|
|
7
7
|
static args: {
|
|
8
8
|
name: string;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const base_1 = (0, 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() {
|
|
9
|
-
const { args } = this.parse(ContextUse);
|
|
9
|
+
const { args } = await this.parse(ContextUse);
|
|
10
10
|
const contextName = args['context-name'];
|
|
11
|
-
await Context_1.setCurrentContext(contextName);
|
|
11
|
+
await (0, Context_1.setCurrentContext)(contextName);
|
|
12
12
|
this.log(`${contextName} is set as current`);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
exports.default = ContextUse;
|
|
16
16
|
ContextUse.description = 'Set a context as current';
|
|
17
17
|
ContextUse.flags = {
|
|
18
|
-
help:
|
|
18
|
+
help: core_1.Flags.help({ char: 'h' })
|
|
19
19
|
};
|
|
20
20
|
ContextUse.args = [
|
|
21
21
|
{ name: 'context-name', description: 'name of the saved context', required: true }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const base_1 = (0, tslib_1.__importDefault)(require("../../base"));
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
class Config extends base_1.default {
|
|
7
|
+
async run() {
|
|
8
|
+
const Help = await (0, core_1.loadHelpClass)(this.config);
|
|
9
|
+
const help = new Help(this.config);
|
|
10
|
+
help.showHelp(['config', '--help']);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.default = Config;
|
package/lib/commands/diff.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { flags } from '@oclif/command';
|
|
2
1
|
import AsyncAPIDiff from '@asyncapi/diff/lib/asyncapidiff';
|
|
3
2
|
import Command from '../base';
|
|
4
3
|
export default class Diff extends Command {
|
|
5
4
|
static description: string;
|
|
6
5
|
static flags: {
|
|
7
|
-
help: import("@oclif/
|
|
8
|
-
format:
|
|
9
|
-
type:
|
|
10
|
-
overrides:
|
|
11
|
-
watch: import("@oclif/
|
|
6
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
7
|
+
format: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
8
|
+
type: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
9
|
+
overrides: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
10
|
+
watch: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
11
|
};
|
|
13
12
|
static args: {
|
|
14
13
|
name: string;
|
package/lib/commands/diff.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
/* eslint-disable sonarjs/no-duplicate-string */
|
|
5
|
-
const
|
|
6
|
-
const diff = tslib_1.__importStar(require("@asyncapi/diff"));
|
|
7
|
-
const parser = tslib_1.__importStar(require("@asyncapi/parser"));
|
|
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"));
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const SpecificationFile_1 = require("../models/SpecificationFile");
|
|
10
|
-
const base_1 = tslib_1.__importDefault(require("../base"));
|
|
10
|
+
const base_1 = (0, 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");
|
|
@@ -16,7 +16,7 @@ const flags_1 = require("../flags");
|
|
|
16
16
|
const { readFile } = fs_1.promises;
|
|
17
17
|
class Diff extends base_1.default {
|
|
18
18
|
async run() {
|
|
19
|
-
const { args, flags } = this.parse(Diff); // NOSONAR
|
|
19
|
+
const { args, flags } = await this.parse(Diff); // NOSONAR
|
|
20
20
|
const firstDocumentPath = args['old'];
|
|
21
21
|
const secondDocumentPath = args['new'];
|
|
22
22
|
const outputFormat = flags['format'];
|
|
@@ -25,7 +25,7 @@ class Diff extends base_1.default {
|
|
|
25
25
|
const watchMode = flags['watch'];
|
|
26
26
|
let firstDocument, secondDocument;
|
|
27
27
|
try {
|
|
28
|
-
firstDocument = await SpecificationFile_1.load(firstDocumentPath);
|
|
28
|
+
firstDocument = await (0, SpecificationFile_1.load)(firstDocumentPath);
|
|
29
29
|
enableWatch(watchMode, { spec: firstDocument, handler: this, handlerName: 'diff', docVersion: 'old', label: 'DIFF_OLD' });
|
|
30
30
|
}
|
|
31
31
|
catch (err) {
|
|
@@ -40,7 +40,7 @@ class Diff extends base_1.default {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
try {
|
|
43
|
-
secondDocument = await SpecificationFile_1.load(secondDocumentPath);
|
|
43
|
+
secondDocument = await (0, SpecificationFile_1.load)(secondDocumentPath);
|
|
44
44
|
enableWatch(watchMode, { spec: secondDocument, handler: this, handlerName: 'diff', docVersion: 'new', label: 'DIFF_NEW' });
|
|
45
45
|
}
|
|
46
46
|
catch (err) {
|
|
@@ -104,20 +104,20 @@ class Diff extends base_1.default {
|
|
|
104
104
|
exports.default = Diff;
|
|
105
105
|
Diff.description = 'find diff between two asyncapi files';
|
|
106
106
|
Diff.flags = {
|
|
107
|
-
help:
|
|
108
|
-
format:
|
|
107
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
108
|
+
format: core_1.Flags.string({
|
|
109
109
|
char: 'f',
|
|
110
110
|
description: 'format of the output',
|
|
111
111
|
default: 'json',
|
|
112
112
|
options: ['json'],
|
|
113
113
|
}),
|
|
114
|
-
type:
|
|
114
|
+
type: core_1.Flags.string({
|
|
115
115
|
char: 't',
|
|
116
116
|
description: 'type of the output',
|
|
117
117
|
default: 'all',
|
|
118
118
|
options: ['breaking', 'non-breaking', 'unclassified', 'all'],
|
|
119
119
|
}),
|
|
120
|
-
overrides:
|
|
120
|
+
overrides: core_1.Flags.string({
|
|
121
121
|
char: 'o',
|
|
122
122
|
description: 'path to JSON file containing the override properties',
|
|
123
123
|
}),
|
|
@@ -161,6 +161,6 @@ async function readOverrideFile(path) {
|
|
|
161
161
|
*/
|
|
162
162
|
const enableWatch = (status, watcher) => {
|
|
163
163
|
if (status) {
|
|
164
|
-
globals_1.specWatcher(watcher);
|
|
164
|
+
(0, globals_1.specWatcher)(watcher);
|
|
165
165
|
}
|
|
166
166
|
};
|
package/lib/commands/new.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { flags } from '@oclif/command';
|
|
2
1
|
import Command from '../base';
|
|
3
2
|
export default class New extends Command {
|
|
4
3
|
static description: string;
|
|
5
4
|
static flags: {
|
|
6
|
-
help: import("@oclif/
|
|
7
|
-
'file-name':
|
|
8
|
-
example:
|
|
9
|
-
studio: import("@oclif/
|
|
10
|
-
port: import("@oclif/
|
|
11
|
-
'no-tty': import("@oclif/
|
|
5
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
|
+
'file-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
+
example: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
8
|
+
studio: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
port: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
|
|
10
|
+
'no-tty': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
11
|
};
|
|
13
12
|
static args: never[];
|
|
14
13
|
run(): Promise<void>;
|
package/lib/commands/new.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
4
5
|
const fs_1 = require("fs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const inquirer = tslib_1.__importStar(require("inquirer"));
|
|
6
|
+
const base_1 = (0, tslib_1.__importDefault)(require("../base"));
|
|
7
|
+
const inquirer = (0, 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;
|
|
@@ -12,17 +12,17 @@ const DEFAULT_ASYNCAPI_FILE_NAME = 'asyncapi.yaml';
|
|
|
12
12
|
const DEFAULT_ASYNCAPI_TEMPLATE = 'default-example.yaml';
|
|
13
13
|
class New extends base_1.default {
|
|
14
14
|
async run() {
|
|
15
|
-
const { flags } = this.parse(New); // NOSONAR
|
|
15
|
+
const { flags } = await this.parse(New); // NOSONAR
|
|
16
16
|
const isTTY = process.stdout.isTTY;
|
|
17
17
|
if (!flags['no-tty'] && isTTY) {
|
|
18
18
|
return this.runInteractive();
|
|
19
19
|
}
|
|
20
20
|
const fileName = flags['file-name'] || DEFAULT_ASYNCAPI_FILE_NAME;
|
|
21
21
|
const template = flags['example'] || DEFAULT_ASYNCAPI_TEMPLATE;
|
|
22
|
-
this.createAsyncapiFile(fileName, template);
|
|
22
|
+
await this.createAsyncapiFile(fileName, template);
|
|
23
23
|
if (flags.studio) {
|
|
24
24
|
if (isTTY) {
|
|
25
|
-
Studio_1.start(fileName, flags.port || Studio_1.DEFAULT_PORT);
|
|
25
|
+
(0, Studio_1.start)(fileName, flags.port || Studio_1.DEFAULT_PORT);
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
28
|
this.warn('Warning: --studio flag was passed but the terminal is not interactive. Ignoring...');
|
|
@@ -31,7 +31,7 @@ class New extends base_1.default {
|
|
|
31
31
|
}
|
|
32
32
|
/* eslint-disable sonarjs/cognitive-complexity */
|
|
33
33
|
async runInteractive() {
|
|
34
|
-
const { flags } = this.parse(New); // NOSONAR
|
|
34
|
+
const { flags } = await this.parse(New); // NOSONAR
|
|
35
35
|
let fileName = flags['file-name'];
|
|
36
36
|
let selectedTemplate = flags['example'];
|
|
37
37
|
let openStudio = flags.studio;
|
|
@@ -46,7 +46,7 @@ class New extends base_1.default {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
try {
|
|
49
|
-
const exampleFiles = await readFile(path_1.resolve(__dirname, '../../assets/examples/examples.json'), { encoding: 'utf8' });
|
|
49
|
+
const exampleFiles = await readFile((0, path_1.resolve)(__dirname, '../../assets/examples/examples.json'), { encoding: 'utf8' });
|
|
50
50
|
examples = JSON.parse(exampleFiles);
|
|
51
51
|
}
|
|
52
52
|
catch (error) {
|
|
@@ -93,11 +93,11 @@ class New extends base_1.default {
|
|
|
93
93
|
selectedTemplate = selectedTemplate || DEFAULT_ASYNCAPI_TEMPLATE;
|
|
94
94
|
await this.createAsyncapiFile(fileName, selectedTemplate);
|
|
95
95
|
if (openStudio) {
|
|
96
|
-
Studio_1.start(fileName, flags.port || Studio_1.DEFAULT_PORT);
|
|
96
|
+
(0, Studio_1.start)(fileName, flags.port || Studio_1.DEFAULT_PORT);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
async createAsyncapiFile(fileName, selectedTemplate) {
|
|
100
|
-
const asyncApiFile = await readFile(path_1.resolve(__dirname, '../../assets/examples/', selectedTemplate), { encoding: 'utf8' });
|
|
100
|
+
const asyncApiFile = await readFile((0, path_1.resolve)(__dirname, '../../assets/examples/', selectedTemplate), { encoding: 'utf8' });
|
|
101
101
|
const fileNameHasFileExtension = fileName.includes('.');
|
|
102
102
|
const fileNameToWriteToDisk = fileNameHasFileExtension ? fileName : `${fileName}.yaml`;
|
|
103
103
|
try {
|
|
@@ -117,11 +117,11 @@ class New extends base_1.default {
|
|
|
117
117
|
exports.default = New;
|
|
118
118
|
New.description = 'creates a new asyncapi file';
|
|
119
119
|
New.flags = {
|
|
120
|
-
help:
|
|
121
|
-
'file-name':
|
|
122
|
-
example:
|
|
123
|
-
studio:
|
|
124
|
-
port:
|
|
125
|
-
'no-tty':
|
|
120
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
121
|
+
'file-name': core_1.Flags.string({ char: 'n', description: 'name of the file' }),
|
|
122
|
+
example: core_1.Flags.string({ char: 'e', description: 'name of the example to use' }),
|
|
123
|
+
studio: core_1.Flags.boolean({ char: 's', description: 'open in Studio' }),
|
|
124
|
+
port: core_1.Flags.integer({ char: 'p', description: 'port in which to start Studio' }),
|
|
125
|
+
'no-tty': core_1.Flags.boolean({ description: 'do not use an interactive terminal' }),
|
|
126
126
|
};
|
|
127
127
|
New.args = [];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const base_1 = (0, tslib_1.__importDefault)(require("../../base"));
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
class Start extends base_1.default {
|
|
7
|
+
async run() {
|
|
8
|
+
const Help = await (0, core_1.loadHelpClass)(this.config);
|
|
9
|
+
const help = new Help(this.config);
|
|
10
|
+
help.showHelp(['start', '--help']);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.default = Start;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { flags } from '@oclif/command';
|
|
2
1
|
import Command from '../../base';
|
|
3
2
|
export default class StartStudio extends Command {
|
|
4
3
|
static description: string;
|
|
5
4
|
static flags: {
|
|
6
|
-
help: import("@oclif/
|
|
7
|
-
file:
|
|
8
|
-
port: import("@oclif/
|
|
5
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
|
+
file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
+
port: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
|
|
9
8
|
};
|
|
10
9
|
static args: never[];
|
|
11
10
|
run(): Promise<void>;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const base_1 = (0, 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 {
|
|
9
9
|
async run() {
|
|
10
|
-
const { flags } = this.parse(StartStudio);
|
|
11
|
-
const filePath = flags.file || (await SpecificationFile_1.load()).getFilePath();
|
|
10
|
+
const { flags } = await this.parse(StartStudio);
|
|
11
|
+
const filePath = flags.file || (await (0, SpecificationFile_1.load)()).getFilePath();
|
|
12
12
|
const port = flags.port;
|
|
13
|
-
Studio_1.start(filePath, port);
|
|
13
|
+
(0, Studio_1.start)(filePath, port);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.default = StartStudio;
|
|
17
17
|
StartStudio.description = 'starts a new local instance of Studio';
|
|
18
18
|
StartStudio.flags = {
|
|
19
|
-
help:
|
|
20
|
-
file:
|
|
21
|
-
port:
|
|
19
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
20
|
+
file: core_1.Flags.string({ char: 'f', description: 'path to the AsyncAPI file to link with Studio' }),
|
|
21
|
+
port: core_1.Flags.integer({ char: 'p', description: 'port in which to start Studio' }),
|
|
22
22
|
};
|
|
23
23
|
StartStudio.args = [];
|
|
@@ -2,8 +2,8 @@ import Command from '../base';
|
|
|
2
2
|
export default class Validate extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
-
help: import("@oclif/
|
|
6
|
-
watch: import("@oclif/
|
|
5
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
|
+
watch: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
};
|
|
8
8
|
static args: {
|
|
9
9
|
name: string;
|
package/lib/commands/validate.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
-
const parser = tslib_1.__importStar(require("@asyncapi/parser"));
|
|
6
|
-
const base_1 = tslib_1.__importDefault(require("../base"));
|
|
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"));
|
|
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");
|
|
10
10
|
const flags_1 = require("../flags");
|
|
11
11
|
class Validate extends base_1.default {
|
|
12
12
|
async run() {
|
|
13
|
-
const { args, flags } = this.parse(Validate); //
|
|
13
|
+
const { args, flags } = await this.parse(Validate); //NOSONAR
|
|
14
14
|
const filePath = args['spec-file'];
|
|
15
15
|
const watchMode = flags['watch'];
|
|
16
|
-
const specFile = await SpecificationFile_1.load(filePath);
|
|
16
|
+
const specFile = await (0, SpecificationFile_1.load)(filePath);
|
|
17
17
|
if (watchMode) {
|
|
18
|
-
globals_1.specWatcher({ spec: specFile, handler: this, handlerName: 'validate' });
|
|
18
|
+
(0, globals_1.specWatcher)({ spec: specFile, handler: this, handlerName: 'validate' });
|
|
19
19
|
}
|
|
20
20
|
try {
|
|
21
21
|
if (specFile.getFilePath()) {
|
|
@@ -38,7 +38,7 @@ class Validate extends base_1.default {
|
|
|
38
38
|
exports.default = Validate;
|
|
39
39
|
Validate.description = 'validate asyncapi file';
|
|
40
40
|
Validate.flags = {
|
|
41
|
-
help:
|
|
41
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
42
42
|
watch: flags_1.watchFlag
|
|
43
43
|
};
|
|
44
44
|
Validate.args = [
|
package/lib/flags.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const watchFlag: import("@oclif/
|
|
1
|
+
export declare const watchFlag: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
package/lib/flags.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.watchFlag = void 0;
|
|
4
|
-
const
|
|
5
|
-
exports.watchFlag =
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
exports.watchFlag = core_1.Flags.boolean({
|
|
6
6
|
char: 'w',
|
|
7
7
|
description: 'Enable watch mode'
|
|
8
8
|
});
|
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 = tslib_1.__importDefault(require("chokidar"));
|
|
6
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
5
|
+
const chokidar_1 = (0, tslib_1.__importDefault)(require("chokidar"));
|
|
6
|
+
const chalk_1 = (0, 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 = {
|
|
@@ -15,7 +15,7 @@ const WATCH_MESSAGES = {
|
|
|
15
15
|
logOnAutoDisable: (docVersion = '') => console.log(OrangeLog(`Watch mode for ${docVersion || 'AsyncAPI'} file was not enabled.`), OrangeLog('\nINFO: Watch works only with files from local file system\n'))
|
|
16
16
|
};
|
|
17
17
|
const CHOKIDAR_INSTANCE_STORE = new Map();
|
|
18
|
-
|
|
18
|
+
const specWatcher = (params) => {
|
|
19
19
|
if (!params.spec.getFilePath()) {
|
|
20
20
|
return WATCH_MESSAGES.logOnAutoDisable(params.docVersion);
|
|
21
21
|
}
|
|
@@ -42,3 +42,4 @@ exports.specWatcher = (params) => {
|
|
|
42
42
|
console.log(error);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
+
exports.specWatcher = specWatcher;
|
package/lib/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { run } from '@oclif/
|
|
1
|
+
export { run } from '@oclif/core';
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
exports.run = void 0;
|
|
4
|
+
var core_1 = require("@oclif/core");
|
|
5
|
+
Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
|
package/lib/models/Context.js
CHANGED
|
@@ -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 = tslib_1.__importStar(require("path"));
|
|
7
|
-
const os = tslib_1.__importStar(require("os"));
|
|
6
|
+
const path = (0, tslib_1.__importStar)(require("path"));
|
|
7
|
+
const os = (0, 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 = tslib_1.__importStar(require("path"));
|
|
7
|
-
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
6
|
+
const path = (0, tslib_1.__importStar)(require("path"));
|
|
7
|
+
const node_fetch_1 = (0, 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");
|
|
@@ -45,7 +45,7 @@ class Specification {
|
|
|
45
45
|
static async fromURL(URLpath) {
|
|
46
46
|
let response;
|
|
47
47
|
try {
|
|
48
|
-
response = await node_fetch_1.default(URLpath, { method: 'GET' });
|
|
48
|
+
response = await (0, node_fetch_1.default)(URLpath, { method: 'GET' });
|
|
49
49
|
if (!response.ok) {
|
|
50
50
|
throw new specification_file_1.ErrorLoadingSpec('url', URLpath);
|
|
51
51
|
}
|
|
@@ -148,7 +148,7 @@ async function fileExists(name) {
|
|
|
148
148
|
exports.fileExists = fileExists;
|
|
149
149
|
async function loadFromContext(contextName) {
|
|
150
150
|
try {
|
|
151
|
-
const context = await Context_1.loadContext(contextName);
|
|
151
|
+
const context = await (0, Context_1.loadContext)(contextName);
|
|
152
152
|
return Specification.fromFile(context);
|
|
153
153
|
}
|
|
154
154
|
catch (error) {
|
package/lib/models/Studio.js
CHANGED
|
@@ -5,10 +5,10 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const http_1 = require("http");
|
|
8
|
-
const serve_handler_1 = tslib_1.__importDefault(require("serve-handler"));
|
|
8
|
+
const serve_handler_1 = (0, tslib_1.__importDefault)(require("serve-handler"));
|
|
9
9
|
const ws_1 = require("ws");
|
|
10
|
-
const chokidar_1 = tslib_1.__importDefault(require("chokidar"));
|
|
11
|
-
const open_1 = tslib_1.__importDefault(require("open"));
|
|
10
|
+
const chokidar_1 = (0, tslib_1.__importDefault)(require("chokidar"));
|
|
11
|
+
const open_1 = (0, tslib_1.__importDefault)(require("open"));
|
|
12
12
|
const { readFile, writeFile } = fs_1.promises;
|
|
13
13
|
const sockets = [];
|
|
14
14
|
const messageQueue = [];
|
|
@@ -35,9 +35,9 @@ function start(filePath, port = exports.DEFAULT_PORT) {
|
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
const server = http_1.createServer((request, response) => {
|
|
39
|
-
return serve_handler_1.default(request, response, {
|
|
40
|
-
public: path_1.resolve(__dirname, '../../node_modules/@asyncapi/studio/build'),
|
|
38
|
+
const server = (0, http_1.createServer)((request, response) => {
|
|
39
|
+
return (0, serve_handler_1.default)(request, response, {
|
|
40
|
+
public: (0, path_1.resolve)(__dirname, '../../node_modules/@asyncapi/studio/build'),
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
43
|
server.on('upgrade', (request, socket, head) => {
|
|
@@ -83,7 +83,7 @@ function start(filePath, port = exports.DEFAULT_PORT) {
|
|
|
83
83
|
const url = `http://localhost:${port}?liveServer=${port}`;
|
|
84
84
|
console.log(`Studio is running at ${url}`);
|
|
85
85
|
console.log(`Watching changes on file ${filePath}`);
|
|
86
|
-
open_1.default(url);
|
|
86
|
+
(0, open_1.default)(url);
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
exports.start = start;
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.
|
|
1
|
+
{"version":"0.16.0","commands":{"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"],"default":"json"},"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":{}}}}
|
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": "0.
|
|
4
|
+
"version": "0.16.0",
|
|
5
5
|
"author": "@asyncapi",
|
|
6
6
|
"bin": {
|
|
7
7
|
"asyncapi": "./bin/run"
|
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@asyncapi/diff": "^0.3.0",
|
|
12
12
|
"@asyncapi/parser": "^1.14.0",
|
|
13
|
-
"@asyncapi/studio": "^0.
|
|
14
|
-
"@
|
|
15
|
-
"@oclif/
|
|
16
|
-
"@oclif/config": "^1.17.0",
|
|
13
|
+
"@asyncapi/studio": "^0.10.0",
|
|
14
|
+
"@oclif/core": "^1.2.0",
|
|
15
|
+
"@oclif/plugin-not-found": "^2.3.1",
|
|
17
16
|
"@types/inquirer": "^8.1.3",
|
|
18
17
|
"@types/ws": "^8.2.0",
|
|
19
18
|
"chalk": "^4.1.0",
|
|
@@ -27,14 +26,12 @@
|
|
|
27
26
|
"request": "^2.88.2",
|
|
28
27
|
"serve-handler": "^6.1.3",
|
|
29
28
|
"strip-ansi": "^6.0.0",
|
|
30
|
-
"tslib": "^1.14.1",
|
|
31
29
|
"unzipper": "^0.10.11",
|
|
32
30
|
"wrap-ansi": "^4.0.0",
|
|
33
31
|
"ws": "^8.2.3"
|
|
34
32
|
},
|
|
35
33
|
"devDependencies": {
|
|
36
|
-
"@oclif/
|
|
37
|
-
"@oclif/test": "^1.2.8",
|
|
34
|
+
"@oclif/test": "^2",
|
|
38
35
|
"@semantic-release/commit-analyzer": "^8.0.1",
|
|
39
36
|
"@semantic-release/github": "^7.2.3",
|
|
40
37
|
"@semantic-release/npm": "^7.1.3",
|
|
@@ -49,7 +46,7 @@
|
|
|
49
46
|
"@typescript-eslint/eslint-plugin": "^4.28.4",
|
|
50
47
|
"@typescript-eslint/parser": "^4.28.4",
|
|
51
48
|
"acorn": "^8.5.0",
|
|
52
|
-
"chai": "^4
|
|
49
|
+
"chai": "^4",
|
|
53
50
|
"conventional-changelog-conventionalcommits": "^4.4.0",
|
|
54
51
|
"cross-env": "^7.0.3",
|
|
55
52
|
"eslint": "^7.31.0",
|
|
@@ -60,13 +57,14 @@
|
|
|
60
57
|
"eslint-plugin-sonarjs": "^0.10.0",
|
|
61
58
|
"globby": "^10.0.2",
|
|
62
59
|
"markdown-toc": "^1.2.0",
|
|
63
|
-
"mocha": "^
|
|
60
|
+
"mocha": "^9",
|
|
64
61
|
"nyc": "^14.1.1",
|
|
65
|
-
"oclif": "^1.18.1",
|
|
66
62
|
"rimraf": "^3.0.2",
|
|
67
63
|
"semantic-release": "^17.4.3",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
64
|
+
"souvikns-oclif": "^2.5.0",
|
|
65
|
+
"ts-node": "^10.4.0",
|
|
66
|
+
"tslib": "^2.3.1",
|
|
67
|
+
"typescript": "^4.4.3"
|
|
70
68
|
},
|
|
71
69
|
"engines": {
|
|
72
70
|
"node": ">12.16"
|
|
@@ -88,8 +86,13 @@
|
|
|
88
86
|
"commands": "./lib/commands",
|
|
89
87
|
"bin": "asyncapi",
|
|
90
88
|
"plugins": [
|
|
91
|
-
"@
|
|
92
|
-
]
|
|
89
|
+
"@oclif/plugin-not-found"
|
|
90
|
+
],
|
|
91
|
+
"topicSeparator": " ",
|
|
92
|
+
"topics": {
|
|
93
|
+
"config:context": {},
|
|
94
|
+
"config": {}
|
|
95
|
+
}
|
|
93
96
|
},
|
|
94
97
|
"publishConfig": {
|
|
95
98
|
"access": "public"
|
|
@@ -120,7 +123,7 @@
|
|
|
120
123
|
},
|
|
121
124
|
"repository": "asyncapi/cli",
|
|
122
125
|
"scripts": {
|
|
123
|
-
"build": "node scripts/fetch-asyncapi-example.js && tsc",
|
|
126
|
+
"build": "rimraf lib && node scripts/fetch-asyncapi-example.js && tsc && echo \"Build Completed\"",
|
|
124
127
|
"bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION",
|
|
125
128
|
"dev": "tsc --watch",
|
|
126
129
|
"generate:assets": "npm run generate:readme:toc",
|
|
@@ -128,15 +131,11 @@
|
|
|
128
131
|
"lint": "eslint --max-warnings 0 --config .eslintrc .",
|
|
129
132
|
"lint:fix": "eslint --max-warnings 5 --config .eslintrc . --fix",
|
|
130
133
|
"postpack": "rimraf oclif.manifest.json",
|
|
131
|
-
"
|
|
132
|
-
"prepublishOnly": "npm run build",
|
|
134
|
+
"prepublishOnly": "npm run build && oclif manifest",
|
|
133
135
|
"pretest": "npm run build",
|
|
134
136
|
"pretest:coverage": "npm run build",
|
|
135
137
|
"release": "semantic-release",
|
|
136
|
-
"
|
|
137
|
-
"test": "cross-env TEST=1 CONTEXT_FILENAME=\"./test.asyncapi\" CONTEXT_FILE_PATH=\"./\" nyc --extension .ts mocha --require ts-node/register --reporter spec --timeout 10000 \"test/**/*.test.ts\"",
|
|
138
|
-
"version": "oclif-dev readme && git add README.md",
|
|
139
|
-
"readme": "oclif readme"
|
|
138
|
+
"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\""
|
|
140
139
|
},
|
|
141
140
|
"types": "lib/index.d.ts"
|
|
142
141
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const command_1 = require("@oclif/command");
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
6
|
-
class ConfigContext extends base_1.default {
|
|
7
|
-
async run() {
|
|
8
|
-
await this._help();
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.default = ConfigContext;
|
|
12
|
-
ConfigContext.flags = {
|
|
13
|
-
help: command_1.flags.help({ char: 'h' })
|
|
14
|
-
};
|
package/lib/commands/config.d.ts
DELETED
package/lib/commands/config.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Config = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const command_1 = require("@oclif/command");
|
|
6
|
-
const base_1 = tslib_1.__importDefault(require("../base"));
|
|
7
|
-
class Config extends base_1.default {
|
|
8
|
-
async run() {
|
|
9
|
-
await this._help();
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.Config = Config;
|
|
13
|
-
Config.description = 'access configs';
|
|
14
|
-
Config.flags = {
|
|
15
|
-
help: command_1.flags.help({ char: 'h' })
|
|
16
|
-
};
|
package/lib/commands/start.d.ts
DELETED
package/lib/commands/start.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Start = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const command_1 = require("@oclif/command");
|
|
6
|
-
const base_1 = tslib_1.__importDefault(require("../base"));
|
|
7
|
-
class Start extends base_1.default {
|
|
8
|
-
async run() {
|
|
9
|
-
this._help();
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.Start = Start;
|
|
13
|
-
Start.description = 'starts a new local instance of Studio';
|
|
14
|
-
Start.flags = {
|
|
15
|
-
help: command_1.flags.help({ char: 'h' })
|
|
16
|
-
};
|