Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sanity schema extract. #49

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions sanity.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
const env = process.env ?? import.meta.env;

// Different environments use different variables
const projectId =
import.meta.env.PUBLIC_SANITY_STUDIO_PROJECT_ID! ||
import.meta.env.PUBLIC_SANITY_PROJECT_ID!;
const dataset =
import.meta.env.PUBLIC_SANITY_STUDIO_DATASET! ||
import.meta.env.PUBLIC_SANITY_DATASET!;
env.PUBLIC_SANITY_STUDIO_PROJECT_ID! || env.PUBLIC_SANITY_PROJECT_ID!;
const dataset = env.PUBLIC_SANITY_STUDIO_DATASET! || env.PUBLIC_SANITY_DATASET!;

// Feel free to remove this check if you don't need it
if (!projectId || !dataset) {
throw new Error(
`Missing environment variable(s). Check if named correctly in .env file.\n\nShould be:\nPUBLIC_SANITY_STUDIO_PROJECT_ID=${projectId}\nPUBLIC_SANITY_STUDIO_DATASET=${dataset}\n\nAvailable environment variables:\n${JSON.stringify(
import.meta.env,
env,
null,
2
)}`
Expand Down