Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re authored and astrobot-houston committed Aug 28, 2023
1 parent 0c7b42d commit 04fa5a1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/astro/src/cli/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
22 changes: 11 additions & 11 deletions packages/astro/src/core/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions packages/telemetry/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = []) {
Expand Down
8 changes: 4 additions & 4 deletions packages/telemetry/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ function setup() {
telemetry.debug.enabled = true;
telemetry.debug.log = (...args) => logs.push(args);

return { telemetry, config, logs }
return { telemetry, config, logs };
}
describe('AstroTelemetry', () => {
describe('AstroTelemetry', () => {
let oldCI;
before(() => {
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);
Expand Down

0 comments on commit 04fa5a1

Please sign in to comment.