Skip to content
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.

Commit

Permalink
chore(deps): support @netlify/blobs v8
Browse files Browse the repository at this point in the history
The peer dependency only specifies support for v6 and v7, but v8 works
just fine.

This adds v8 to the peer dependencies, bumps the dev dep to v8, updates
the tests (there's a new requirement that's specific to unusual use
cases like unstorage's tests, which are run outside of the Netlify
platform and the Netlify CLI), and adjust the driver types to ensure
compatibility with all supported versions.

See netlify/blobs#183.

I believe @netlify/blobs@8 will error in local dev when using
netlify-cli before 17.21.1. This doesn't seem like unstorage's problem
though, so I didn't do anything about that here.
  • Loading branch information
serhalp committed Sep 15, 2024
1 parent 3e9c499 commit dda35d5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@azure/storage-blob": "^12.24.0",
"@capacitor/preferences": "^6.0.2",
"@cloudflare/workers-types": "^4.20240903.0",
"@netlify/blobs": "^7.4.0",
"@netlify/blobs": "^8.0.1",
"@planetscale/database": "^1.19.0",
"@types/ioredis-mock": "^8.2.5",
"@types/jsdom": "^21.1.7",
Expand Down Expand Up @@ -105,7 +105,7 @@
"@azure/keyvault-secrets": "^4.8.0",
"@azure/storage-blob": "^12.24.0",
"@capacitor/preferences": "^6.0.2",
"@netlify/blobs": "^6.5.0 || ^7.0.0",
"@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.0.0",
"@planetscale/database": "^1.19.0",
"@upstash/redis": "^1.34.0",
"@vercel/kv": "^1.0.1",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/drivers/netlify-blobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ export interface NetlifyDeployStoreOptions extends NetlifyBaseStoreOptions {
deployID?: string;
}

export interface NetlifyDeployStoreV8Options extends NetlifyDeployStoreOptions {
// TODO(serhalp) Export this type from @netlify/blobs instead
region?: "us-east-1" | "us-east-2";
}

export interface NetlifyNamedStoreOptions extends NetlifyBaseStoreOptions {
name: string;
deployScoped?: false;
}

export type NetlifyStoreOptions =
| NetlifyDeployStoreOptions
| NetlifyDeployStoreV8Options
| NetlifyNamedStoreOptions;

export default defineDriver((options: NetlifyStoreOptions) => {
Expand Down
2 changes: 2 additions & 0 deletions test/drivers/netlify-blobs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ describe("drivers: netlify-blobs", async () => {
token,
siteID,
deployID: "test",
// Usually defaulted via the environment; only required in a test environment like this
region: "us-east-1",
}),
});

Expand Down

0 comments on commit dda35d5

Please sign in to comment.