rsnext/examples/cms-sanity/sanity.cli.ts
Cody Olsen 00e88b82dd
Update Sanity example deps and implementation (#65744)
- Uses the new `presentationTool.resolve.locations` instead of
`presentationTool.locate` API, which doesn't require wrangling `rxjs`.
- Sets up the new `presentationTool.resolve.mainDocuments` API, which
automatically opens up the post you're previewing on the left side in
the editor on the right side.
- Removes the `sanity-typegen.json` config file as `sanity typegen` now
looks for top level `app` and `sanity` folders by default.
- Enables `^` semver ranges for deps again now that our turbopack
support is stable, so that we only have to send you PRs when bumping
majors or changing the implementation itself.
- Sets up `sanity.config.ts` so it's possible to use `npx sanity dev`
for quickly iterating on schemas.
2024-05-16 16:51:49 -07:00

19 lines
490 B
TypeScript

import { defineCliConfig } from "sanity/cli";
const projectId = process.env.NEXT_PUBLIC_SANITY_PROJECT_ID;
const dataset = process.env.NEXT_PUBLIC_SANITY_DATASET;
export default defineCliConfig({
api: { projectId, dataset },
vite: {
define: {
"process.env.NEXT_PUBLIC_SANITY_PROJECT_ID": JSON.stringify(projectId),
"process.env.NEXT_PUBLIC_SANITY_DATASET": JSON.stringify(dataset),
},
resolve: {
alias: {
"@": __dirname,
},
},
},
});