0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-17 23:11:29 -05:00

feat: add sync variant (#11729)

* feat: add `sync` variant

* fix build

* Update .changeset/afraid-apricots-develop.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

---------

Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
This commit is contained in:
Emanuele Stoppa 2024-08-28 12:16:06 +01:00 committed by GitHub
parent d6611e8bb0
commit 1c54e63327
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 12 additions and 5 deletions

View file

@ -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.

View file

@ -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>) => AstroConfig;
addRenderer: (renderer: AstroRenderer) => void;

View file

@ -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,
});

View file

@ -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;

View file

@ -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',

View file

@ -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',