@sanity/cli 3.92.1-next.40.1f1bdfec39 → 3.92.1-next.42.40eccef023
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/codemods/partsTypeDirective.js +1 -2
- package/lib/_chunks-cjs/cli.js +121 -81
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/lib/_chunks-cjs/cliWorker.js.map +1 -1
- package/lib/_chunks-cjs/getCliConfig.js +4 -2
- package/lib/_chunks-cjs/getCliConfig.js.map +1 -1
- package/lib/_chunks-cjs/journeyConfig.js.map +1 -1
- package/lib/_chunks-cjs/loadEnv.js +3 -3
- package/lib/_chunks-cjs/loadEnv.js.map +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/workers/typegenGenerate.js +3 -4
- package/lib/workers/typegenGenerate.js.map +1 -1
- package/package.json +11 -9
- package/src/actions/codemod/codemodAction.ts +1 -1
- package/src/actions/codemod/mods/reactIconsV3.ts +1 -1
- package/src/actions/init-plugin/bootstrapFromTemplate.ts +2 -3
- package/src/actions/init-project/bootstrapLocalTemplate.ts +2 -2
- package/src/actions/init-project/git.ts +4 -4
- package/src/actions/init-project/initProject.ts +2 -2
- package/src/actions/init-project/readPackageJson.ts +1 -2
- package/src/actions/versions/findSanityModuleVersions.ts +1 -1
- package/src/commands/init/initCommand.ts +1 -1
- package/src/util/cliWorker.ts +1 -1
- package/src/util/clientWrapper.ts +2 -2
- package/src/util/getCliConfig.ts +3 -3
- package/src/util/getLocalVersion.ts +1 -1
- package/src/util/journeyConfig.ts +2 -2
- package/src/util/remoteTemplate.ts +2 -2
- package/src/workers/typegenGenerate.ts +0 -1
- package/templates/.eslintrc +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli",
|
|
3
|
-
"version": "3.92.1-next.
|
|
3
|
+
"version": "3.92.1-next.42.40eccef023",
|
|
4
4
|
"description": "Sanity CLI tool for managing Sanity installations, managing plugins, schemas and datasets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"build": "pkg-utils build --strict --check --clean",
|
|
51
51
|
"check:types": "tsc --project tsconfig.lib.json",
|
|
52
52
|
"clean": "rimraf lib",
|
|
53
|
-
"lint": "eslint
|
|
53
|
+
"lint": "eslint .",
|
|
54
54
|
"prepublishOnly": "turbo run build",
|
|
55
55
|
"test": "vitest",
|
|
56
56
|
"ts": "node -r esbuild-register",
|
|
@@ -59,31 +59,32 @@
|
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@babel/traverse": "^7.23.5",
|
|
61
61
|
"@sanity/client": "^7.6.0",
|
|
62
|
-
"@sanity/codegen": "3.92.1-next.
|
|
62
|
+
"@sanity/codegen": "3.92.1-next.42.40eccef023",
|
|
63
63
|
"@sanity/runtime-cli": "^8.1.0",
|
|
64
64
|
"@sanity/telemetry": "^0.8.0",
|
|
65
65
|
"@sanity/template-validator": "^2.4.3",
|
|
66
|
-
"@sanity/util": "3.92.1-next.
|
|
66
|
+
"@sanity/util": "3.92.1-next.42.40eccef023",
|
|
67
67
|
"chalk": "^4.1.2",
|
|
68
68
|
"debug": "^4.3.4",
|
|
69
69
|
"decompress": "^4.2.0",
|
|
70
70
|
"esbuild": "0.25.5",
|
|
71
|
-
"esbuild-register": "^3.
|
|
71
|
+
"esbuild-register": "^3.6.0",
|
|
72
72
|
"get-it": "^8.6.9",
|
|
73
73
|
"groq-js": "^1.17.0",
|
|
74
74
|
"pkg-dir": "^5.0.0",
|
|
75
|
-
"prettier": "^3.3
|
|
75
|
+
"prettier": "^3.5.3",
|
|
76
76
|
"semver": "^7.3.5",
|
|
77
77
|
"validate-npm-package-name": "^3.0.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
+
"@repo/eslint-config": "0.0.0",
|
|
80
81
|
"@repo/package.config": "3.92.0",
|
|
81
82
|
"@repo/test-config": "3.92.0",
|
|
82
83
|
"@rexxars/gitconfiglocal": "^3.0.1",
|
|
83
84
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
84
|
-
"@sanity/eslint-config-studio": "^
|
|
85
|
+
"@sanity/eslint-config-studio": "^5.0.2",
|
|
85
86
|
"@sanity/generate-help-url": "^3.0.0",
|
|
86
|
-
"@sanity/types": "3.92.1-next.
|
|
87
|
+
"@sanity/types": "3.92.1-next.42.40eccef023",
|
|
87
88
|
"@types/babel__traverse": "^7.20.5",
|
|
88
89
|
"@types/configstore": "^5.0.1",
|
|
89
90
|
"@types/cpx": "^1.5.2",
|
|
@@ -110,6 +111,7 @@
|
|
|
110
111
|
"execa": "^2.0.0",
|
|
111
112
|
"get-latest-version": "^5.0.0",
|
|
112
113
|
"git-user-info": "^2.0.3",
|
|
114
|
+
"globals": "^16.2.0",
|
|
113
115
|
"inquirer": "^6.0.0",
|
|
114
116
|
"is-installed-globally": "^0.4.0",
|
|
115
117
|
"leven": "^3.1.0",
|
|
@@ -135,5 +137,5 @@
|
|
|
135
137
|
"engines": {
|
|
136
138
|
"node": ">=18"
|
|
137
139
|
},
|
|
138
|
-
"gitHead": "
|
|
140
|
+
"gitHead": "40eccef02385fc6963c544a7bf7247df049624b7"
|
|
139
141
|
}
|
|
@@ -101,7 +101,7 @@ function ensureNpx() {
|
|
|
101
101
|
if (!npxHelp.includes('npm')) {
|
|
102
102
|
throw new Error('Not the npx we expected')
|
|
103
103
|
}
|
|
104
|
-
} catch
|
|
104
|
+
} catch {
|
|
105
105
|
throw new Error(
|
|
106
106
|
`Failed to run "npx" - required to run codemods. Do you have a recent version of npm installed?`,
|
|
107
107
|
)
|
|
@@ -4,7 +4,6 @@ import path from 'node:path'
|
|
|
4
4
|
import {absolutify, pathIsEmpty} from '@sanity/util/fs'
|
|
5
5
|
import decompress from 'decompress'
|
|
6
6
|
import {getIt} from 'get-it'
|
|
7
|
-
// eslint-disable-next-line import/extensions
|
|
8
7
|
import {promise} from 'get-it/middleware'
|
|
9
8
|
import resolveFrom from 'resolve-from'
|
|
10
9
|
import semver from 'semver'
|
|
@@ -44,7 +43,7 @@ export async function bootstrapFromTemplate(
|
|
|
44
43
|
try {
|
|
45
44
|
const projectManifest = await readJson<SanityJson>(path.join(workDir, 'sanity.json'))
|
|
46
45
|
inProjectContext = Boolean(projectManifest.root)
|
|
47
|
-
} catch
|
|
46
|
+
} catch {
|
|
48
47
|
// Intentional noop
|
|
49
48
|
}
|
|
50
49
|
|
|
@@ -185,7 +184,7 @@ function getZip(url: string): Promise<decompress.File[]> {
|
|
|
185
184
|
function parseJson<T = any>(json: string): T | undefined {
|
|
186
185
|
try {
|
|
187
186
|
return JSON.parse(json)
|
|
188
|
-
} catch
|
|
187
|
+
} catch {
|
|
189
188
|
return undefined
|
|
190
189
|
}
|
|
191
190
|
}
|
|
@@ -86,8 +86,8 @@ export async function bootstrapLocalTemplate(
|
|
|
86
86
|
const dependencyVersions = await resolveLatestVersions({
|
|
87
87
|
...(isAppTemplate ? {} : studioDependencies.dependencies),
|
|
88
88
|
...(isAppTemplate ? {} : studioDependencies.devDependencies),
|
|
89
|
-
...
|
|
90
|
-
...
|
|
89
|
+
...template.dependencies,
|
|
90
|
+
...template.devDependencies,
|
|
91
91
|
})
|
|
92
92
|
spinner.succeed()
|
|
93
93
|
|
|
@@ -26,11 +26,11 @@ export function tryGitInit(rootDir: string, commitMessage?: string): boolean {
|
|
|
26
26
|
cwd: rootDir,
|
|
27
27
|
})
|
|
28
28
|
return true
|
|
29
|
-
} catch
|
|
29
|
+
} catch {
|
|
30
30
|
if (didInit) {
|
|
31
31
|
try {
|
|
32
32
|
rimrafSync(path.join(rootDir, '.git'))
|
|
33
|
-
} catch
|
|
33
|
+
} catch {
|
|
34
34
|
// intentional noop
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -42,7 +42,7 @@ function isInGitRepository(rootDir: string): boolean {
|
|
|
42
42
|
try {
|
|
43
43
|
execSync('git rev-parse --is-inside-work-tree', {stdio: 'ignore', cwd: rootDir})
|
|
44
44
|
return true
|
|
45
|
-
} catch
|
|
45
|
+
} catch {
|
|
46
46
|
// intentional noop
|
|
47
47
|
}
|
|
48
48
|
return false
|
|
@@ -52,7 +52,7 @@ function isInMercurialRepository(rootDir: string): boolean {
|
|
|
52
52
|
try {
|
|
53
53
|
execSync('hg --cwd . root', {stdio: 'ignore', cwd: rootDir})
|
|
54
54
|
return true
|
|
55
|
-
} catch
|
|
55
|
+
} catch {
|
|
56
56
|
// intentional noop
|
|
57
57
|
}
|
|
58
58
|
return false
|
|
@@ -725,7 +725,7 @@ export default async function initSanity(
|
|
|
725
725
|
print('')
|
|
726
726
|
|
|
727
727
|
// Provide login options (`sanity login`)
|
|
728
|
-
const {extOptions, ...otherArgs} = args
|
|
728
|
+
const {extOptions: _extOptions, ...otherArgs} = args
|
|
729
729
|
const loginArgs: CliCommandArguments<LoginFlags> = {...otherArgs, extOptions: {}}
|
|
730
730
|
await login(loginArgs, {...context, telemetry: trace.newContext('login')})
|
|
731
731
|
return getUserData(apiClient)
|
|
@@ -1129,7 +1129,7 @@ export default async function initSanity(
|
|
|
1129
1129
|
body: {metadata: {cliInitializedAt: new Date().toISOString()}},
|
|
1130
1130
|
})
|
|
1131
1131
|
}
|
|
1132
|
-
} catch
|
|
1132
|
+
} catch {
|
|
1133
1133
|
// Non-critical update
|
|
1134
1134
|
debug('Failed to update cliInitializedAt metadata')
|
|
1135
1135
|
}
|
|
@@ -10,9 +10,8 @@ import {type PackageJson} from '../../types'
|
|
|
10
10
|
*/
|
|
11
11
|
export function readPackageJson(filePath: string): PackageJson | undefined {
|
|
12
12
|
try {
|
|
13
|
-
// eslint-disable-next-line no-sync
|
|
14
13
|
return JSON.parse(fs.readFileSync(filePath, 'utf8'))
|
|
15
|
-
} catch
|
|
14
|
+
} catch {
|
|
16
15
|
return undefined
|
|
17
16
|
}
|
|
18
17
|
}
|
|
@@ -95,7 +95,7 @@ export interface InitFlags {
|
|
|
95
95
|
'package-manager'?: PackageManager
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
const initCommand: CliCommandDefinition<InitFlags> = {
|
|
99
99
|
name: 'init',
|
|
100
100
|
signature: '',
|
|
101
101
|
description: 'Initializes a new Sanity Studio and/or project',
|
package/src/util/cliWorker.ts
CHANGED
|
@@ -28,7 +28,7 @@ export async function getCliWorkerPath(workerPath: string): Promise<string> {
|
|
|
28
28
|
const resolvedPath = path.resolve(cliDir, 'lib', 'workers', workerPath)
|
|
29
29
|
try {
|
|
30
30
|
return require.resolve(resolvedPath)
|
|
31
|
-
} catch
|
|
31
|
+
} catch {
|
|
32
32
|
throw new Error(`Unable to resolve path for worker: ${workerPath}`)
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/util/getCliConfig.ts
CHANGED
|
@@ -35,14 +35,15 @@ export async function getCliConfig(
|
|
|
35
35
|
if (forked) {
|
|
36
36
|
try {
|
|
37
37
|
return await getCliConfigForked(cwd)
|
|
38
|
-
} catch
|
|
38
|
+
} catch {
|
|
39
39
|
// Intentional noop - try unforked variant
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const {unregister} = __DEV__
|
|
44
44
|
? {unregister: () => undefined}
|
|
45
|
-
:
|
|
45
|
+
: // eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
46
|
+
require('esbuild-register/dist/node').register({supported: {'dynamic-import': true}})
|
|
46
47
|
|
|
47
48
|
try {
|
|
48
49
|
const v3Config = getSanityCliConfig(cwd)
|
|
@@ -68,7 +69,6 @@ async function getCliConfigForked(cwd: string): Promise<CliConfigResult | null>
|
|
|
68
69
|
return new Promise((resolve, reject) => {
|
|
69
70
|
const worker = new Worker(workerPath, {
|
|
70
71
|
workerData: cwd,
|
|
71
|
-
// eslint-disable-next-line no-process-env
|
|
72
72
|
env: process.env,
|
|
73
73
|
})
|
|
74
74
|
worker.on('message', (message) => {
|
|
@@ -154,7 +154,7 @@ export async function fetchJourneyConfig(
|
|
|
154
154
|
schemaUrl: response.schemaUrl,
|
|
155
155
|
isFirstProject: true,
|
|
156
156
|
}
|
|
157
|
-
} catch
|
|
157
|
+
} catch {
|
|
158
158
|
throw new Error(`Failed to fetch remote schema config: ${projectId}`)
|
|
159
159
|
}
|
|
160
160
|
}
|
|
@@ -169,7 +169,7 @@ async function fetchJourneySchema(schemaUrl: string): Promise<DocumentOrObject[]
|
|
|
169
169
|
try {
|
|
170
170
|
const response = await import(schemaUrl)
|
|
171
171
|
return response.default
|
|
172
|
-
} catch
|
|
172
|
+
} catch {
|
|
173
173
|
throw new Error(`Failed to fetch remote schema: ${schemaUrl}`)
|
|
174
174
|
}
|
|
175
175
|
}
|
|
@@ -264,7 +264,7 @@ export async function applyEnvVariables(
|
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
await writeFile(join(root, targetName), envContent)
|
|
267
|
-
} catch
|
|
267
|
+
} catch {
|
|
268
268
|
throw new Error(
|
|
269
269
|
'Failed to set environment variables. This could be due to file permissions or the .env file format. See https://www.sanity.io/docs/environment-variables for details on environment variable setup.',
|
|
270
270
|
)
|
|
@@ -278,7 +278,7 @@ export async function tryApplyPackageName(root: string, name: string): Promise<v
|
|
|
278
278
|
pkg.name = name
|
|
279
279
|
|
|
280
280
|
await writeFile(join(root, 'package.json'), JSON.stringify(pkg, null, 2))
|
|
281
|
-
} catch
|
|
281
|
+
} catch {
|
|
282
282
|
// noop
|
|
283
283
|
}
|
|
284
284
|
}
|
|
@@ -12,7 +12,6 @@ import createDebug from 'debug'
|
|
|
12
12
|
import {typeEvaluate, type TypeNode} from 'groq-js'
|
|
13
13
|
|
|
14
14
|
const $info = createDebug('sanity:codegen:generate:info')
|
|
15
|
-
const $warn = createDebug('sanity:codegen:generate:warn')
|
|
16
15
|
|
|
17
16
|
export interface TypegenGenerateTypesWorkerData {
|
|
18
17
|
workDir: string
|