Skip to content

Commit 575dbfc

Browse files
committed
Build: Add dev/build telemetry
1 parent bec5edf commit 575dbfc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/react-native/src/metro/withStorybook.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import * as path from 'path';
22
import { generate } from '../../scripts/generate';
33
import { WebSocketServer, WebSocket, Data } from 'ws';
44
import type { MetroConfig } from 'metro-config';
5+
import { optionalEnvToBoolean } from 'storybook/internal/common';
6+
import { telemetry } from 'storybook/internal/telemetry';
57

68
/**
79
* Options for configuring WebSockets used for syncing storybook instances or sending events to storybook.
@@ -106,6 +108,14 @@ function withStorybook(
106108
liteMode = false,
107109
} = options;
108110

111+
const disableTelemetry = optionalEnvToBoolean(process.env.STORYBOOK_DISABLE_TELEMETRY);
112+
113+
if (!disableTelemetry && enabled) {
114+
const event = process.env.NODE_ENV === 'production' ? 'build' : 'dev';
115+
116+
telemetry(event, {}).catch((e) => {});
117+
}
118+
109119
if (!enabled) {
110120
if (onDisabledRemoveStorybook) {
111121
return {

0 commit comments

Comments
 (0)