Skip to content

Commit dec8062

Browse files
authored
chore: improve performance (#1941)
1 parent f92ec30 commit dec8062

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

jest.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ module.exports = {
1818
lines: 84,
1919
},
2020
'packages/cli/': {
21-
statements: 64,
21+
statements: 63,
2222
branches: 51,
23-
functions: 63,
24-
lines: 64,
23+
functions: 62,
24+
lines: 63,
2525
},
2626
'packages/respect-core/': {
2727
statements: 79,

packages/cli/src/utils/miscellaneous.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ import { deprecatedRefDocsSchema } from '@redocly/config/lib/reference-docs-conf
2929
import { outputExtensions } from '../types';
3030
import { version } from './update-version-notifier';
3131
import { DESTINATION_REGEX } from '../commands/push';
32-
import { RedoclyOAuthClient } from '../auth/oauth-client';
3332
import { getReuniteUrl } from '../reunite/api';
34-
import { otelTelemetry } from '../otel';
3533

3634
import type { Arguments } from 'yargs';
3735
import type {
@@ -549,8 +547,6 @@ export function cleanColors(input: string): string {
549547
return input.replace(/\x1b\[\d+m/g, '');
550548
}
551549

552-
otelTelemetry.init();
553-
554550
export async function sendTelemetry(
555551
argv: Arguments | undefined,
556552
exit_code: ExitCode,
@@ -570,6 +566,7 @@ export async function sendTelemetry(
570566
} = argv;
571567
const event_time = new Date().toISOString();
572568
const redoclyClient = new RedoclyClient();
569+
const { RedoclyOAuthClient } = await import('../auth/oauth-client');
573570
const oauthClient = new RedoclyOAuthClient('redocly-cli', version);
574571
const reuniteUrl = getReuniteUrl(argv.residency as string | undefined);
575572
const logged_in = redoclyClient.hasTokens() || (await oauthClient.isAuthorized(reuniteUrl));
@@ -592,6 +589,8 @@ export async function sendTelemetry(
592589
spec_keyword,
593590
spec_full_version,
594591
};
592+
const { otelTelemetry } = await import('../otel');
593+
otelTelemetry.init();
595594
otelTelemetry.send(data.command, data);
596595
} catch (err) {
597596
// Do nothing.

0 commit comments

Comments
 (0)