diff --git a/.changeset/afraid-apricots-develop.md b/.changeset/afraid-apricots-develop.md new file mode 100644 index 000000000000..acf897149ff9 --- /dev/null +++ b/.changeset/afraid-apricots-develop.md @@ -0,0 +1,7 @@ +--- +'astro': minor +--- + +Adds a new variant `sync` for the `astro:config:setup` hook's `command` property. This value is set when calling the command `astro sync`. + +If your integration previously relied on knowing how many variants existed for the `command` property, you must update your logic to account for this new option. diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 19bbe480623d..50afa1423f2d 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -3316,7 +3316,7 @@ declare global { export interface IntegrationHooks { 'astro:config:setup': (options: { config: AstroConfig; - command: 'dev' | 'build' | 'preview'; + command: 'dev' | 'build' | 'preview' | 'sync'; isRestart: boolean; updateConfig: (newConfig: DeepPartial) => AstroConfig; addRenderer: (renderer: AstroRenderer) => void; diff --git a/packages/astro/src/core/sync/index.ts b/packages/astro/src/core/sync/index.ts index 3df81846ece1..d5bdfe3f99c0 100644 --- a/packages/astro/src/core/sync/index.ts +++ b/packages/astro/src/core/sync/index.ts @@ -57,7 +57,7 @@ export default async function sync( } let settings = await createSettings(astroConfig, inlineConfig.root); settings = await runHookConfigSetup({ - command: 'build', + command: 'sync', settings, logger, }); diff --git a/packages/astro/src/integrations/hooks.ts b/packages/astro/src/integrations/hooks.ts index aa62572ee83a..3b15e0d97ee2 100644 --- a/packages/astro/src/integrations/hooks.ts +++ b/packages/astro/src/integrations/hooks.ts @@ -121,7 +121,7 @@ export async function runHookConfigSetup({ fs = fsMod, }: { settings: AstroSettings; - command: 'dev' | 'build' | 'preview'; + command: 'dev' | 'build' | 'preview' | 'sync'; logger: Logger; isRestart?: boolean; fs?: typeof fsMod; diff --git a/packages/db/src/core/integration/file-url.ts b/packages/db/src/core/integration/file-url.ts index 72e49004ee09..76ce70cb9836 100644 --- a/packages/db/src/core/integration/file-url.ts +++ b/packages/db/src/core/integration/file-url.ts @@ -12,7 +12,7 @@ async function copyFile(toDir: URL, fromUrl: URL, toUrl: URL) { export function fileURLIntegration(): AstroIntegration { const fileNames: string[] = []; - function createVitePlugin(command: 'build' | 'preview' | 'dev'): VitePlugin { + function createVitePlugin(command: 'build' | 'preview' | 'dev' | 'sync'): VitePlugin { let referenceIds: string[] = []; return { name: '@astrojs/db/file-url', diff --git a/packages/db/src/core/integration/index.ts b/packages/db/src/core/integration/index.ts index de8eb6169246..263fa250a1b9 100644 --- a/packages/db/src/core/integration/index.ts +++ b/packages/db/src/core/integration/index.ts @@ -58,7 +58,7 @@ function astroDBIntegration(): AstroIntegration { inProgress: false, }; - let command: 'dev' | 'build' | 'preview'; + let command: 'dev' | 'build' | 'preview' | 'sync'; let output: AstroConfig['output'] = 'server'; return { name: 'astro:db',