Skip to content

Commit 75bbb05

Browse files
authored
fix(content): declare zod as optional peer dependency (#622) (#625)
1 parent 984dfee commit 75bbb05

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

docs/content/4.integrations/1.content.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ export default defineContentConfig({
3131
})
3232
```
3333

34+
::note
35+
Nuxt Content infers collection types from the schema you provide, so the `ogImage` field needs the same [Zod](https://zod.dev) instance your project uses. The module resolves Zod from your project (it's an optional peer dependency), so this works automatically. If you have multiple Zod versions installed and `ogImage` is missing from the generated `ContentCollectionItem` type, pass your instance explicitly with `defineOgImageSchema({ z })`{lang="ts"}.
36+
::
37+
3438
To ensure the tags gets rendered you need to ensure you're using the `defineOgImage()`{lang="ts"} composable with the `ogImage` key.
3539

3640
```vue [[...slug].vue]

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@
8080
"sharp": "^0.34.0",
8181
"tailwindcss": "^4.0.0",
8282
"unifont": "^0.7.0",
83-
"unstorage": "^1.15.0"
83+
"unstorage": "^1.15.0",
84+
"zod": ">=3"
8485
},
8586
"peerDependenciesMeta": {
8687
"@resvg/resvg-js": {
@@ -115,6 +116,9 @@
115116
},
116117
"unifont": {
117118
"optional": true
119+
},
120+
"zod": {
121+
"optional": true
118122
}
119123
},
120124
"dependencies": {
@@ -149,8 +153,7 @@
149153
"tinyglobby": "catalog:",
150154
"ufo": "catalog:",
151155
"ultrahtml": "catalog:",
152-
"unplugin": "catalog:",
153-
"zod": "catalog:"
156+
"unplugin": "catalog:"
154157
},
155158
"devDependencies": {
156159
"@antfu/eslint-config": "catalog:",
@@ -219,6 +222,7 @@
219222
"vue": "catalog:",
220223
"vue-tsc": "catalog:",
221224
"wrangler": "catalog:",
222-
"yoga-wasm-web": "catalog:"
225+
"yoga-wasm-web": "catalog:",
226+
"zod": "catalog:"
223227
}
224228
}

pnpm-lock.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)