@sanity/cli 3.62.1-manifests.36 → 3.62.2
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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sanity/cli",
|
3
|
-
"version": "3.62.
|
3
|
+
"version": "3.62.2",
|
4
4
|
"description": "Sanity CLI tool for managing Sanity installations, managing plugins, schemas and datasets",
|
5
5
|
"keywords": [
|
6
6
|
"sanity",
|
@@ -58,9 +58,9 @@
|
|
58
58
|
"dependencies": {
|
59
59
|
"@babel/traverse": "^7.23.5",
|
60
60
|
"@sanity/client": "^6.22.2",
|
61
|
-
"@sanity/codegen": "3.62.
|
61
|
+
"@sanity/codegen": "3.62.2",
|
62
62
|
"@sanity/telemetry": "^0.7.7",
|
63
|
-
"@sanity/util": "3.62.
|
63
|
+
"@sanity/util": "3.62.2",
|
64
64
|
"chalk": "^4.1.2",
|
65
65
|
"debug": "^4.3.4",
|
66
66
|
"decompress": "^4.2.0",
|
@@ -76,13 +76,13 @@
|
|
76
76
|
},
|
77
77
|
"devDependencies": {
|
78
78
|
"@jest/globals": "^29.7.0",
|
79
|
-
"@repo/package.config": "3.62.
|
80
|
-
"@repo/test-config": "3.62.
|
79
|
+
"@repo/package.config": "3.62.2",
|
80
|
+
"@repo/test-config": "3.62.2",
|
81
81
|
"@rexxars/gitconfiglocal": "^3.0.1",
|
82
82
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
83
83
|
"@sanity/eslint-config-studio": "^4.0.0",
|
84
84
|
"@sanity/generate-help-url": "^3.0.0",
|
85
|
-
"@sanity/types": "3.62.
|
85
|
+
"@sanity/types": "3.62.2",
|
86
86
|
"@types/babel__traverse": "^7.20.5",
|
87
87
|
"@types/configstore": "^5.0.1",
|
88
88
|
"@types/cpx": "^1.5.2",
|
@@ -135,5 +135,5 @@
|
|
135
135
|
"engines": {
|
136
136
|
"node": ">=18"
|
137
137
|
},
|
138
|
-
"gitHead": "
|
138
|
+
"gitHead": "6ea8f1c0d32003026e46748fe8166fff8fe35dd8"
|
139
139
|
}
|
@@ -4,11 +4,13 @@ import path from 'node:path'
|
|
4
4
|
|
5
5
|
import {type DatasetAclMode, type SanityProject} from '@sanity/client'
|
6
6
|
import {type Framework} from '@vercel/frameworks'
|
7
|
+
import {type detectFrameworkRecord} from '@vercel/fs-detectors'
|
7
8
|
import dotenv from 'dotenv'
|
8
9
|
import execa, {type CommonOptions} from 'execa'
|
9
10
|
import {deburr, noop} from 'lodash'
|
10
11
|
import pFilter from 'p-filter'
|
11
12
|
import resolveFrom from 'resolve-from'
|
13
|
+
import semver from 'semver'
|
12
14
|
import {evaluate, patch} from 'silver-fleece'
|
13
15
|
import which from 'which'
|
14
16
|
|
@@ -55,6 +57,7 @@ import {
|
|
55
57
|
promptForNextTemplate,
|
56
58
|
promptForStudioPath,
|
57
59
|
} from './prompts/nextjs'
|
60
|
+
import {readPackageJson} from './readPackageJson'
|
58
61
|
import {reconfigureV2Project} from './reconfigureV2Project'
|
59
62
|
import templates from './templates'
|
60
63
|
import {
|
@@ -110,7 +113,9 @@ export interface ProjectOrganization {
|
|
110
113
|
// eslint-disable-next-line max-statements, complexity
|
111
114
|
export default async function initSanity(
|
112
115
|
args: CliCommandArguments<InitFlags>,
|
113
|
-
context: CliCommandContext & {
|
116
|
+
context: CliCommandContext & {
|
117
|
+
detectedFramework: Awaited<ReturnType<typeof detectFrameworkRecord>>
|
118
|
+
},
|
114
119
|
): Promise<void> {
|
115
120
|
const {
|
116
121
|
output,
|
@@ -128,6 +133,8 @@ export default async function initSanity(
|
|
128
133
|
const cliFlags = args.extOptions
|
129
134
|
const unattended = cliFlags.y || cliFlags.yes
|
130
135
|
const print = unattended ? noop : output.print
|
136
|
+
const warn = (msg: string) => output.warn(chalk.yellow.bgBlack(msg))
|
137
|
+
|
131
138
|
const intendedPlan = cliFlags['project-plan']
|
132
139
|
const intendedCoupon = cliFlags.coupon
|
133
140
|
const reconfigure = cliFlags.reconfigure
|
@@ -298,7 +305,8 @@ export default async function initSanity(
|
|
298
305
|
}
|
299
306
|
|
300
307
|
let initNext = false
|
301
|
-
|
308
|
+
const isNextJs = detectedFramework?.slug === 'nextjs'
|
309
|
+
if (isNextJs) {
|
302
310
|
initNext = await prompt.single({
|
303
311
|
type: 'confirm',
|
304
312
|
message:
|
@@ -327,6 +335,26 @@ export default async function initSanity(
|
|
327
335
|
// Ensure we are using the output path provided by user
|
328
336
|
outputPath = answers.outputPath
|
329
337
|
|
338
|
+
if (isNextJs) {
|
339
|
+
const packageJson = readPackageJson(`${outputPath}/package.json`)
|
340
|
+
const reactVersion = packageJson?.dependencies?.react
|
341
|
+
|
342
|
+
if (reactVersion) {
|
343
|
+
const isUsingReact19 = semver.coerce(reactVersion)?.major === 19
|
344
|
+
const isUsingNextJs15 = semver.coerce(detectedFramework?.detectedVersion)?.major === 15
|
345
|
+
|
346
|
+
if (isUsingNextJs15 && isUsingReact19) {
|
347
|
+
warn('╭────────────────────────────────────────────────────────────╮')
|
348
|
+
warn('│ │')
|
349
|
+
warn('│ It looks like you are using Next.js 15 and React 19 │')
|
350
|
+
warn('│ Please read our compatibility guide. │')
|
351
|
+
warn('│ https://www.sanity.io/help/react-19 │')
|
352
|
+
warn('│ │')
|
353
|
+
warn('╰────────────────────────────────────────────────────────────╯')
|
354
|
+
}
|
355
|
+
}
|
356
|
+
}
|
357
|
+
|
330
358
|
if (initNext) {
|
331
359
|
const useTypeScript = unattended ? true : await promptForTypeScript(prompt)
|
332
360
|
trace.log({step: 'useTypeScript', selectedOption: useTypeScript ? 'yes' : 'no'})
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import fs from 'node:fs'
|
2
|
+
|
3
|
+
import {type PackageJson} from '../../types'
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Read the `package.json` file at the given path
|
7
|
+
*
|
8
|
+
* @param filePath - Path to package.json to read
|
9
|
+
* @returns The parsed package.json
|
10
|
+
*/
|
11
|
+
export function readPackageJson(filePath: string): PackageJson | undefined {
|
12
|
+
try {
|
13
|
+
// eslint-disable-next-line no-sync
|
14
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'))
|
15
|
+
} catch (err) {
|
16
|
+
return undefined
|
17
|
+
}
|
18
|
+
}
|