Skip to content

Commit

Permalink
Align adapter setup (#6874)
Browse files Browse the repository at this point in the history
  • Loading branch information
nblackburn authored Apr 19, 2023
1 parent dec072f commit 43230b2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/hungry-lizards-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/vercel': patch
---

Refactor static adapter to use updateConfig method
11 changes: 8 additions & 3 deletions packages/integrations/vercel/src/static/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ export default function vercelStatic({ analytics }: VercelStaticConfig = {}): As
return {
name: '@astrojs/vercel',
hooks: {
'astro:config:setup': ({ command, config, injectScript }) => {
'astro:config:setup': ({ command, config, updateConfig, injectScript }) => {
if (command === 'build' && analytics) {
injectScript('page', 'import "@astrojs/vercel/analytics"');
}
config.outDir = new URL('./static/', getVercelOutput(config.root));
config.build.format = 'directory';
const outDir = new URL('./static/', getVercelOutput(config.root));
updateConfig({
outDir,
build: {
format: 'directory',
},
});
},
'astro:config:done': ({ setAdapter, config }) => {
setAdapter(getAdapter());
Expand Down

0 comments on commit 43230b2

Please sign in to comment.