Skip to content

Commit

Permalink
fix: allow integration options to be undefined (#213)
Browse files Browse the repository at this point in the history
* fix: allow integration options to be undefined

Before this change, passing nothing to `sanity()` would result in the
integration crashing because of the attempt to destructure `studioBasePath`
from `undefined`. Now, we guard against this scenario be defaulting to `{}` if
no config is passed, and by not using destructuring to pick and omit
`studioBasePath` from the config.

* fix: upgrade dependencies

* chore: upgrade @astrojs/vercel
  • Loading branch information
christianhg authored Aug 27, 2024
1 parent cd5c4b4 commit 0e8924b
Show file tree
Hide file tree
Showing 5 changed files with 4,716 additions and 1,198 deletions.
2 changes: 1 addition & 1 deletion apps/example-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@astro-community/astro-embed-youtube": "^0.5.2",
"@astrojs/prism": "^3.1.0",
"@astrojs/react": "^3.4.0",
"@astrojs/vercel": "^7.6.0",
"@astrojs/vercel": "^7.8.0",
"@sanity/astro": "workspace:^",
"@sanity/client": "^6.19.1",
"@sanity/image-url": "^1.0.2",
Expand Down
2 changes: 1 addition & 1 deletion apps/movies/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/check": "^0.7.0",
"@astrojs/react": "^3.4.0",
"@astrojs/vercel": "^7.3.4",
"@astrojs/vercel": "^7.8.0",
"@sanity/astro": "workspace:^",
"@sanity/client": "^6.19.1",
"@sanity/visual-editing": "^2.1.3",
Expand Down
14 changes: 7 additions & 7 deletions packages/sanity-astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@
"prepublishOnly": "pnpm build"
},
"devDependencies": {
"@sanity/client": "^6.19.1",
"@sanity/visual-editing": "^2.1.3",
"@sanity/client": "^6.21.3",
"@sanity/visual-editing": "^2.1.9",
"@types/serialize-javascript": "^5.0.4",
"astro": "^4.10.1",
"astro": "^4.14.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sanity": "^3.43.0",
"sanity": "^3.55.0",
"serialize-javascript": "^6.0.2",
"type-fest": "^4.18.3",
"vite": "^4.5.3",
"vite-plugin-dts": "^3.9.1"
"type-fest": "^4.25.0",
"vite": "^5.4.2",
"vite-plugin-dts": "^4.0.3"
},
"peerDependencies": {
"@sanity/client": "^6.18.3",
Expand Down
9 changes: 5 additions & 4 deletions packages/sanity-astro/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ const defaultClientConfig: ClientConfig = {
apiVersion: 'v2023-08-24',
}

export default function sanityIntegration({
studioBasePath,
...clientConfig
}: IntegrationOptions): AstroIntegration {
export default function sanityIntegration(integrationConfig: IntegrationOptions = {}): AstroIntegration {
const studioBasePath = integrationConfig.studioBasePath
const clientConfig = integrationConfig
delete clientConfig.studioBasePath

return {
name: '@sanity/astro',
hooks: {
Expand Down
Loading

0 comments on commit 0e8924b

Please sign in to comment.