[ci] format
This commit is contained in:
parent
0c7b42dc67
commit
04fa5a1453
4 changed files with 18 additions and 18 deletions
|
@ -11,7 +11,7 @@ export async function notify() {
|
|||
await telemetry.notify(() => {
|
||||
console.log(msg.telemetryNotice() + '\n');
|
||||
return true;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
export async function update(subcommand: string, { flags }: TelemetryOptions) {
|
||||
|
|
|
@ -107,28 +107,28 @@ export function serverStart({
|
|||
|
||||
export function telemetryNotice() {
|
||||
const headline = `${cyan('◆')} Astro collects completely anonymous usage data.`;
|
||||
const why = dim(' This optional program helps shape our roadmap.')
|
||||
const why = dim(' This optional program helps shape our roadmap.');
|
||||
const disable = dim(' Run `npm run astro telemetry disable` to opt-out.');
|
||||
const details = ` Details: ${underline('https://astro.build/telemetry')}`;
|
||||
return [headline, why, disable, details].map(v => ' ' + v).join('\n');
|
||||
return [headline, why, disable, details].map((v) => ' ' + v).join('\n');
|
||||
}
|
||||
|
||||
export function telemetryEnabled() {
|
||||
return `${green('◉')} Anonymous telemetry is now ${bgGreen(
|
||||
black(' enabled ')
|
||||
)}\n ${dim('Thank you for improving Astro!')}\n`;
|
||||
return `${green('◉')} Anonymous telemetry is now ${bgGreen(black(' enabled '))}\n ${dim(
|
||||
'Thank you for improving Astro!'
|
||||
)}\n`;
|
||||
}
|
||||
|
||||
export function telemetryDisabled() {
|
||||
return `${yellow('◯')} Anonymous telemetry is now ${bgYellow(
|
||||
black(' disabled ')
|
||||
)}\n ${dim('We won\'t ever record your usage data.')}\n`;
|
||||
return `${yellow('◯')} Anonymous telemetry is now ${bgYellow(black(' disabled '))}\n ${dim(
|
||||
"We won't ever record your usage data."
|
||||
)}\n`;
|
||||
}
|
||||
|
||||
export function telemetryReset() {
|
||||
return `${cyan('◆')} Anonymous telemetry has been ${bgCyan(
|
||||
black(' reset ')
|
||||
)}\n ${dim('You may be prompted again.')}\n`;
|
||||
return `${cyan('◆')} Anonymous telemetry has been ${bgCyan(black(' reset '))}\n ${dim(
|
||||
'You may be prompted again.'
|
||||
)}\n`;
|
||||
}
|
||||
|
||||
export function fsStrictWarning() {
|
||||
|
|
|
@ -115,13 +115,13 @@ export class AstroTelemetry {
|
|||
// The end-user has already been notified about our telemetry integration!
|
||||
// Don't bother them about it again.
|
||||
if (this.isValidNotice()) {
|
||||
this.debug(`[notify] last notified on ${this.notifyDate}`)
|
||||
this.debug(`[notify] last notified on ${this.notifyDate}`);
|
||||
return;
|
||||
}
|
||||
const enabled = await callback();
|
||||
this.config.set(KEY.TELEMETRY_NOTIFY_DATE, new Date().valueOf().toString());
|
||||
this.config.set(KEY.TELEMETRY_ENABLED, enabled);
|
||||
this.debug(`[notify] telemetry has been ${enabled ? 'enabled' : 'disabled'}`)
|
||||
this.debug(`[notify] telemetry has been ${enabled ? 'enabled' : 'disabled'}`);
|
||||
}
|
||||
|
||||
async record(event: TelemetryEvent | TelemetryEvent[] = []) {
|
||||
|
|
|
@ -15,7 +15,7 @@ function setup() {
|
|||
telemetry.debug.enabled = true;
|
||||
telemetry.debug.log = (...args) => logs.push(args);
|
||||
|
||||
return { telemetry, config, logs }
|
||||
return { telemetry, config, logs };
|
||||
}
|
||||
describe('AstroTelemetry', () => {
|
||||
let oldCI;
|
||||
|
@ -23,10 +23,10 @@ describe('AstroTelemetry', () => {
|
|||
oldCI = process.env.CI;
|
||||
// Stub process.env.CI to `false`
|
||||
process.env.CI = 'false';
|
||||
})
|
||||
});
|
||||
after(() => {
|
||||
process.env.CI = oldCI;
|
||||
})
|
||||
});
|
||||
it('initializes when expected arguments are given', () => {
|
||||
const { telemetry } = setup();
|
||||
expect(telemetry).to.be.instanceOf(AstroTelemetry);
|
||||
|
|
Loading…
Reference in a new issue