Hello there
I'm trying to setup prismic with express and typescript
and I want to use prismicCodegen to generate the types
I installed the required packages
{
"name": "server",
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "tsx watch --clear-screen=false root/src/index.ts",
"build": "tsc",
"start": "node root/dist/index.ts"
},
"dependencies": {
"@prismicio/client": "^7.11.0",
"@prismicio/helpers": "^2.3.9",
"envalid": "^8.0.0",
"express": "^5.0.1",
"method-override": "^3.0.0",
"morgan": "^1.10.0",
"node-fetch": "^3.3.2",
"pug": "^3.0.3"
},
"devDependencies": {
"@prismicio/types": "^0.2.9",
"@types/express": "^5.0.0",
"@types/method-override": "^0.0.35",
"@types/morgan": "^1.9.9",
"@types/node": "^22.8.1",
"prismic-ts-codegen": "^0.1.22",
"ts-node": "^10.9.2",
"tsx": "^4.19.2",
"typescript": "^5.6.3"
}
}
prismicCodegen.config.ts
import type { Config } from 'prismic-ts-codegen';
const config: Config = {
output: './types.generated.ts',
models: ['./root/src/cms/types/**/index.json'],
};
export default config;
the generated file see to be empty or I'm missing something ?
// Code generated by prismic-ts-codegen. DO NOT EDIT.
import type * as prismic from "@prismicio/client";
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] };
declare module "@prismicio/client" {
namespace Content {
export type {
}
}
}
inside root/src/types I have the following
home.json
{
"Main": {
"title": {
"type": "StructuredText",
"config": {
"single": "heading1",
"label": "title"
}
}
}
}
page.json
{
"Main": {
"uid": {
"type": "UID",
"config": {
"label": "uid"
}
},
"title": {
"type": "StructuredText",
"config": {
"single": "heading1",
"label": "Title"
}
}
}
}
index.json
[
{
"id": "home",
"name": "Home",
"repeatable": false,
"value": "home.json"
},
{
"id": "page",
"name": "Page",
"repeatable": true,
"value": "page.json"
}
]
what I'm missing ?
I already tested that I'm connected to my repo and can see the documents data