[ci] format

This commit is contained in:
FredKSchott 2022-04-02 18:30:48 +00:00 committed by GitHub Actions
parent 17c02925c5
commit bae719505d
9 changed files with 75 additions and 79 deletions

View file

@ -10,5 +10,5 @@ export default defineConfig({
// Learn more about this configuration here:
// https://docs.astro.build/en/guides/markdown-content/#syntax-highlighting
},
}
},
});

View file

@ -447,7 +447,6 @@ export interface AstroUserConfig {
*/
integrations?: Array<AstroIntegration | AstroIntegration[]>;
/**
* @docs
* @kind heading
@ -496,9 +495,6 @@ export interface AstroUserConfig {
ssr?: boolean;
};
// Legacy options to be removed
/** @deprecated - Use "integrations" instead. Run Astro to learn more about migrating. */

View file

@ -11,7 +11,7 @@ import load from '@proload/core';
import loadTypeScript from '@proload/plugin-tsm';
import postcssrc from 'postcss-load-config';
import { arraify, isObject } from './util.js';
import { appendForwardSlash, trimSlashes } from './path.js'
import { appendForwardSlash, trimSlashes } from './path.js';
load.use([loadTypeScript]);
@ -54,7 +54,7 @@ export const LegacyAstroConfigKeys = new Set([
'markdownOptions',
'buildOptions',
'devOptions',
'experimentalIntegrations'
'experimentalIntegrations',
]);
export const AstroConfigSchema = z.object({
@ -85,8 +85,8 @@ export const AstroConfigSchema = z.object({
.optional()
.transform((val) => (val ? appendForwardSlash(val) : val))
.refine((val) => !val || new URL(val).pathname.length <= 1, {
message: '"site" must be a valid URL origin (ex: "https://example.com") but cannot contain a URL path (ex: "https://example.com/blog"). Use "base" to configure your deployed URL path',
message:
'"site" must be a valid URL origin (ex: "https://example.com") but cannot contain a URL path (ex: "https://example.com/blog"). Use "base" to configure your deployed URL path',
}),
base: z
.string()
@ -112,12 +112,13 @@ export const AstroConfigSchema = z.object({
// individualized schema parser with the correct command.
(val) => (typeof val === 'function' ? val({ command: 'error' }) : val),
// validate
z.object({
z
.object({
host: z.union([z.string(), z.boolean()]).optional().default(false),
port: z.number().optional().default(3000),
})
.optional()
.default({}),
.default({})
),
integrations: z.preprocess(
// preprocess
@ -207,7 +208,7 @@ export async function validateConfig(userConfig: any, root: string, cmd: string)
}
}
if (oldConfig) {
throw new Error(`Legacy configuration detected. Please update your configuration to the new format!\nSee https://astro.build/config for more information.`)
throw new Error(`Legacy configuration detected. Please update your configuration to the new format!\nSee https://astro.build/config for more information.`);
}
/* eslint-enable no-console */
@ -234,12 +235,13 @@ export async function validateConfig(userConfig: any, root: string, cmd: string)
// preprocess
(val) => (typeof val === 'function' ? val({ command: cmd === 'dev' ? 'dev' : 'preview' }) : val),
// validate
z.object({
z
.object({
host: z.union([z.string(), z.boolean()]).optional().default(false),
port: z.number().optional().default(3000),
})
.optional()
.default({}),
.default({})
),
style: z
.object({

View file

@ -7,7 +7,7 @@ describe('Astro.*', () => {
before(async () => {
fixture = await loadFixture({
root: './fixtures/astro-global/'
root: './fixtures/astro-global/',
});
await fixture.build();
});

View file

@ -64,9 +64,7 @@ describe('astro cli', () => {
});
});
const hostToExposeFlags = [
['', ''],
];
const hostToExposeFlags = [['', '']];
hostToExposeFlags.forEach(([flag, flagValue]) => {
it(`astro ${cmd} ${flag} ${flagValue} - host to expose`, async () => {
const { local, network } = await cliServerLogSetupWithFixture([flag, flagValue], cmd);

View file

@ -61,6 +61,6 @@ describe('Config Validation', () => {
expect(configError.message).to.include('Astro integrations are still experimental.');
});
it('allows third-party "integration" values with the --experimental-integrations flag', async () => {
await validateConfig({ integrations: [{ name: '@my-plugin/a' }], experimental: { integrations: true }}, process.cwd()).catch((err) => err);
await validateConfig({ integrations: [{ name: '@my-plugin/a' }], experimental: { integrations: true } }, process.cwd()).catch((err) => err);
});
});

View file

@ -13,8 +13,8 @@ describe('Using Astro.request in SSR', () => {
root: './fixtures/ssr-request/',
adapter: testAdapter(),
experimental: {
ssr: true
}
ssr: true,
},
});
await fixture.build();
});