-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add @astrojs/telemetry * feat: add telemetry events, add queueing system * feat(telemetry): record CLI events * chore: add note * feat: support generic TELEMETRY_DISABLED env var * Fix test script * shim telemetry in tests * Shim telemetry in other commands * Stub telemetry in the memory leak test * Disable telemetry in smoke tests * Adds a changeset * Run the formatter * few updates * Include config keys * Add shallow viteKeys array: : * Add vite keys and tests Co-authored-by: Nate Moore <[email protected]>
- Loading branch information
Showing
28 changed files
with
938 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@astrojs/telemetry': minor | ||
'astro': patch | ||
--- | ||
|
||
Adds anonymous telemetry data to the cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* eslint-disable no-console */ | ||
import type yargs from 'yargs-parser'; | ||
import type { AstroTelemetry } from '@astrojs/telemetry'; | ||
|
||
import prompts from 'prompts'; | ||
import * as msg from '../core/messages.js'; | ||
|
||
export interface TelemetryOptions { | ||
flags: yargs.Arguments; | ||
telemetry: AstroTelemetry; | ||
} | ||
|
||
export async function update(subcommand: string, { flags, telemetry }: TelemetryOptions) { | ||
const isValid = ['enable', 'disable', 'reset'].includes(subcommand); | ||
|
||
if (flags.help || !isValid) { | ||
msg.printHelp({ | ||
commandName: 'astro telemetry', | ||
usage: '<enable|disable|reset>', | ||
commands: [ | ||
['enable', 'Enable anonymous data collection.'], | ||
['disable', 'Disable anonymous data collection.'], | ||
['reset', 'Reset anonymous data collection settings.'], | ||
], | ||
}); | ||
return; | ||
} | ||
|
||
switch (subcommand) { | ||
case 'enable': { | ||
telemetry.setEnabled(true); | ||
console.log(msg.telemetryEnabled()); | ||
return; | ||
} | ||
case 'disable': { | ||
telemetry.setEnabled(false); | ||
console.log(msg.telemetryDisabled()); | ||
return; | ||
} | ||
case 'reset': { | ||
telemetry.clear(); | ||
console.log(msg.telemetryReset()); | ||
return; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.