[ci] format

This commit is contained in:
FredKSchott 2022-06-27 21:17:40 +00:00 committed by fredkbot
parent ebd7e7ad81
commit 701799c6d6
9 changed files with 25 additions and 23 deletions

View file

@ -3,10 +3,10 @@
import { LogOptions } from '../core/logger/core.js';
import { AstroTelemetry } from '@astrojs/telemetry';
import * as event from '../events/index.js';
import * as colors from 'kleur/colors';
import yargs from 'yargs-parser';
import { z } from 'zod';
import * as event from '../events/index.js';
import add from '../core/add/index.js';
import build from '../core/build/index.js';
@ -19,7 +19,6 @@ import { createSafeError } from '../core/util.js';
import { check } from './check.js';
import { openInBrowser } from './open.js';
import * as telemetryHandler from './telemetry.js';
import { AstroUserConfig } from '../@types/astro.js';
type Arguments = yargs.Arguments;
type CLICommand =
@ -46,7 +45,7 @@ function printAstroHelp() {
['build', 'Build your project and write it to disk.'],
['check', 'Check your project for errors.'],
['dev', 'Start the development server.'],
['docs', "Open documentation in your web browser."],
['docs', 'Open documentation in your web browser.'],
['preview', 'Preview your build locally.'],
['telemetry', 'Configure telemetry settings.'],
],

View file

@ -71,7 +71,9 @@ export default async function add(names: string[], { cwd, flags, logging, teleme
['sitemap', 'astro add sitemap'],
],
},
description: `Check out the full integration catalog: ${cyan('https://astro.build/integrations')}`,
description: `Check out the full integration catalog: ${cyan(
'https://astro.build/integrations'
)}`,
});
return;
}
@ -79,7 +81,7 @@ export default async function add(names: string[], { cwd, flags, logging, teleme
const root = pathToFileURL(cwd ? path.resolve(cwd) : process.cwd());
configURL = await resolveConfigURL({ cwd, flags });
applyPolyfill();
if (configURL) {
debug('add', `Found config at ${configURL}`);
} else {

View file

@ -255,7 +255,7 @@ export function printHelp({
headline?: string;
usage?: string;
tables?: Record<string, [command: string, help: string][]>;
description?: string,
description?: string;
}) {
const linebreak = () => '';
const title = (label: string) => ` ${bgWhite(black(` ${label} `))}`;
@ -267,7 +267,7 @@ export function printHelp({
if (split) {
raw += ` ${row[0]}\n `;
} else {
raw += `${(`${row[0]}`.padStart(padding))}`;
raw += `${`${row[0]}`.padStart(padding)}`;
}
raw += ' ' + dim(row[1]) + '\n';
}
@ -293,7 +293,7 @@ export function printHelp({
if (tables) {
function calculateTablePadding(rows: [string, string][]) {
return rows.reduce((val, [first]) => Math.max(val, first.length), 0) + 2;
};
}
const tableEntries = Object.entries(tables);
const padding = Math.max(...tableEntries.map(([, rows]) => calculateTablePadding(rows)));
for (const [tableTitle, tableRows] of tableEntries) {

View file

@ -216,9 +216,7 @@ export async function main() {
} else if (gitResponse.git) {
await execaCommand('git init', { cwd });
} else {
ora().info(
dim(`Sounds good! You can come back and run ${cyan(`git init`)} later.`)
);
ora().info(dim(`Sounds good! You can come back and run ${cyan(`git init`)} later.`));
}
ora().succeed('Setup complete.');

View file

@ -65,7 +65,10 @@ function createAnonymousValue(payload: BinaryLike): string {
function getProjectIdFromGit(): string | null {
try {
const originBuffer = execSync(`git rev-list --max-parents=0 HEAD`, {timeout: 500, stdio: [0, 'pipe', 0]});
const originBuffer = execSync(`git rev-list --max-parents=0 HEAD`, {
timeout: 500,
stdio: [0, 'pipe', 0],
});
return String(originBuffer).trim();
} catch (_) {
return null;

View file

@ -7,16 +7,16 @@ import os from 'node:os';
* Astro Telemetry -- System Info
*
* To better understand our telemetry insights, Astro collects the following anonymous information
* about the system that it runs on. This helps us prioritize fixes and new features based on a
* about the system that it runs on. This helps us prioritize fixes and new features based on a
* better understanding of our real-world system requirements.
*
*
* ~~~
*
* Q: Can this system info be traced back to me?
*
* A: No personally identifiable information is contained in the system info that we collect. It could
* be possible for someone with direct access to your machine to collect this information themselves
* and then attempt to match it all together with our collected telemetry data, however most users'
* be possible for someone with direct access to your machine to collect this information themselves
* and then attempt to match it all together with our collected telemetry data, however most users'
* systems are probably not uniquely identifiable via their system info alone.
*
* ~~~

View file

@ -1,9 +1,9 @@
import { expect } from 'chai';
import {GlobalConfig} from '../dist/config.js';
import { GlobalConfig } from '../dist/config.js';
describe('GlobalConfig', () => {
it('initializes when expected arguments are given', () => {
const config = new GlobalConfig({ name: 'TEST_NAME' });
expect(config).to.be.instanceOf(GlobalConfig);
const config = new GlobalConfig({ name: 'TEST_NAME' });
expect(config).to.be.instanceOf(GlobalConfig);
});
});

View file

@ -1,9 +1,9 @@
import { expect } from 'chai';
import {AstroTelemetry} from '../dist/index.js';
import { AstroTelemetry } from '../dist/index.js';
describe('AstroTelemetry', () => {
it('initializes when expected arguments are given', () => {
const telemetry = new AstroTelemetry({ version: '0.0.0-test.1' });
expect(telemetry).to.be.instanceOf(AstroTelemetry);
const telemetry = new AstroTelemetry({ version: '0.0.0-test.1' });
expect(telemetry).to.be.instanceOf(AstroTelemetry);
});
});

View file

@ -1,5 +1,5 @@
export { pathToPosix } from './lib/utils';
export { AbortController, AbortSignal, alert, atob, Blob, btoa, ByteLengthQueuingStrategy, cancelAnimationFrame, cancelIdleCallback, CanvasRenderingContext2D, CharacterData, clearTimeout, Comment, CountQueuingStrategy, CSSStyleSheet, CustomElementRegistry, CustomEvent, Document, DocumentFragment, DOMException, Element, Event, EventTarget, fetch, File, FormData, Headers, HTMLBodyElement, HTMLCanvasElement, HTMLDivElement, HTMLDocument, HTMLElement, HTMLHeadElement, HTMLHtmlElement, HTMLImageElement, HTMLSpanElement, HTMLStyleElement, HTMLTemplateElement, HTMLUnknownElement, Image, ImageData, IntersectionObserver, MediaQueryList, MutationObserver, Node, NodeFilter, NodeIterator, OffscreenCanvas, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, Request, requestAnimationFrame, requestIdleCallback, ResizeObserver, Response, setTimeout, ShadowRoot, structuredClone, StyleSheet, Text, TransformStream, TreeWalker, URLPattern, Window, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter, } from './mod.js';
export { AbortController, AbortSignal, alert, atob, Blob, btoa, ByteLengthQueuingStrategy, cancelAnimationFrame, cancelIdleCallback, CanvasRenderingContext2D, CharacterData, clearTimeout, Comment, CountQueuingStrategy, CSSStyleSheet, CustomElementRegistry, CustomEvent, Document, DocumentFragment, DOMException, Element, Event, EventTarget, fetch, File, FormData, Headers, HTMLBodyElement, HTMLCanvasElement, HTMLDivElement, HTMLDocument, HTMLElement, HTMLHeadElement, HTMLHtmlElement, HTMLImageElement, HTMLSpanElement, HTMLStyleElement, HTMLTemplateElement, HTMLUnknownElement, Image, ImageData, IntersectionObserver, MediaQueryList, MutationObserver, Node, NodeFilter, NodeIterator, OffscreenCanvas, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, Request, requestAnimationFrame, requestIdleCallback, ResizeObserver, Response, setTimeout, ShadowRoot, structuredClone, StyleSheet, Text, TransformStream, TreeWalker, URLPattern, Window, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter } from './mod.js';
export declare const polyfill: {
(target: any, options?: PolyfillOptions): any;
internals(target: any, name: string): any;