Skip to content

Commit

Permalink
fixed message
Browse files Browse the repository at this point in the history
  • Loading branch information
hasanaburayyan committed Jul 6, 2023
1 parent b51fdc6 commit 36a63e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 3 additions & 1 deletion apps/wing/src/analytics/disclaimer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ const disclaimer = `
We are working hard to make this a great tool, but there's still a pretty good
chance you'll encounter missing pieces, rough edges, performance issues and even,
god forbid, bugs 🐞.
Please don't hesitate to ping us at ${chalk.blueBright.bold.underline(
"https://t.winglang.io/slack"
)} or file an issue at
${chalk.blueBright.bold.underline(
"https://github.com/winglang/wing"
)}. We promise to do our best to respond quickly and help out.
To help us identify issues early, we are collecting anonymous analytics.
To turn this off, set ${chalk.yellowBright.bold("WING_CLI_DISABLE_ANALYTICS=1")}.
To turn this off, set ${chalk.yellowBright.bold("WING_DISABLE_ANALYTICS=1")}.
For more information see ${chalk.blueBright.bold.underline("https://winglang.io/docs/analytics")}
${chalk.redBright("(This message will self-destruct after the first run)")}
`;
Expand Down
18 changes: 11 additions & 7 deletions apps/wing/src/analytics/scripts/detached-export.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getAnonymousId, loadAnalyticsEvent } from '../storage';
import * as fs from 'fs';
import Analytics from '@segment/analytics-node';
import { getWingAnalyticsCollectionConfig } from '../collect';

// When this file is run as a child process, it will be passed the path
// to the analytics report file
Expand All @@ -9,16 +10,19 @@ const filePath = process.argv[2];
try {
const analytics = new Analytics({ writeKey: 'sCqPF5xSscOjJdi5Tbkqu73vfF8zkZdw'});
const event = loadAnalyticsEvent(filePath);
const analyticsConfig = getWingAnalyticsCollectionConfig();

analytics.track({
anonymousId: getAnonymousId(),
timestamp: event.timestamp,
event: event.event,
properties: event.properties,
});
if (analyticsConfig.export) {
analytics.track({
anonymousId: getAnonymousId(),
timestamp: event.timestamp,
event: event.event,
properties: event.properties,
});
}

// Keeps the file around for debugging purposes
if (!process.env.WING_ANALYTICS_DEBUG) {
if (!analyticsConfig.debug) {
fs.unlinkSync(filePath);
}
} catch(err) {
Expand Down

0 comments on commit 36a63e7

Please sign in to comment.