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:
parent
d6611e8bb0
commit
1c54e63327
6 changed files with 12 additions and 5 deletions
7
.changeset/afraid-apricots-develop.md
Normal file
7
.changeset/afraid-apricots-develop.md
Normal 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.
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Add table
Reference in a new issue