From 2ab08d4dc5de6c61cd23db681f41dcc8e69ebd33 Mon Sep 17 00:00:00 2001 From: Pedro Ramos Date: Thu, 16 May 2024 19:50:09 +0200 Subject: [PATCH 1/5] Add metadata for 'config analytics' command --- src/commands/config/analytics.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/commands/config/analytics.ts b/src/commands/config/analytics.ts index b8cb1303fbf..0d1b72928af 100644 --- a/src/commands/config/analytics.ts +++ b/src/commands/config/analytics.ts @@ -26,9 +26,11 @@ export default class Analytics extends Command { if (flags.disable) { analyticsConfigFileContent.analyticsEnabled = 'false'; this.log('\nAnalytics disabled.\n'); + this.metricsMetadata.analytics_disabled = flags.disable; } else if (flags.enable) { analyticsConfigFileContent.analyticsEnabled = 'true'; this.log('\nAnalytics enabled.\n'); + this.metricsMetadata.analytics_enabled = flags.enable; } else if (!flags.status) { this.log('\nPlease append the "--disable" flag to the command in case you prefer to disable analytics, or use the "--enable" flag if you want to enable analytics back again. In case you do not know the analytics current status, then you can append the "--status" flag to be aware of it.\n'); return; @@ -41,6 +43,7 @@ export default class Analytics extends Command { } else { this.log('\nAnalytics are disabled. Please append the "--enable" flag to the command in case you prefer to enable analytics.\n'); } + this.metricsMetadata.analytics_status_check = flags.status; } } catch (e: any) { switch (e.code) { From 911fcad7e2587a61e067a299bca0043d1461805c Mon Sep 17 00:00:00 2001 From: Pedro Ramos Date: Tue, 21 May 2024 18:34:36 +0200 Subject: [PATCH 2/5] Add metadata for 'start studio' command --- src/commands/config/analytics.ts | 2 +- src/commands/start/studio.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/commands/config/analytics.ts b/src/commands/config/analytics.ts index 0d1b72928af..e4e55c4a500 100644 --- a/src/commands/config/analytics.ts +++ b/src/commands/config/analytics.ts @@ -43,7 +43,7 @@ export default class Analytics extends Command { } else { this.log('\nAnalytics are disabled. Please append the "--enable" flag to the command in case you prefer to enable analytics.\n'); } - this.metricsMetadata.analytics_status_check = flags.status; + this.metricsMetadata.analytics_status_checked = flags.status; } } catch (e: any) { switch (e.code) { diff --git a/src/commands/start/studio.ts b/src/commands/start/studio.ts index 72865b403f8..1c459f06195 100644 --- a/src/commands/start/studio.ts +++ b/src/commands/start/studio.ts @@ -16,6 +16,9 @@ export default class StartStudio extends Command { const { flags } = await this.parse(StartStudio); const filePath = flags.file || (await load()).getFilePath(); const port = flags.port; + + this.specFile = await load(filePath); + this.metricsMetadata.port = port; startStudio(filePath as string, port); } From b2a697631606d45a19bdb7c454fa526f3403e033 Mon Sep 17 00:00:00 2001 From: Pedro Ramos Date: Wed, 22 May 2024 21:17:13 +0200 Subject: [PATCH 3/5] Add metadata for 'new glee' command --- src/commands/new/glee.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/commands/new/glee.ts b/src/commands/new/glee.ts index f717ac7ced6..019f29be50f 100644 --- a/src/commands/new/glee.ts +++ b/src/commands/new/glee.ts @@ -10,6 +10,7 @@ import { prompt } from 'inquirer'; // @ts-ignore import Generator from '@asyncapi/generator'; import { cyan, gray } from 'picocolors'; +import template from 'lodash.template'; export const successMessage = (projectName: string) => `🎉 Your Glee project has been successfully created! @@ -213,6 +214,8 @@ export default class NewGlee extends Command { projectName, forceWrite ); + this.specFile = await load(flags.file); + this.metricsMetadata.template = flags.template; } else { try { await fPromises.mkdir(PROJECT_DIRECTORY); @@ -258,6 +261,8 @@ export default class NewGlee extends Command { `Unable to create the project. Please check the following message for further info about the error:\n\n${err}` ); } + this.specFile = await load(`${GLEE_TEMPLATES_DIRECTORY}/asyncapi.yaml`); + this.metricsMetadata.template = flags.template; } } } From 3b8ebdbda8d397b2c45b2fcd30f660f254d531a0 Mon Sep 17 00:00:00 2001 From: Pedro Ramos Date: Wed, 22 May 2024 21:20:26 +0200 Subject: [PATCH 4/5] Remove unnecessary 'import' --- src/commands/new/glee.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/commands/new/glee.ts b/src/commands/new/glee.ts index 019f29be50f..107fb55e631 100644 --- a/src/commands/new/glee.ts +++ b/src/commands/new/glee.ts @@ -10,7 +10,6 @@ import { prompt } from 'inquirer'; // @ts-ignore import Generator from '@asyncapi/generator'; import { cyan, gray } from 'picocolors'; -import template from 'lodash.template'; export const successMessage = (projectName: string) => `🎉 Your Glee project has been successfully created! From 525249ab3b83a805e2e3ab23a357d02530c2fe4b Mon Sep 17 00:00:00 2001 From: Pedro Ramos Date: Wed, 22 May 2024 22:36:18 +0200 Subject: [PATCH 5/5] Add metadata for 'diff' command --- src/commands/diff.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/commands/diff.ts b/src/commands/diff.ts index 009e00911e9..078825f56cb 100644 --- a/src/commands/diff.ts +++ b/src/commands/diff.ts @@ -76,6 +76,12 @@ export default class Diff extends Command { checkAndWarnFalseFlag(outputFormat, markdownSubtype); markdownSubtype = setDefaultMarkdownSubtype(outputFormat, markdownSubtype) as string; + this.metricsMetadata.output_format = outputFormat; + this.metricsMetadata.output_type = outputType; + if (outputFormat === 'md') { + this.metricsMetadata.output_markdown_subtype = flags['markdownSubtype']; + } + try { firstDocument = await load(firstDocumentPath);