@sanity/cli 3.62.1-manifests.33 → 3.62.1
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.
package/lib/_chunks-cjs/cli.js
CHANGED
@@ -44545,6 +44545,13 @@ function promptForAppendEnv(prompt2, envFilename) {
|
|
44545
44545
|
default: !0
|
44546
44546
|
});
|
44547
44547
|
}
|
44548
|
+
function readPackageJson(filePath) {
|
44549
|
+
try {
|
44550
|
+
return JSON.parse(fs__default.default.readFileSync(filePath, "utf8"));
|
44551
|
+
} catch {
|
44552
|
+
return;
|
44553
|
+
}
|
44554
|
+
}
|
44548
44555
|
async function pathExists(filePath) {
|
44549
44556
|
try {
|
44550
44557
|
return await fs__default$1.default.access(filePath), !0;
|
@@ -45197,7 +45204,7 @@ async function initSanity(args, context) {
|
|
45197
45204
|
sanityMajorVersion,
|
45198
45205
|
telemetry: telemetry2,
|
45199
45206
|
detectedFramework
|
45200
|
-
} = context, trace = telemetry2.trace(CLIInitStepCompleted), cliFlags = args.extOptions, unattended = cliFlags.y || cliFlags.yes, print = unattended ? lodashExports.noop : output.print, intendedPlan = cliFlags["project-plan"], intendedCoupon = cliFlags.coupon, reconfigure = cliFlags.reconfigure, commitMessage = cliFlags.git, useGit = typeof commitMessage > "u" ? !0 : !!commitMessage, bareOutput = cliFlags.bare, env = cliFlags.env, packageManager = cliFlags["package-manager"];
|
45207
|
+
} = context, trace = telemetry2.trace(CLIInitStepCompleted), cliFlags = args.extOptions, unattended = cliFlags.y || cliFlags.yes, print = unattended ? lodashExports.noop : output.print, warn = (msg) => output.warn(chalk2.yellow.bgBlack(msg)), intendedPlan = cliFlags["project-plan"], intendedCoupon = cliFlags.coupon, reconfigure = cliFlags.reconfigure, commitMessage = cliFlags.git, useGit = typeof commitMessage > "u" ? !0 : !!commitMessage, bareOutput = cliFlags.bare, env = cliFlags.env, packageManager = cliFlags["package-manager"];
|
45201
45208
|
let defaultConfig = cliFlags["dataset-default"], showDefaultConfigPrompt = !defaultConfig;
|
45202
45209
|
if (trace.start(), trace.log({
|
45203
45210
|
step: "start",
|
@@ -45300,7 +45307,8 @@ You can find your project on Sanity Manage \u2014 https://www.sanity.io/manage/p
|
|
45300
45307
|
return;
|
45301
45308
|
}
|
45302
45309
|
let initNext = !1;
|
45303
|
-
detectedFramework?.slug === "nextjs"
|
45310
|
+
const isNextJs = detectedFramework?.slug === "nextjs";
|
45311
|
+
isNextJs && (initNext = await prompt2.single({
|
45304
45312
|
type: "confirm",
|
45305
45313
|
message: "Would you like to add configuration files for a Sanity project in this Next.js folder?",
|
45306
45314
|
default: !0
|
@@ -45312,7 +45320,14 @@ You can find your project on Sanity Manage \u2014 https://www.sanity.io/manage/p
|
|
45312
45320
|
const initFramework = initNext;
|
45313
45321
|
let outputPath = workDir;
|
45314
45322
|
const defaults2 = await getProjectDefaults(workDir, { isPlugin: !1, context }), answers = await getProjectInfo();
|
45315
|
-
if (outputPath = answers.outputPath,
|
45323
|
+
if (outputPath = answers.outputPath, isNextJs) {
|
45324
|
+
const reactVersion = readPackageJson(`${outputPath}/package.json`)?.dependencies?.react;
|
45325
|
+
if (reactVersion) {
|
45326
|
+
const isUsingReact19 = semver__default.default.coerce(reactVersion)?.major === 19;
|
45327
|
+
semver__default.default.coerce(detectedFramework?.detectedVersion)?.major === 15 && isUsingReact19 && (warn("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E"), warn("\u2502 \u2502"), warn("\u2502 It looks like you are using Next.js 15 and React 19 \u2502"), warn("\u2502 Please read our compatibility guide. \u2502"), warn("\u2502 https://www.sanity.io/help/react-19 \u2502"), warn("\u2502 \u2502"), warn("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"));
|
45328
|
+
}
|
45329
|
+
}
|
45330
|
+
if (initNext) {
|
45316
45331
|
const useTypeScript2 = unattended ? !0 : await promptForTypeScript(prompt2);
|
45317
45332
|
trace.log({ step: "useTypeScript", selectedOption: useTypeScript2 ? "yes" : "no" });
|
45318
45333
|
const fileExtension = useTypeScript2 ? "ts" : "js", embeddedStudio = unattended ? !0 : await promptForEmbeddedStudio(prompt2);
|