@sanity/cli 3.66.2-upgrade-vite-v6.23 → 3.67.0
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 +12 -15
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/package.json +9 -9
- package/src/actions/init-project/bootstrapLocalTemplate.ts +2 -2
- package/src/actions/init-project/bootstrapRemoteTemplate.ts +12 -6
- package/src/studioDependencies.ts +1 -1
- package/src/util/remoteTemplate.ts +0 -10
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sanity/cli",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.67.0",
|
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.24.1",
|
61
|
-
"@sanity/codegen": "3.
|
61
|
+
"@sanity/codegen": "3.67.0",
|
62
62
|
"@sanity/telemetry": "^0.7.7",
|
63
|
-
"@sanity/util": "3.
|
63
|
+
"@sanity/util": "3.67.0",
|
64
64
|
"chalk": "^4.1.2",
|
65
65
|
"debug": "^4.3.4",
|
66
66
|
"decompress": "^4.2.0",
|
@@ -76,13 +76,13 @@
|
|
76
76
|
"yaml": "^2.6.1"
|
77
77
|
},
|
78
78
|
"devDependencies": {
|
79
|
-
"@repo/package.config": "3.
|
80
|
-
"@repo/test-config": "3.
|
79
|
+
"@repo/package.config": "3.67.0",
|
80
|
+
"@repo/test-config": "3.67.0",
|
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.
|
85
|
+
"@sanity/types": "3.67.0",
|
86
86
|
"@types/babel__traverse": "^7.20.5",
|
87
87
|
"@types/configstore": "^5.0.1",
|
88
88
|
"@types/cpx": "^1.5.2",
|
@@ -127,13 +127,13 @@
|
|
127
127
|
"semver": "^7.3.5",
|
128
128
|
"semver-compare": "^1.0.0",
|
129
129
|
"tar": "^6.1.11",
|
130
|
-
"vite": "^
|
131
|
-
"vitest": "^2.1.
|
130
|
+
"vite": "^5.4.11",
|
131
|
+
"vitest": "^2.1.1",
|
132
132
|
"which": "^2.0.2",
|
133
133
|
"xdg-basedir": "^4.0.0"
|
134
134
|
},
|
135
135
|
"engines": {
|
136
136
|
"node": ">=18"
|
137
137
|
},
|
138
|
-
"gitHead": "
|
138
|
+
"gitHead": "17cfc6c8e39ace96d1aff37cbd6efb4db9fdb007"
|
139
139
|
}
|
@@ -138,8 +138,8 @@ export async function bootstrapLocalTemplate(
|
|
138
138
|
writeFileIfNotExists(`sanity.cli.${codeExt}`, cliConfig),
|
139
139
|
writeFileIfNotExists('package.json', packageManifest),
|
140
140
|
writeFileIfNotExists(
|
141
|
-
'.
|
142
|
-
|
141
|
+
'eslint.config.mjs',
|
142
|
+
`import studio from '@sanity/eslint-config-studio'\n\nexport default [...studio]\n`,
|
143
143
|
),
|
144
144
|
])
|
145
145
|
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import {mkdir} from 'node:fs/promises'
|
2
2
|
import {join} from 'node:path'
|
3
3
|
|
4
|
+
import {type Framework, frameworks} from '@vercel/frameworks'
|
5
|
+
import {detectFrameworkRecord, LocalFileSystemDetector} from '@vercel/fs-detectors'
|
6
|
+
|
4
7
|
import {debug} from '../../debug'
|
5
8
|
import {type CliCommandContext} from '../../types'
|
6
9
|
import {
|
@@ -9,7 +12,6 @@ import {
|
|
9
12
|
downloadAndExtractRepo,
|
10
13
|
generateSanityApiReadToken,
|
11
14
|
getMonoRepo,
|
12
|
-
isNextJsTemplate,
|
13
15
|
type RepoInfo,
|
14
16
|
tryApplyPackageName,
|
15
17
|
validateRemoteTemplate,
|
@@ -56,12 +58,16 @@ export async function bootstrapRemoteTemplate(
|
|
56
58
|
const readToken = needsReadToken
|
57
59
|
? await generateSanityApiReadToken('API Read Token', variables.projectId, apiClient)
|
58
60
|
: undefined
|
59
|
-
const isNext = await isNextJsTemplate(outputPath)
|
60
|
-
const envName = isNext ? '.env.local' : '.env'
|
61
61
|
|
62
|
-
for (const
|
63
|
-
const
|
64
|
-
await
|
62
|
+
for (const pkg of packages ?? ['']) {
|
63
|
+
const packagePath = join(outputPath, pkg)
|
64
|
+
const packageFramework: Framework | null = await detectFrameworkRecord({
|
65
|
+
fs: new LocalFileSystemDetector(packagePath),
|
66
|
+
frameworkList: frameworks as readonly Framework[],
|
67
|
+
})
|
68
|
+
// Next.js uses `.env.local` for local environment variables
|
69
|
+
const envName = packageFramework?.slug === 'nextjs' ? '.env.local' : '.env'
|
70
|
+
await applyEnvVariables(packagePath, {...variables, readToken}, envName)
|
65
71
|
}
|
66
72
|
|
67
73
|
debug('Setting package name to %s', packageName)
|
@@ -18,7 +18,7 @@ export const studioDependencies = {
|
|
18
18
|
'@sanity/eslint-config-studio': 'latest',
|
19
19
|
// When using typescript, we'll want the these types too, so might as well install them
|
20
20
|
'@types/react': '^18.0.25',
|
21
|
-
'eslint': '^
|
21
|
+
'eslint': '^9.9.0',
|
22
22
|
'prettier': '^3.0.2',
|
23
23
|
'typescript': '^5.1.6', // Peer dependency of eslint-config-studio (implicitly)
|
24
24
|
},
|
@@ -410,16 +410,6 @@ export async function validateRemoteTemplate(
|
|
410
410
|
}
|
411
411
|
}
|
412
412
|
|
413
|
-
export async function isNextJsTemplate(root: string): Promise<boolean> {
|
414
|
-
try {
|
415
|
-
const packageJson = await readFile(join(root, 'package.json'), 'utf8')
|
416
|
-
const pkg = JSON.parse(packageJson)
|
417
|
-
return !!(pkg.dependencies?.next || pkg.devDependencies?.next)
|
418
|
-
} catch {
|
419
|
-
return false
|
420
|
-
}
|
421
|
-
}
|
422
|
-
|
423
413
|
export async function checkNeedsReadToken(root: string): Promise<boolean> {
|
424
414
|
try {
|
425
415
|
const templatePath = await Promise.any(
|