[ci] format
This commit is contained in:
parent
17c02925c5
commit
bae719505d
9 changed files with 75 additions and 79 deletions
|
@ -10,5 +10,5 @@ export default defineConfig({
|
||||||
// Learn more about this configuration here:
|
// Learn more about this configuration here:
|
||||||
// https://docs.astro.build/en/guides/markdown-content/#syntax-highlighting
|
// https://docs.astro.build/en/guides/markdown-content/#syntax-highlighting
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -447,7 +447,6 @@ export interface AstroUserConfig {
|
||||||
*/
|
*/
|
||||||
integrations?: Array<AstroIntegration | AstroIntegration[]>;
|
integrations?: Array<AstroIntegration | AstroIntegration[]>;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @docs
|
* @docs
|
||||||
* @kind heading
|
* @kind heading
|
||||||
|
@ -496,9 +495,6 @@ export interface AstroUserConfig {
|
||||||
ssr?: boolean;
|
ssr?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Legacy options to be removed
|
// Legacy options to be removed
|
||||||
|
|
||||||
/** @deprecated - Use "integrations" instead. Run Astro to learn more about migrating. */
|
/** @deprecated - Use "integrations" instead. Run Astro to learn more about migrating. */
|
||||||
|
|
|
@ -11,7 +11,7 @@ import load from '@proload/core';
|
||||||
import loadTypeScript from '@proload/plugin-tsm';
|
import loadTypeScript from '@proload/plugin-tsm';
|
||||||
import postcssrc from 'postcss-load-config';
|
import postcssrc from 'postcss-load-config';
|
||||||
import { arraify, isObject } from './util.js';
|
import { arraify, isObject } from './util.js';
|
||||||
import { appendForwardSlash, trimSlashes } from './path.js'
|
import { appendForwardSlash, trimSlashes } from './path.js';
|
||||||
|
|
||||||
load.use([loadTypeScript]);
|
load.use([loadTypeScript]);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ export const LegacyAstroConfigKeys = new Set([
|
||||||
'markdownOptions',
|
'markdownOptions',
|
||||||
'buildOptions',
|
'buildOptions',
|
||||||
'devOptions',
|
'devOptions',
|
||||||
'experimentalIntegrations'
|
'experimentalIntegrations',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const AstroConfigSchema = z.object({
|
export const AstroConfigSchema = z.object({
|
||||||
|
@ -85,8 +85,8 @@ export const AstroConfigSchema = z.object({
|
||||||
.optional()
|
.optional()
|
||||||
.transform((val) => (val ? appendForwardSlash(val) : val))
|
.transform((val) => (val ? appendForwardSlash(val) : val))
|
||||||
.refine((val) => !val || new URL(val).pathname.length <= 1, {
|
.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
|
base: z
|
||||||
.string()
|
.string()
|
||||||
|
@ -112,12 +112,13 @@ export const AstroConfigSchema = z.object({
|
||||||
// individualized schema parser with the correct command.
|
// individualized schema parser with the correct command.
|
||||||
(val) => (typeof val === 'function' ? val({ command: 'error' }) : val),
|
(val) => (typeof val === 'function' ? val({ command: 'error' }) : val),
|
||||||
// validate
|
// validate
|
||||||
z.object({
|
z
|
||||||
|
.object({
|
||||||
host: z.union([z.string(), z.boolean()]).optional().default(false),
|
host: z.union([z.string(), z.boolean()]).optional().default(false),
|
||||||
port: z.number().optional().default(3000),
|
port: z.number().optional().default(3000),
|
||||||
})
|
})
|
||||||
.optional()
|
.optional()
|
||||||
.default({}),
|
.default({})
|
||||||
),
|
),
|
||||||
integrations: z.preprocess(
|
integrations: z.preprocess(
|
||||||
// preprocess
|
// preprocess
|
||||||
|
@ -207,7 +208,7 @@ export async function validateConfig(userConfig: any, root: string, cmd: string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldConfig) {
|
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 */
|
/* eslint-enable no-console */
|
||||||
|
|
||||||
|
@ -234,12 +235,13 @@ export async function validateConfig(userConfig: any, root: string, cmd: string)
|
||||||
// preprocess
|
// preprocess
|
||||||
(val) => (typeof val === 'function' ? val({ command: cmd === 'dev' ? 'dev' : 'preview' }) : val),
|
(val) => (typeof val === 'function' ? val({ command: cmd === 'dev' ? 'dev' : 'preview' }) : val),
|
||||||
// validate
|
// validate
|
||||||
z.object({
|
z
|
||||||
|
.object({
|
||||||
host: z.union([z.string(), z.boolean()]).optional().default(false),
|
host: z.union([z.string(), z.boolean()]).optional().default(false),
|
||||||
port: z.number().optional().default(3000),
|
port: z.number().optional().default(3000),
|
||||||
})
|
})
|
||||||
.optional()
|
.optional()
|
||||||
.default({}),
|
.default({})
|
||||||
),
|
),
|
||||||
style: z
|
style: z
|
||||||
.object({
|
.object({
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe('Astro.*', () => {
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
fixture = await loadFixture({
|
fixture = await loadFixture({
|
||||||
root: './fixtures/astro-global/'
|
root: './fixtures/astro-global/',
|
||||||
});
|
});
|
||||||
await fixture.build();
|
await fixture.build();
|
||||||
});
|
});
|
||||||
|
|
|
@ -64,9 +64,7 @@ describe('astro cli', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const hostToExposeFlags = [
|
const hostToExposeFlags = [['', '']];
|
||||||
['', ''],
|
|
||||||
];
|
|
||||||
hostToExposeFlags.forEach(([flag, flagValue]) => {
|
hostToExposeFlags.forEach(([flag, flagValue]) => {
|
||||||
it(`astro ${cmd} ${flag} ${flagValue} - host to expose`, async () => {
|
it(`astro ${cmd} ${flag} ${flagValue} - host to expose`, async () => {
|
||||||
const { local, network } = await cliServerLogSetupWithFixture([flag, flagValue], cmd);
|
const { local, network } = await cliServerLogSetupWithFixture([flag, flagValue], cmd);
|
||||||
|
|
|
@ -61,6 +61,6 @@ describe('Config Validation', () => {
|
||||||
expect(configError.message).to.include('Astro integrations are still experimental.');
|
expect(configError.message).to.include('Astro integrations are still experimental.');
|
||||||
});
|
});
|
||||||
it('allows third-party "integration" values with the --experimental-integrations flag', async () => {
|
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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,8 +13,8 @@ describe('Using Astro.request in SSR', () => {
|
||||||
root: './fixtures/ssr-request/',
|
root: './fixtures/ssr-request/',
|
||||||
adapter: testAdapter(),
|
adapter: testAdapter(),
|
||||||
experimental: {
|
experimental: {
|
||||||
ssr: true
|
ssr: true,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
await fixture.build();
|
await fixture.build();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue