[ci] format
This commit is contained in:
parent
ebd7e7ad81
commit
701799c6d6
9 changed files with 25 additions and 23 deletions
|
@ -3,10 +3,10 @@
|
||||||
import { LogOptions } from '../core/logger/core.js';
|
import { LogOptions } from '../core/logger/core.js';
|
||||||
|
|
||||||
import { AstroTelemetry } from '@astrojs/telemetry';
|
import { AstroTelemetry } from '@astrojs/telemetry';
|
||||||
import * as event from '../events/index.js';
|
|
||||||
import * as colors from 'kleur/colors';
|
import * as colors from 'kleur/colors';
|
||||||
import yargs from 'yargs-parser';
|
import yargs from 'yargs-parser';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
import * as event from '../events/index.js';
|
||||||
|
|
||||||
import add from '../core/add/index.js';
|
import add from '../core/add/index.js';
|
||||||
import build from '../core/build/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 { check } from './check.js';
|
||||||
import { openInBrowser } from './open.js';
|
import { openInBrowser } from './open.js';
|
||||||
import * as telemetryHandler from './telemetry.js';
|
import * as telemetryHandler from './telemetry.js';
|
||||||
import { AstroUserConfig } from '../@types/astro.js';
|
|
||||||
|
|
||||||
type Arguments = yargs.Arguments;
|
type Arguments = yargs.Arguments;
|
||||||
type CLICommand =
|
type CLICommand =
|
||||||
|
@ -46,7 +45,7 @@ function printAstroHelp() {
|
||||||
['build', 'Build your project and write it to disk.'],
|
['build', 'Build your project and write it to disk.'],
|
||||||
['check', 'Check your project for errors.'],
|
['check', 'Check your project for errors.'],
|
||||||
['dev', 'Start the development server.'],
|
['dev', 'Start the development server.'],
|
||||||
['docs', "Open documentation in your web browser."],
|
['docs', 'Open documentation in your web browser.'],
|
||||||
['preview', 'Preview your build locally.'],
|
['preview', 'Preview your build locally.'],
|
||||||
['telemetry', 'Configure telemetry settings.'],
|
['telemetry', 'Configure telemetry settings.'],
|
||||||
],
|
],
|
||||||
|
|
|
@ -71,7 +71,9 @@ export default async function add(names: string[], { cwd, flags, logging, teleme
|
||||||
['sitemap', 'astro add sitemap'],
|
['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;
|
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());
|
const root = pathToFileURL(cwd ? path.resolve(cwd) : process.cwd());
|
||||||
configURL = await resolveConfigURL({ cwd, flags });
|
configURL = await resolveConfigURL({ cwd, flags });
|
||||||
applyPolyfill();
|
applyPolyfill();
|
||||||
|
|
||||||
if (configURL) {
|
if (configURL) {
|
||||||
debug('add', `Found config at ${configURL}`);
|
debug('add', `Found config at ${configURL}`);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -255,7 +255,7 @@ export function printHelp({
|
||||||
headline?: string;
|
headline?: string;
|
||||||
usage?: string;
|
usage?: string;
|
||||||
tables?: Record<string, [command: string, help: string][]>;
|
tables?: Record<string, [command: string, help: string][]>;
|
||||||
description?: string,
|
description?: string;
|
||||||
}) {
|
}) {
|
||||||
const linebreak = () => '';
|
const linebreak = () => '';
|
||||||
const title = (label: string) => ` ${bgWhite(black(` ${label} `))}`;
|
const title = (label: string) => ` ${bgWhite(black(` ${label} `))}`;
|
||||||
|
@ -267,7 +267,7 @@ export function printHelp({
|
||||||
if (split) {
|
if (split) {
|
||||||
raw += ` ${row[0]}\n `;
|
raw += ` ${row[0]}\n `;
|
||||||
} else {
|
} else {
|
||||||
raw += `${(`${row[0]}`.padStart(padding))}`;
|
raw += `${`${row[0]}`.padStart(padding)}`;
|
||||||
}
|
}
|
||||||
raw += ' ' + dim(row[1]) + '\n';
|
raw += ' ' + dim(row[1]) + '\n';
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ export function printHelp({
|
||||||
if (tables) {
|
if (tables) {
|
||||||
function calculateTablePadding(rows: [string, string][]) {
|
function calculateTablePadding(rows: [string, string][]) {
|
||||||
return rows.reduce((val, [first]) => Math.max(val, first.length), 0) + 2;
|
return rows.reduce((val, [first]) => Math.max(val, first.length), 0) + 2;
|
||||||
};
|
}
|
||||||
const tableEntries = Object.entries(tables);
|
const tableEntries = Object.entries(tables);
|
||||||
const padding = Math.max(...tableEntries.map(([, rows]) => calculateTablePadding(rows)));
|
const padding = Math.max(...tableEntries.map(([, rows]) => calculateTablePadding(rows)));
|
||||||
for (const [tableTitle, tableRows] of tableEntries) {
|
for (const [tableTitle, tableRows] of tableEntries) {
|
||||||
|
|
|
@ -216,9 +216,7 @@ export async function main() {
|
||||||
} else if (gitResponse.git) {
|
} else if (gitResponse.git) {
|
||||||
await execaCommand('git init', { cwd });
|
await execaCommand('git init', { cwd });
|
||||||
} else {
|
} else {
|
||||||
ora().info(
|
ora().info(dim(`Sounds good! You can come back and run ${cyan(`git init`)} later.`));
|
||||||
dim(`Sounds good! You can come back and run ${cyan(`git init`)} later.`)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ora().succeed('Setup complete.');
|
ora().succeed('Setup complete.');
|
||||||
|
|
|
@ -65,7 +65,10 @@ function createAnonymousValue(payload: BinaryLike): string {
|
||||||
|
|
||||||
function getProjectIdFromGit(): string | null {
|
function getProjectIdFromGit(): string | null {
|
||||||
try {
|
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();
|
return String(originBuffer).trim();
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -7,16 +7,16 @@ import os from 'node:os';
|
||||||
* Astro Telemetry -- System Info
|
* Astro Telemetry -- System Info
|
||||||
*
|
*
|
||||||
* To better understand our telemetry insights, Astro collects the following anonymous information
|
* 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.
|
* better understanding of our real-world system requirements.
|
||||||
*
|
*
|
||||||
* ~~~
|
* ~~~
|
||||||
*
|
*
|
||||||
* Q: Can this system info be traced back to me?
|
* 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
|
* 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
|
* 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'
|
* 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.
|
* systems are probably not uniquely identifiable via their system info alone.
|
||||||
*
|
*
|
||||||
* ~~~
|
* ~~~
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import {GlobalConfig} from '../dist/config.js';
|
import { GlobalConfig } from '../dist/config.js';
|
||||||
|
|
||||||
describe('GlobalConfig', () => {
|
describe('GlobalConfig', () => {
|
||||||
it('initializes when expected arguments are given', () => {
|
it('initializes when expected arguments are given', () => {
|
||||||
const config = new GlobalConfig({ name: 'TEST_NAME' });
|
const config = new GlobalConfig({ name: 'TEST_NAME' });
|
||||||
expect(config).to.be.instanceOf(GlobalConfig);
|
expect(config).to.be.instanceOf(GlobalConfig);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import {AstroTelemetry} from '../dist/index.js';
|
import { AstroTelemetry } from '../dist/index.js';
|
||||||
|
|
||||||
describe('AstroTelemetry', () => {
|
describe('AstroTelemetry', () => {
|
||||||
it('initializes when expected arguments are given', () => {
|
it('initializes when expected arguments are given', () => {
|
||||||
const telemetry = new AstroTelemetry({ version: '0.0.0-test.1' });
|
const telemetry = new AstroTelemetry({ version: '0.0.0-test.1' });
|
||||||
expect(telemetry).to.be.instanceOf(AstroTelemetry);
|
expect(telemetry).to.be.instanceOf(AstroTelemetry);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
2
packages/webapi/mod.d.ts
vendored
2
packages/webapi/mod.d.ts
vendored
|
@ -1,5 +1,5 @@
|
||||||
export { pathToPosix } from './lib/utils';
|
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: {
|
export declare const polyfill: {
|
||||||
(target: any, options?: PolyfillOptions): any;
|
(target: any, options?: PolyfillOptions): any;
|
||||||
internals(target: any, name: string): any;
|
internals(target: any, name: string): any;
|
||||||
|
|
Loading…
Reference in a new issue