@sanity/cli 3.93.1-next.9.198ab74452 → 3.94.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 +1 -1
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/package.json +10 -11
- package/templates/blog/README.md +1 -1
- package/templates/clean/README.md +1 -1
- package/templates/ecommerce/README.md +1 -1
- package/templates/get-started/README.md +1 -1
- package/templates/moviedb/README.md +1 -1
- package/templates/quickstart/README.md +1 -1
- package/src/CommandRunner.ts +0 -219
- package/src/__telemetry__/cli.telemetry.ts +0 -29
- package/src/__telemetry__/init.telemetry.ts +0 -95
- package/src/actions/codemod/codemodAction.ts +0 -109
- package/src/actions/codemod/mods/deskRename.ts +0 -19
- package/src/actions/codemod/mods/index.ts +0 -9
- package/src/actions/codemod/mods/partsTypeDirective.ts +0 -28
- package/src/actions/codemod/mods/reactIconsV3.ts +0 -54
- package/src/actions/codemod/types.ts +0 -10
- package/src/actions/init-plugin/bootstrapFromTemplate.ts +0 -196
- package/src/actions/init-project/bootstrapLocalTemplate.ts +0 -201
- package/src/actions/init-project/bootstrapRemoteTemplate.ts +0 -118
- package/src/actions/init-project/createAppCliConfig.ts +0 -24
- package/src/actions/init-project/createCliConfig.ts +0 -31
- package/src/actions/init-project/createPackageManifest.ts +0 -102
- package/src/actions/init-project/createStudioConfig.ts +0 -53
- package/src/actions/init-project/determineAppTemplate.ts +0 -13
- package/src/actions/init-project/fsUtils.ts +0 -40
- package/src/actions/init-project/git.ts +0 -59
- package/src/actions/init-project/initProject.ts +0 -1708
- package/src/actions/init-project/processTemplate.ts +0 -55
- package/src/actions/init-project/promptForDatasetName.ts +0 -68
- package/src/actions/init-project/prompts/index.ts +0 -51
- package/src/actions/init-project/prompts/nextjs.ts +0 -59
- package/src/actions/init-project/readPackageJson.ts +0 -17
- package/src/actions/init-project/templates/appQuickstart.ts +0 -23
- package/src/actions/init-project/templates/appSanityUi.ts +0 -25
- package/src/actions/init-project/templates/blog.ts +0 -5
- package/src/actions/init-project/templates/clean.ts +0 -5
- package/src/actions/init-project/templates/getStarted.ts +0 -37
- package/src/actions/init-project/templates/index.ts +0 -24
- package/src/actions/init-project/templates/moviedb.ts +0 -35
- package/src/actions/init-project/templates/nextjs/index.ts +0 -238
- package/src/actions/init-project/templates/nextjs/schemaTypes/blog.ts +0 -252
- package/src/actions/init-project/templates/quickstart.ts +0 -5
- package/src/actions/init-project/templates/shopify.ts +0 -78
- package/src/actions/init-project/templates/shopifyOnline.ts +0 -50
- package/src/actions/init-project/updateInitialTemplateMetadata.ts +0 -24
- package/src/actions/login/login.telemetry.ts +0 -18
- package/src/actions/login/login.ts +0 -350
- package/src/actions/login/types.ts +0 -19
- package/src/actions/project/createProject.ts +0 -36
- package/src/actions/telemetry/setTelemetryConsent.ts +0 -101
- package/src/actions/typegen/generate.telemetry.ts +0 -20
- package/src/actions/typegen/generateAction.ts +0 -210
- package/src/actions/versions/findSanityModuleVersions.ts +0 -185
- package/src/actions/yarn/events.ts +0 -73
- package/src/cli.ts +0 -350
- package/src/cliClient.ts +0 -62
- package/src/commands/blueprints/addBlueprintsCommand.ts +0 -155
- package/src/commands/blueprints/blueprintsGroup.ts +0 -10
- package/src/commands/blueprints/configBlueprintsCommand.ts +0 -86
- package/src/commands/blueprints/deployBlueprintsCommand.ts +0 -63
- package/src/commands/blueprints/destroyBlueprintsCommand.ts +0 -78
- package/src/commands/blueprints/infoBlueprintsCommand.ts +0 -55
- package/src/commands/blueprints/initBlueprintsCommand.ts +0 -99
- package/src/commands/blueprints/logsBlueprintsCommand.ts +0 -66
- package/src/commands/blueprints/planBlueprintsCommand.ts +0 -51
- package/src/commands/blueprints/stacksBlueprintsCommand.ts +0 -66
- package/src/commands/codemod/codemodCommand.ts +0 -32
- package/src/commands/debug/debugCommand.ts +0 -26
- package/src/commands/debug/printDebugInfo.ts +0 -243
- package/src/commands/docs/docsCommand.ts +0 -20
- package/src/commands/functions/devFunctionsCommand.ts +0 -73
- package/src/commands/functions/envFunctionsCommand.ts +0 -105
- package/src/commands/functions/functionsGroup.ts +0 -10
- package/src/commands/functions/logsFunctionsCommand.ts +0 -94
- package/src/commands/functions/testFunctionsCommand.ts +0 -93
- package/src/commands/help/helpCommand.ts +0 -21
- package/src/commands/help/showHelp.ts +0 -58
- package/src/commands/index.ts +0 -72
- package/src/commands/init/initCommand.ts +0 -123
- package/src/commands/install/installCommand.ts +0 -38
- package/src/commands/learn/learnCommand.ts +0 -20
- package/src/commands/login/loginCommand.ts +0 -29
- package/src/commands/logout/logoutCommand.ts +0 -52
- package/src/commands/manage/manageCommand.ts +0 -24
- package/src/commands/projects/listProjectsCommand.ts +0 -62
- package/src/commands/projects/projectsGroup.ts +0 -10
- package/src/commands/telemetry/disableTelemetryCommand.ts +0 -19
- package/src/commands/telemetry/enableTelemetryCommand.ts +0 -19
- package/src/commands/telemetry/telemetryGroup.ts +0 -10
- package/src/commands/telemetry/telemetryStatusCommand.ts +0 -89
- package/src/commands/typegen/generateTypesCommand.ts +0 -56
- package/src/commands/typegen/typegenGroup.ts +0 -10
- package/src/commands/versions/printVersionResult.ts +0 -51
- package/src/commands/versions/versionsCommand.ts +0 -13
- package/src/config.ts +0 -14
- package/src/debug.ts +0 -3
- package/src/index.ts +0 -6
- package/src/outputters/cliOutputter.ts +0 -47
- package/src/packageManager/getInstallCommand.ts +0 -26
- package/src/packageManager/getUpgradeCommand.ts +0 -52
- package/src/packageManager/index.ts +0 -33
- package/src/packageManager/installPackages.ts +0 -99
- package/src/packageManager/packageManagerChoice.ts +0 -204
- package/src/packageManager/uninstallPackages.ts +0 -44
- package/src/packageManager/yarnStub.ts +0 -22
- package/src/prompters/cliPrompter.ts +0 -9
- package/src/run.ts +0 -8
- package/src/studioDependencies.ts +0 -25
- package/src/types.ts +0 -387
- package/src/util/canLaunchBrowser.ts +0 -12
- package/src/util/cliWorker.ts +0 -34
- package/src/util/clientWrapper.ts +0 -119
- package/src/util/copy.ts +0 -50
- package/src/util/createExpiringConfig.ts +0 -80
- package/src/util/createTelemetryStore.ts +0 -204
- package/src/util/detectRuntime.ts +0 -12
- package/src/util/dynamicRequire.ts +0 -17
- package/src/util/frameworkPort.ts +0 -63
- package/src/util/generateCommandsDocumentation.ts +0 -62
- package/src/util/getCliConfig.ts +0 -172
- package/src/util/getCliVersion.ts +0 -22
- package/src/util/getLocalVersion.ts +0 -35
- package/src/util/getProjectDefaults.ts +0 -103
- package/src/util/getProviderName.ts +0 -9
- package/src/util/getUserConfig.ts +0 -15
- package/src/util/isCi.ts +0 -7
- package/src/util/isCommandGroup.ts +0 -7
- package/src/util/isInteractive.ts +0 -3
- package/src/util/isTrueish.ts +0 -8
- package/src/util/journeyConfig.ts +0 -280
- package/src/util/loadEnv.ts +0 -110
- package/src/util/mergeCommands.ts +0 -78
- package/src/util/neatStack.ts +0 -30
- package/src/util/noSuchCommandText.ts +0 -91
- package/src/util/parseArguments.ts +0 -76
- package/src/util/pathExists.ts +0 -14
- package/src/util/readJson.ts +0 -6
- package/src/util/readdirRecursive.ts +0 -26
- package/src/util/remoteTemplate.ts +0 -320
- package/src/util/resolveLatestVersions.ts +0 -24
- package/src/util/resolveRootDir.ts +0 -59
- package/src/util/telemetryDisclosure.ts +0 -45
- package/src/util/updateNotifier.ts +0 -158
- package/src/util/writeJson.ts +0 -6
- package/src/workers/getAndWriteJourneySchema.ts +0 -7
- package/src/workers/getCliConfig.ts +0 -14
- package/src/workers/typegenGenerate.ts +0 -228
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {type CliCommandDefinition} from '../../types'
|
|
2
|
-
|
|
3
|
-
const helpText = `
|
|
4
|
-
Options
|
|
5
|
-
--no-wait Do not wait for deployment to complete
|
|
6
|
-
|
|
7
|
-
Examples:
|
|
8
|
-
# Deploy the current blueprint
|
|
9
|
-
sanity blueprints deploy
|
|
10
|
-
|
|
11
|
-
# Deploy the current blueprint without waiting for completion
|
|
12
|
-
sanity blueprints deploy --no-wait
|
|
13
|
-
`
|
|
14
|
-
|
|
15
|
-
export interface BlueprintsDeployFlags {
|
|
16
|
-
'no-wait'?: boolean
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const defaultFlags: BlueprintsDeployFlags = {
|
|
20
|
-
//
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const deployBlueprintsCommand: CliCommandDefinition<BlueprintsDeployFlags> = {
|
|
24
|
-
name: 'deploy',
|
|
25
|
-
group: 'blueprints',
|
|
26
|
-
helpText,
|
|
27
|
-
signature: '[--no-wait]',
|
|
28
|
-
description: 'Deploy a Blueprint to create or update a Stack',
|
|
29
|
-
|
|
30
|
-
async action(args, context) {
|
|
31
|
-
const {apiClient, output} = context
|
|
32
|
-
const flags = {...defaultFlags, ...args.extOptions}
|
|
33
|
-
|
|
34
|
-
const client = apiClient({
|
|
35
|
-
requireUser: true,
|
|
36
|
-
requireProject: false,
|
|
37
|
-
})
|
|
38
|
-
const {token} = client.config()
|
|
39
|
-
if (!token) throw new Error('No API token found. Please run `sanity login`.')
|
|
40
|
-
|
|
41
|
-
const {initDeployedBlueprintConfig} = await import('@sanity/runtime-cli/cores')
|
|
42
|
-
const {blueprintDeployCore} = await import('@sanity/runtime-cli/cores/blueprints')
|
|
43
|
-
|
|
44
|
-
const cmdConfig = await initDeployedBlueprintConfig({
|
|
45
|
-
bin: 'sanity',
|
|
46
|
-
log: (message) => output.print(message),
|
|
47
|
-
token,
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
if (!cmdConfig.ok) throw new Error(cmdConfig.error)
|
|
51
|
-
|
|
52
|
-
const {success, error} = await blueprintDeployCore({
|
|
53
|
-
...cmdConfig.value,
|
|
54
|
-
flags: {
|
|
55
|
-
'no-wait': flags['no-wait'],
|
|
56
|
-
},
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
if (!success) throw new Error(error)
|
|
60
|
-
},
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default deployBlueprintsCommand
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import {type CliCommandDefinition} from '../../types'
|
|
2
|
-
|
|
3
|
-
const helpText = `
|
|
4
|
-
Options
|
|
5
|
-
--force, -f Force destroy without confirmation
|
|
6
|
-
--no-wait Do not wait for destroy to complete
|
|
7
|
-
|
|
8
|
-
Examples:
|
|
9
|
-
# Destroy the current deployment
|
|
10
|
-
sanity blueprints destroy
|
|
11
|
-
|
|
12
|
-
# Force destroy without confirmation
|
|
13
|
-
sanity blueprints destroy --force
|
|
14
|
-
|
|
15
|
-
# Destroy without waiting for completion
|
|
16
|
-
sanity blueprints destroy --no-wait
|
|
17
|
-
`
|
|
18
|
-
|
|
19
|
-
export interface BlueprintsDestroyFlags {
|
|
20
|
-
'force'?: boolean
|
|
21
|
-
'f'?: boolean
|
|
22
|
-
'project-id'?: string
|
|
23
|
-
'projectId'?: string
|
|
24
|
-
'project'?: string
|
|
25
|
-
'stack-id'?: string
|
|
26
|
-
'stackId'?: string
|
|
27
|
-
'stack'?: string
|
|
28
|
-
'no-wait'?: boolean
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const defaultFlags: BlueprintsDestroyFlags = {
|
|
32
|
-
//
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const destroyBlueprintsCommand: CliCommandDefinition<BlueprintsDestroyFlags> = {
|
|
36
|
-
name: 'destroy',
|
|
37
|
-
group: 'blueprints',
|
|
38
|
-
helpText,
|
|
39
|
-
signature: '[--force] [-f] [--no-wait]',
|
|
40
|
-
description: 'Destroy a Blueprint deployment',
|
|
41
|
-
|
|
42
|
-
async action(args, context) {
|
|
43
|
-
const {apiClient, output} = context
|
|
44
|
-
const flags = {...defaultFlags, ...args.extOptions}
|
|
45
|
-
|
|
46
|
-
const client = apiClient({
|
|
47
|
-
requireUser: true,
|
|
48
|
-
requireProject: false,
|
|
49
|
-
})
|
|
50
|
-
const {token} = client.config()
|
|
51
|
-
if (!token) throw new Error('No API token found. Please run `sanity login`.')
|
|
52
|
-
|
|
53
|
-
const {initBlueprintConfig} = await import('@sanity/runtime-cli/cores')
|
|
54
|
-
const {blueprintDestroyCore} = await import('@sanity/runtime-cli/cores/blueprints')
|
|
55
|
-
|
|
56
|
-
const cmdConfig = await initBlueprintConfig({
|
|
57
|
-
bin: 'sanity',
|
|
58
|
-
log: (message) => output.print(message),
|
|
59
|
-
token,
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
if (!cmdConfig.ok) throw new Error(cmdConfig.error)
|
|
63
|
-
|
|
64
|
-
const {success, error} = await blueprintDestroyCore({
|
|
65
|
-
...cmdConfig.value,
|
|
66
|
-
flags: {
|
|
67
|
-
'no-wait': flags['no-wait'],
|
|
68
|
-
'force': flags.force ?? flags.f,
|
|
69
|
-
'project-id': flags['project-id'] ?? flags.projectId ?? flags.project,
|
|
70
|
-
'stack-id': flags['stack-id'] ?? flags.stackId ?? flags.stack,
|
|
71
|
-
},
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
if (!success) throw new Error(error)
|
|
75
|
-
},
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export default destroyBlueprintsCommand
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import {type CliCommandDefinition} from '../../types'
|
|
2
|
-
|
|
3
|
-
const helpText = `
|
|
4
|
-
Examples:
|
|
5
|
-
# Retrieve information about the current Stack
|
|
6
|
-
sanity blueprints info
|
|
7
|
-
`
|
|
8
|
-
|
|
9
|
-
export interface BlueprintsInfoFlags {
|
|
10
|
-
id?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const defaultFlags: BlueprintsInfoFlags = {
|
|
14
|
-
//
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const infoBlueprintsCommand: CliCommandDefinition<BlueprintsInfoFlags> = {
|
|
18
|
-
name: 'info',
|
|
19
|
-
group: 'blueprints',
|
|
20
|
-
helpText,
|
|
21
|
-
signature: '',
|
|
22
|
-
description: 'Retrieve information about a Blueprint Stack',
|
|
23
|
-
|
|
24
|
-
async action(args, context) {
|
|
25
|
-
const {apiClient, output} = context
|
|
26
|
-
const flags = {...defaultFlags, ...args.extOptions}
|
|
27
|
-
|
|
28
|
-
const client = apiClient({
|
|
29
|
-
requireUser: true,
|
|
30
|
-
requireProject: false,
|
|
31
|
-
})
|
|
32
|
-
const {token} = client.config()
|
|
33
|
-
if (!token) throw new Error('No API token found. Please run `sanity login`.')
|
|
34
|
-
|
|
35
|
-
const {initDeployedBlueprintConfig} = await import('@sanity/runtime-cli/cores')
|
|
36
|
-
const {blueprintInfoCore} = await import('@sanity/runtime-cli/cores/blueprints')
|
|
37
|
-
|
|
38
|
-
const cmdConfig = await initDeployedBlueprintConfig({
|
|
39
|
-
bin: 'sanity',
|
|
40
|
-
log: (message) => output.print(message),
|
|
41
|
-
token,
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
if (!cmdConfig.ok) throw new Error(cmdConfig.error)
|
|
45
|
-
|
|
46
|
-
const {success, error} = await blueprintInfoCore({
|
|
47
|
-
...cmdConfig.value,
|
|
48
|
-
flags,
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
if (!success) throw new Error(error)
|
|
52
|
-
},
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export default infoBlueprintsCommand
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import {type CliCommandDefinition} from '../../types'
|
|
2
|
-
|
|
3
|
-
const helpText = `
|
|
4
|
-
Arguments
|
|
5
|
-
[dir] Path to initialize the Blueprint in
|
|
6
|
-
|
|
7
|
-
Options
|
|
8
|
-
--blueprint-type, --type <json> Type of Blueprint to create
|
|
9
|
-
--project-id <id> Project ID to use
|
|
10
|
-
|
|
11
|
-
Examples:
|
|
12
|
-
# Create a new Blueprint project in the current directory
|
|
13
|
-
sanity blueprints init
|
|
14
|
-
|
|
15
|
-
# Create a new Blueprint project in a specific directory
|
|
16
|
-
sanity blueprints init my-sanity-project --type json
|
|
17
|
-
|
|
18
|
-
# Create a new Blueprint project in a specific directory with an example
|
|
19
|
-
sanity blueprints init --example example-name
|
|
20
|
-
`
|
|
21
|
-
|
|
22
|
-
export interface BlueprintsInitFlags {
|
|
23
|
-
'example'?: string
|
|
24
|
-
'dir'?: string
|
|
25
|
-
'blueprint-type'?: string
|
|
26
|
-
'type'?: string
|
|
27
|
-
'project-id'?: string
|
|
28
|
-
'projectId'?: string
|
|
29
|
-
'project'?: string
|
|
30
|
-
'stack-id'?: string
|
|
31
|
-
'stackId'?: string
|
|
32
|
-
'stack'?: string
|
|
33
|
-
'stack-name'?: string
|
|
34
|
-
'name'?: string
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const defaultFlags: BlueprintsInitFlags = {
|
|
38
|
-
//
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const initBlueprintsCommand: CliCommandDefinition<BlueprintsInitFlags> = {
|
|
42
|
-
name: 'init',
|
|
43
|
-
group: 'blueprints',
|
|
44
|
-
helpText,
|
|
45
|
-
signature: '[dir] [--blueprint-type <type>] [--project-id <id>]',
|
|
46
|
-
description: 'Initialize a new Blueprint manifest file',
|
|
47
|
-
|
|
48
|
-
async action(args, context) {
|
|
49
|
-
const {apiClient, output} = context
|
|
50
|
-
const flags = {...defaultFlags, ...args.extOptions}
|
|
51
|
-
|
|
52
|
-
const [dir] = args.argsWithoutOptions
|
|
53
|
-
|
|
54
|
-
const client = apiClient({
|
|
55
|
-
requireUser: true,
|
|
56
|
-
requireProject: false,
|
|
57
|
-
})
|
|
58
|
-
const {token} = client.config()
|
|
59
|
-
if (!token) throw new Error('No API token found. Please run `sanity login`.')
|
|
60
|
-
|
|
61
|
-
const {blueprintInitCore} = await import('@sanity/runtime-cli/cores/blueprints')
|
|
62
|
-
|
|
63
|
-
if (flags.example) {
|
|
64
|
-
const conflictingFlags: (keyof BlueprintsInitFlags)[] = [
|
|
65
|
-
'blueprint-type',
|
|
66
|
-
'type',
|
|
67
|
-
'stack-id',
|
|
68
|
-
'stackId',
|
|
69
|
-
'stack',
|
|
70
|
-
'stack-name',
|
|
71
|
-
'name',
|
|
72
|
-
]
|
|
73
|
-
const foundConflict = conflictingFlags.find((key) => flags[key])
|
|
74
|
-
if (foundConflict) {
|
|
75
|
-
throw new Error(`--example can't be used with --${foundConflict}`)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const {success, error} = await blueprintInitCore({
|
|
80
|
-
bin: 'sanity',
|
|
81
|
-
log: (message) => output.print(message),
|
|
82
|
-
token,
|
|
83
|
-
args: {
|
|
84
|
-
dir: dir ?? flags.dir,
|
|
85
|
-
},
|
|
86
|
-
flags: {
|
|
87
|
-
'example': flags.example,
|
|
88
|
-
'blueprint-type': flags['blueprint-type'] ?? flags.type,
|
|
89
|
-
'project-id': flags['project-id'] ?? flags.projectId ?? flags.project,
|
|
90
|
-
'stack-id': flags['stack-id'] ?? flags.stackId ?? flags.stack,
|
|
91
|
-
'stack-name': flags['stack-name'] ?? flags.name,
|
|
92
|
-
},
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
if (!success) throw new Error(error)
|
|
96
|
-
},
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export default initBlueprintsCommand
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import {type CliCommandDefinition} from '../../types'
|
|
2
|
-
|
|
3
|
-
const helpText = `
|
|
4
|
-
Options
|
|
5
|
-
--watch, -w Watch for new logs (streaming mode)
|
|
6
|
-
|
|
7
|
-
Examples:
|
|
8
|
-
# Show logs for the current Stack
|
|
9
|
-
sanity blueprints logs
|
|
10
|
-
|
|
11
|
-
# Watch for new logs (streaming mode)
|
|
12
|
-
sanity blueprints logs --watch
|
|
13
|
-
`
|
|
14
|
-
|
|
15
|
-
export interface BlueprintsLogsFlags {
|
|
16
|
-
watch?: boolean
|
|
17
|
-
w?: boolean
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const defaultFlags: BlueprintsLogsFlags = {
|
|
21
|
-
//
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const logsBlueprintsCommand: CliCommandDefinition<BlueprintsLogsFlags> = {
|
|
25
|
-
name: 'logs',
|
|
26
|
-
group: 'blueprints',
|
|
27
|
-
helpText,
|
|
28
|
-
signature: '[--watch] [-w]',
|
|
29
|
-
description: 'Display logs for the current Blueprint Stack',
|
|
30
|
-
|
|
31
|
-
async action(args, context) {
|
|
32
|
-
const {apiClient, output} = context
|
|
33
|
-
const flags = {...defaultFlags, ...args.extOptions}
|
|
34
|
-
|
|
35
|
-
const client = apiClient({
|
|
36
|
-
requireUser: true,
|
|
37
|
-
requireProject: false,
|
|
38
|
-
})
|
|
39
|
-
const {token} = client.config()
|
|
40
|
-
if (!token) throw new Error('No API token found. Please run `sanity login`.')
|
|
41
|
-
|
|
42
|
-
const {initDeployedBlueprintConfig} = await import('@sanity/runtime-cli/cores')
|
|
43
|
-
const {blueprintLogsCore} = await import('@sanity/runtime-cli/cores/blueprints')
|
|
44
|
-
|
|
45
|
-
const cmdConfig = await initDeployedBlueprintConfig({
|
|
46
|
-
bin: 'sanity',
|
|
47
|
-
log: (message) => output.print(message),
|
|
48
|
-
token,
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
if (!cmdConfig.ok) throw new Error(cmdConfig.error)
|
|
52
|
-
|
|
53
|
-
const {success, streaming, error} = await blueprintLogsCore({
|
|
54
|
-
...cmdConfig.value,
|
|
55
|
-
flags: {
|
|
56
|
-
watch: flags.watch ?? flags.w,
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
if (streaming) await streaming
|
|
61
|
-
|
|
62
|
-
if (!success) throw new Error(error)
|
|
63
|
-
},
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export default logsBlueprintsCommand
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {type CliCommandDefinition} from '../../types'
|
|
2
|
-
|
|
3
|
-
const helpText = `
|
|
4
|
-
Safe to run at any time. Will not modify any Resources.
|
|
5
|
-
|
|
6
|
-
Examples:
|
|
7
|
-
# Show deployment plan for the current Blueprint
|
|
8
|
-
sanity blueprints plan
|
|
9
|
-
`
|
|
10
|
-
|
|
11
|
-
export interface BlueprintsPlanFlags {
|
|
12
|
-
//
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const planBlueprintsCommand: CliCommandDefinition<BlueprintsPlanFlags> = {
|
|
16
|
-
name: 'plan',
|
|
17
|
-
group: 'blueprints',
|
|
18
|
-
helpText,
|
|
19
|
-
signature: '',
|
|
20
|
-
description: 'Enumerate Resources to be deployed',
|
|
21
|
-
|
|
22
|
-
async action(args, context) {
|
|
23
|
-
const {apiClient, output} = context
|
|
24
|
-
|
|
25
|
-
const client = apiClient({
|
|
26
|
-
requireUser: true,
|
|
27
|
-
requireProject: false,
|
|
28
|
-
})
|
|
29
|
-
const {token} = client.config()
|
|
30
|
-
if (!token) throw new Error('No API token found. Please run `sanity login`.')
|
|
31
|
-
|
|
32
|
-
const {initBlueprintConfig} = await import('@sanity/runtime-cli/cores')
|
|
33
|
-
const {blueprintPlanCore} = await import('@sanity/runtime-cli/cores/blueprints')
|
|
34
|
-
|
|
35
|
-
const cmdConfig = await initBlueprintConfig({
|
|
36
|
-
bin: 'sanity',
|
|
37
|
-
log: (message) => output.print(message),
|
|
38
|
-
token,
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
if (!cmdConfig.ok) throw new Error(cmdConfig.error)
|
|
42
|
-
|
|
43
|
-
const {success, error} = await blueprintPlanCore({
|
|
44
|
-
...cmdConfig.value,
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
if (!success) throw new Error(error)
|
|
48
|
-
},
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default planBlueprintsCommand
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import {type CliCommandDefinition} from '../../types'
|
|
2
|
-
|
|
3
|
-
const helpText = `
|
|
4
|
-
Options
|
|
5
|
-
--project-id <id> Project ID to use
|
|
6
|
-
|
|
7
|
-
Examples:
|
|
8
|
-
# List all Stacks for the current Project
|
|
9
|
-
sanity blueprints stacks
|
|
10
|
-
|
|
11
|
-
# List Stacks for a specific project
|
|
12
|
-
sanity blueprints stacks --project-id abc123
|
|
13
|
-
`
|
|
14
|
-
|
|
15
|
-
export interface BlueprintsStacksFlags {
|
|
16
|
-
'project-id'?: string
|
|
17
|
-
'projectId'?: string
|
|
18
|
-
'project'?: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const defaultFlags: BlueprintsStacksFlags = {
|
|
22
|
-
//
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const stacksBlueprintsCommand: CliCommandDefinition<BlueprintsStacksFlags> = {
|
|
26
|
-
name: 'stacks',
|
|
27
|
-
group: 'blueprints',
|
|
28
|
-
helpText,
|
|
29
|
-
signature: '[--project-id <id>]',
|
|
30
|
-
description: 'List all Blueprint Stacks for the current Project',
|
|
31
|
-
hideFromHelp: true,
|
|
32
|
-
|
|
33
|
-
async action(args, context) {
|
|
34
|
-
const {apiClient, output} = context
|
|
35
|
-
const flags = {...defaultFlags, ...args.extOptions}
|
|
36
|
-
|
|
37
|
-
const client = apiClient({
|
|
38
|
-
requireUser: true,
|
|
39
|
-
requireProject: false,
|
|
40
|
-
})
|
|
41
|
-
const {token} = client.config()
|
|
42
|
-
if (!token) throw new Error('No API token found. Please run `sanity login`.')
|
|
43
|
-
|
|
44
|
-
const {initBlueprintConfig} = await import('@sanity/runtime-cli/cores')
|
|
45
|
-
const {blueprintStacksCore} = await import('@sanity/runtime-cli/cores/blueprints')
|
|
46
|
-
|
|
47
|
-
const cmdConfig = await initBlueprintConfig({
|
|
48
|
-
bin: 'sanity',
|
|
49
|
-
log: (message) => output.print(message),
|
|
50
|
-
token,
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
if (!cmdConfig.ok) throw new Error(cmdConfig.error)
|
|
54
|
-
|
|
55
|
-
const {success, error} = await blueprintStacksCore({
|
|
56
|
-
...cmdConfig.value,
|
|
57
|
-
flags: {
|
|
58
|
-
'project-id': flags['project-id'] ?? flags.projectId ?? flags.project,
|
|
59
|
-
},
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
if (!success) throw new Error(error)
|
|
63
|
-
},
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export default stacksBlueprintsCommand
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {codemodAction} from '../../actions/codemod/codemodAction'
|
|
2
|
-
import {type CliCommandDefinition} from '../../types'
|
|
3
|
-
|
|
4
|
-
const helpText = `
|
|
5
|
-
Runs a given code modification script on the current studio folder.
|
|
6
|
-
Running the command without a specified codemod name will list available transformations.
|
|
7
|
-
|
|
8
|
-
Options
|
|
9
|
-
--dry Dry run (no changes are made to files)
|
|
10
|
-
--extensions=EXT Transform files with these file extensions (comma separated list)
|
|
11
|
-
(default: js,ts,tsx)
|
|
12
|
-
--no-verify Skips verification steps before running codemod
|
|
13
|
-
|
|
14
|
-
Examples
|
|
15
|
-
# Show available code mods
|
|
16
|
-
sanity codemod
|
|
17
|
-
|
|
18
|
-
# Run codemod to transform react-icons imports from v2 style to v3 style,
|
|
19
|
-
# but only as a dry-run (do not write the files)
|
|
20
|
-
sanity codemod reactIconsV3 --dry
|
|
21
|
-
|
|
22
|
-
`
|
|
23
|
-
|
|
24
|
-
const codemodCommand: CliCommandDefinition = {
|
|
25
|
-
name: 'codemod',
|
|
26
|
-
signature: '[CODEMOD_NAME]',
|
|
27
|
-
description: 'Updates Sanity Studio codebase with a code modification script',
|
|
28
|
-
helpText,
|
|
29
|
-
action: codemodAction,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default codemodCommand
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {type CliCommandDefinition} from '../../types'
|
|
2
|
-
import {printDebugInfo} from './printDebugInfo'
|
|
3
|
-
|
|
4
|
-
const help = `
|
|
5
|
-
Used to find information about the Sanity environment, and to debug Sanity-related issues.
|
|
6
|
-
|
|
7
|
-
Options
|
|
8
|
-
--secrets Include API keys in output
|
|
9
|
-
|
|
10
|
-
Examples
|
|
11
|
-
# Show information about the user, project, and local/global Sanity environment
|
|
12
|
-
sanity debug
|
|
13
|
-
|
|
14
|
-
# Include API keys in the output
|
|
15
|
-
sanity debug --secrets
|
|
16
|
-
`
|
|
17
|
-
|
|
18
|
-
const debugCommand: CliCommandDefinition = {
|
|
19
|
-
name: 'debug',
|
|
20
|
-
signature: '[--secrets]',
|
|
21
|
-
description: 'Provides diagnostic info for Sanity Studio troubleshooting',
|
|
22
|
-
helpText: help,
|
|
23
|
-
action: printDebugInfo,
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export default debugCommand
|