@sanity/cli 3.42.2-sdx-1339.35 → 3.43.1-create-unstable.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43314,13 +43314,6 @@ function promptForEmbeddedStudio(prompt2) {
43314
43314
  default: !0
43315
43315
  });
43316
43316
  }
43317
- function promptForAppDir(prompt2) {
43318
- return prompt2.single({
43319
- type: "confirm",
43320
- message: "Would you like to use the Next.js app directory for routes?",
43321
- default: !1
43322
- });
43323
- }
43324
43317
  function promptForStudioPath(prompt2) {
43325
43318
  return prompt2.single({
43326
43319
  type: "input",
@@ -44046,7 +44039,9 @@ export const schema = {
44046
44039
  "blockContent.": useTypeScript ? blockContentTS : blockContentJS,
44047
44040
  "category.": useTypeScript ? categoryTS : categoryJS,
44048
44041
  "post.": useTypeScript ? postTS : postJS
44049
- }), sanityConfigTemplate = `/**
44042
+ }), sanityConfigTemplate = `'use client'
44043
+
44044
+ /**
44050
44045
  * This configuration is used to for the Sanity Studio that\u2019s mounted on the \`:route:\` route
44051
44046
  */
44052
44047
 
@@ -44081,25 +44076,7 @@ const projectId = process.env.NEXT_PUBLIC_SANITY_PROJECT_ID
44081
44076
  const dataset = process.env.NEXT_PUBLIC_SANITY_DATASET
44082
44077
 
44083
44078
  export default defineCliConfig({ api: { projectId, dataset } })
44084
- `, sanityStudioPagesTemplate = `import Head from 'next/head'
44085
- import { NextStudio } from 'next-sanity/studio'
44086
- import { metadata } from 'next-sanity/studio/metadata'
44087
- import config from ':configPath:'
44088
-
44089
- export default function StudioPage() {
44090
- return (
44091
- <>
44092
- <Head>
44093
- {Object.entries(metadata).map(([key, value]) => (
44094
- <meta key={key} name={key} content={value} />
44095
- ))}
44096
- </Head>
44097
- <NextStudio config={config} />
44098
- </>
44099
- )
44100
- }`, sanityStudioAppTemplate = `'use client'
44101
-
44102
- /**
44079
+ `, sanityStudioTemplate = `/**
44103
44080
  * This route is responsible for the built-in authoring environment using Sanity Studio.
44104
44081
  * All routes under your studio path is handled by this file using Next.js' catch-all routes:
44105
44082
  * https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes
@@ -44111,6 +44088,10 @@ export default function StudioPage() {
44111
44088
  import { NextStudio } from 'next-sanity/studio'
44112
44089
  import config from ':configPath:'
44113
44090
 
44091
+ export const dynamic = 'force-static'
44092
+
44093
+ export { metadata, viewport } from 'next-sanity/studio'
44094
+
44114
44095
  export default function StudioPage() {
44115
44096
  return <NextStudio config={config} />
44116
44097
  }`, envTS = `export const apiVersion =
@@ -44154,10 +44135,11 @@ export const schema: { types: SchemaTypeDefinition[] } = {
44154
44135
  import { apiVersion, dataset, projectId, useCdn } from '../env'
44155
44136
 
44156
44137
  export const client = createClient({
44157
- apiVersion,
44158
- dataset,
44159
44138
  projectId,
44139
+ dataset,
44140
+ apiVersion,
44160
44141
  useCdn,
44142
+ perspective: 'published',
44161
44143
  })
44162
44144
  `, imageTS = `import createImageUrlBuilder from '@sanity/image-url'
44163
44145
  import type { Image } from 'sanity'
@@ -44324,17 +44306,17 @@ You can find your project on Sanity Manage \u2014 https://www.sanity.io/manage/p
44324
44306
  trace.log({ step: "useTypeScript", selectedOption: useTypeScript2 ? "yes" : "no" });
44325
44307
  const fileExtension = useTypeScript2 ? "ts" : "js";
44326
44308
  if (unattended || await promptForEmbeddedStudio(prompt2)) {
44327
- const useAppDir = unattended ? !1 : await promptForAppDir(prompt2), srcDir = useAppDir ? "app" : "pages";
44309
+ const srcDir = "app";
44328
44310
  let srcPath = path__default.default.join(workDir, srcDir);
44329
44311
  fs$r.existsSync(srcPath) || (srcPath = path__default.default.join(workDir, "src", srcDir), fs$r.existsSync(srcPath) || await fs__default$1.default.mkdir(srcPath, { recursive: !0 }).catch(() => loadEnv.debug("Error creating folder %s", srcPath)));
44330
44312
  const studioPath = unattended ? "/studio" : await promptForStudioPath(prompt2), embeddedStudioRouteFilePath = path__default.default.join(
44331
44313
  srcPath,
44332
44314
  `${studioPath}/`,
44333
- useAppDir ? `[[...index]]/page.${fileExtension}x` : `[[...index]].${fileExtension}x`
44315
+ `[[...tool]]/page.${fileExtension}x`
44334
44316
  );
44335
44317
  await writeOrOverwrite(
44336
44318
  embeddedStudioRouteFilePath,
44337
- (useAppDir ? sanityStudioAppTemplate : sanityStudioPagesTemplate).replace(
44319
+ sanityStudioTemplate.replace(
44338
44320
  ":configPath:",
44339
44321
  new Array(countNestedFolders(embeddedStudioRouteFilePath.slice(workDir.length))).join("../").concat("sanity.config")
44340
44322
  )
@@ -44384,7 +44366,7 @@ You can find your project on Sanity Manage \u2014 https://www.sanity.io/manage/p
44384
44366
  cwd: workDir,
44385
44367
  stdio: "inherit"
44386
44368
  };
44387
- chosen === "npm" ? await execa$1("npm", ["install", "next-sanity@7"], execOptions) : chosen === "yarn" ? await execa$1("npx", ["install-peerdeps", "--yarn", "next-sanity@7"], execOptions) : chosen === "pnpm" && await execa$1("pnpm", ["install", "next-sanity@7"], execOptions), print(
44369
+ chosen === "npm" ? await execa$1("npm", ["install", "next-sanity@9"], execOptions) : chosen === "yarn" ? await execa$1("npx", ["install-peerdeps", "--yarn", "next-sanity@9"], execOptions) : chosen === "pnpm" && await execa$1("pnpm", ["install", "next-sanity@9"], execOptions), print(
44388
44370
  `
44389
44371
  ${chalk2.green("Success!")} Your Sanity configuration files has been added to this project`
44390
44372
  ), process.exit(0);