@sanity/cli 3.57.1-manifests.46 → 3.57.2-canary.16
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 +36 -15
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/package.json +7 -7
- package/src/actions/init-project/initProject.ts +36 -3
- package/src/util/noSuchCommandText.ts +0 -1
- package/bin/xdg-open +0 -1066
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sanity/cli",
|
3
|
-
"version": "3.57.
|
3
|
+
"version": "3.57.2-canary.16+5cb335b1a2",
|
4
4
|
"description": "Sanity CLI tool for managing Sanity installations, managing plugins, schemas and datasets",
|
5
5
|
"keywords": [
|
6
6
|
"sanity",
|
@@ -57,10 +57,10 @@
|
|
57
57
|
},
|
58
58
|
"dependencies": {
|
59
59
|
"@babel/traverse": "^7.23.5",
|
60
|
-
"@sanity/client": "^6.21.
|
61
|
-
"@sanity/codegen": "3.57.
|
60
|
+
"@sanity/client": "^6.21.3",
|
61
|
+
"@sanity/codegen": "3.57.2-canary.16+5cb335b1a2",
|
62
62
|
"@sanity/telemetry": "^0.7.7",
|
63
|
-
"@sanity/util": "3.57.
|
63
|
+
"@sanity/util": "3.57.2-canary.16+5cb335b1a2",
|
64
64
|
"chalk": "^4.1.2",
|
65
65
|
"debug": "^4.3.4",
|
66
66
|
"decompress": "^4.2.0",
|
@@ -77,12 +77,12 @@
|
|
77
77
|
},
|
78
78
|
"devDependencies": {
|
79
79
|
"@jest/globals": "^29.7.0",
|
80
|
-
"@repo/package.config": "3.57.
|
80
|
+
"@repo/package.config": "3.57.1",
|
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.57.
|
85
|
+
"@sanity/types": "3.57.2-canary.16+5cb335b1a2",
|
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": "5cb335b1a2dcdf5cc967e88e22d2e8c082bb9c2e"
|
139
139
|
}
|
@@ -240,7 +240,11 @@ export default async function initSanity(
|
|
240
240
|
throw new Error('`--reconfigure` is deprecated - manual configuration is now required')
|
241
241
|
}
|
242
242
|
|
243
|
-
|
243
|
+
let envFilenameDefault = '.env'
|
244
|
+
if (detectedFramework && detectedFramework.slug === 'nextjs') {
|
245
|
+
envFilenameDefault = '.env.local'
|
246
|
+
}
|
247
|
+
const envFilename = typeof env === 'string' ? env : envFilenameDefault
|
244
248
|
if (!envFilename.startsWith('.env')) {
|
245
249
|
throw new Error(`Env filename must start with .env`)
|
246
250
|
}
|
@@ -433,10 +437,39 @@ export default async function initSanity(
|
|
433
437
|
const appendEnv = unattended ? true : await promptForAppendEnv(prompt, envFilename)
|
434
438
|
|
435
439
|
if (appendEnv) {
|
436
|
-
await createOrAppendEnvVars(envFilename, detectedFramework, {
|
437
|
-
|
440
|
+
await createOrAppendEnvVars(envFilename, detectedFramework, {log: true})
|
441
|
+
}
|
442
|
+
|
443
|
+
if (embeddedStudio) {
|
444
|
+
const nextjsLocalDevOrigin = 'http://localhost:3000'
|
445
|
+
const existingCorsOrigins = await apiClient({api: {projectId}}).request({
|
446
|
+
method: 'GET',
|
447
|
+
uri: '/cors',
|
438
448
|
})
|
449
|
+
const hasExistingCorsOrigin = existingCorsOrigins.some(
|
450
|
+
(item: {origin: string}) => item.origin === nextjsLocalDevOrigin,
|
451
|
+
)
|
452
|
+
if (!hasExistingCorsOrigin) {
|
453
|
+
await apiClient({api: {projectId}})
|
454
|
+
.request({
|
455
|
+
method: 'POST',
|
456
|
+
url: '/cors',
|
457
|
+
body: {origin: nextjsLocalDevOrigin, allowCredentials: true},
|
458
|
+
maxRedirects: 0,
|
459
|
+
})
|
460
|
+
.then((res) => {
|
461
|
+
print(
|
462
|
+
res.id
|
463
|
+
? `Added ${nextjsLocalDevOrigin} to CORS origins`
|
464
|
+
: `Failed to add ${nextjsLocalDevOrigin} to CORS origins`,
|
465
|
+
)
|
466
|
+
})
|
467
|
+
.catch((error) => {
|
468
|
+
print(`Failed to add ${nextjsLocalDevOrigin} to CORS origins`, error)
|
469
|
+
})
|
470
|
+
}
|
439
471
|
}
|
472
|
+
|
440
473
|
const {chosen} = await getPackageManagerChoice(workDir, {interactive: false})
|
441
474
|
trace.log({step: 'selectPackageManager', selectedOption: chosen})
|
442
475
|
const packages = ['@sanity/vision@3', 'sanity@3', '@sanity/image-url@1', 'styled-components@6']
|