Skip to content

Commit

Permalink
chore: throw helpful migration error (#8915)
Browse files Browse the repository at this point in the history
For the Vercel and Netlify adapters. adapter-auto on earlier versions could install them when it shouldn't
Related to #8911
  • Loading branch information
dummdidumm authored Feb 6, 2023
1 parent 18de2c5 commit c35b7cd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/large-tables-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@sveltejs/adapter-netlify': patch
'@sveltejs/adapter-vercel': patch
---

chore: throw helpful migration error
7 changes: 7 additions & 0 deletions packages/adapter-netlify/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ export default function ({ split = false, edge = edge_set_in_env_var } = {}) {
name: '@sveltejs/adapter-netlify',

async adapt(builder) {
if (!builder.routes) {
throw new Error(
'@sveltejs/adapter-netlify >=2.x (possibly installed through @sveltejs/adapter-auto) requires @sveltejs/kit version 1.5 or higher. ' +
'Either downgrade the adapter or upgrade @sveltejs/kit'
);
}

const netlify_config = get_netlify_config();

// "build" is the default publish directory when Netlify detects SvelteKit
Expand Down
7 changes: 7 additions & 0 deletions packages/adapter-vercel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ const plugin = function (defaults = {}) {
name: '@sveltejs/adapter-vercel',

async adapt(builder) {
if (!builder.routes) {
throw new Error(
'@sveltejs/adapter-vercel >=2.x (possibly installed through @sveltejs/adapter-auto) requires @sveltejs/kit version 1.5 or higher. ' +
'Either downgrade the adapter or upgrade @sveltejs/kit'
);
}

const dir = '.vercel/output';
const tmp = builder.getBuildDirectory('vercel-tmp');

Expand Down

0 comments on commit c35b7cd

Please sign in to comment.