@asyncapi/cli 0.44.2 → 0.45.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.
@@ -0,0 +1,8 @@
1
+ import Command from '../../base';
2
+ export default class Versions extends Command {
3
+ static description: string;
4
+ static flags: {
5
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
6
+ };
7
+ run(): Promise<void>;
8
+ }
@@ -0,0 +1,57 @@
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 = tslib_1.__importDefault(require("../../base"));
6
+ class Versions extends base_1.default {
7
+ run() {
8
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+ const dependencies = [];
10
+ let dependency = '';
11
+ // Preparation of the array with all dependencies '@asyncapi/*' along with
12
+ // their versions.
13
+ for (const key in this.config.pjson.dependencies) {
14
+ // Making sure with .indexOf() that only package names which START with
15
+ // string '@asyncapi' are considered.
16
+ if (key.indexOf('@asyncapi', 0) === 0) {
17
+ // Avoiding obvious crash on manual removal or alteration of an
18
+ // '@asyncapi' package.
19
+ try {
20
+ // Goofy name `importedPJSON` is chosen to distinguish from name `pjson`
21
+ // used in `@oclif` source code.
22
+ const importedPJSON = yield Promise.resolve().then(() => tslib_1.__importStar(require(`${key}/package.json`)));
23
+ dependencies.push(`${key}/${importedPJSON.default.version}`);
24
+ }
25
+ catch (e) {
26
+ dependencies.push(`${key}/` + '`package.json` not found');
27
+ }
28
+ }
29
+ }
30
+ // Showing information available with `--version` flag.
31
+ this.log(this.config.userAgent);
32
+ // Iteration through the array containing all dependencies '@asyncapi/*'
33
+ // along with their versions.
34
+ for (let i = 0; i < dependencies.length; i++) {
35
+ // Minimization of the theoretical possibility of a Generic Object
36
+ // Injection Sink, at the same time disabling eslint parsing for this
37
+ // line since it is actually a false positive.
38
+ // https://github.com/eslint-community/eslint-plugin-security/issues/21#issuecomment-530184612
39
+ // https://github.com/eslint-community/eslint-plugin-security/issues/21#issuecomment-1157887653
40
+ // https://web.archive.org/web/20150430062816/https://blog.liftsecurity.io/2015/01/15/the-dangers-of-square-bracket-notation
41
+ dependency = dependencies[i]; // eslint-disable-line
42
+ if (i !== dependencies.length - 1) {
43
+ this.log(` ├${dependency}`);
44
+ }
45
+ else {
46
+ this.log(` └${dependency}\n`);
47
+ }
48
+ }
49
+ this.log(`Repository: ${this.config.pjson.homepage}`);
50
+ });
51
+ }
52
+ }
53
+ exports.default = Versions;
54
+ Versions.description = 'Show versions of AsyncAPI tools used';
55
+ Versions.flags = {
56
+ help: core_1.Flags.help({ char: 'h' }),
57
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.44.2",
2
+ "version": "0.45.0",
3
3
  "commands": {
4
4
  "bundle": {
5
5
  "id": "bundle",
@@ -342,6 +342,25 @@
342
342
  "flags": {},
343
343
  "args": {}
344
344
  },
345
+ "config:versions": {
346
+ "id": "config:versions",
347
+ "description": "Show versions of AsyncAPI tools used",
348
+ "strict": true,
349
+ "pluginName": "@asyncapi/cli",
350
+ "pluginAlias": "@asyncapi/cli",
351
+ "pluginType": "core",
352
+ "aliases": [],
353
+ "flags": {
354
+ "help": {
355
+ "name": "help",
356
+ "type": "boolean",
357
+ "char": "h",
358
+ "description": "Show CLI help.",
359
+ "allowNo": false
360
+ }
361
+ },
362
+ "args": {}
363
+ },
345
364
  "generate:fromTemplate": {
346
365
  "id": "generate:fromTemplate",
347
366
  "description": "Generates whatever you want using templates compatible with AsyncAPI Generator.",
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.44.2",
4
+ "version": "0.45.0",
5
5
  "author": "@asyncapi",
6
6
  "bin": {
7
7
  "asyncapi": "./bin/run"