@sanity/cli 3.93.1-next.8.cf0bf8550a → 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,53 +0,0 @@
|
|
|
1
|
-
import {processTemplate} from './processTemplate'
|
|
2
|
-
|
|
3
|
-
const defaultTemplate = `
|
|
4
|
-
import {defineConfig} from 'sanity'
|
|
5
|
-
import {structureTool} from 'sanity/structure'
|
|
6
|
-
import {visionTool} from '@sanity/vision'
|
|
7
|
-
import {schemaTypes} from './schemaTypes'
|
|
8
|
-
|
|
9
|
-
export default defineConfig({
|
|
10
|
-
name: '%sourceName%',
|
|
11
|
-
title: '%projectName%',
|
|
12
|
-
|
|
13
|
-
projectId: '%projectId%',
|
|
14
|
-
dataset: '%dataset%',
|
|
15
|
-
|
|
16
|
-
plugins: [structureTool(), visionTool()],
|
|
17
|
-
|
|
18
|
-
schema: {
|
|
19
|
-
types: schemaTypes,
|
|
20
|
-
},
|
|
21
|
-
})
|
|
22
|
-
`
|
|
23
|
-
|
|
24
|
-
const defaultVariables = {
|
|
25
|
-
projectName: 'Sanity Studio',
|
|
26
|
-
sourceName: 'default',
|
|
27
|
-
sourceTitle: 'Default',
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface GenerateConfigOptions {
|
|
31
|
-
template?: string | ((variables: GenerateConfigOptions['variables']) => string)
|
|
32
|
-
variables: {
|
|
33
|
-
projectId: string
|
|
34
|
-
dataset: string
|
|
35
|
-
autoUpdates: boolean
|
|
36
|
-
projectName?: string
|
|
37
|
-
sourceName?: string
|
|
38
|
-
sourceTitle?: string
|
|
39
|
-
organizationId?: string
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function createStudioConfig(options: GenerateConfigOptions): string {
|
|
44
|
-
const variables = {...defaultVariables, ...options.variables}
|
|
45
|
-
if (typeof options.template === 'function') {
|
|
46
|
-
return options.template(variables).trimStart()
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return processTemplate({
|
|
50
|
-
template: options.template || defaultTemplate,
|
|
51
|
-
variables,
|
|
52
|
-
})
|
|
53
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const appTemplates = ['app-quickstart', 'app-sanity-ui']
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Determine if a given template is a studio template.
|
|
5
|
-
* This function may need to be more robust once we
|
|
6
|
-
* introduce remote templates, for example.
|
|
7
|
-
*
|
|
8
|
-
* @param templateName - Name of the template
|
|
9
|
-
* @returns boolean indicating if the template is a studio template
|
|
10
|
-
*/
|
|
11
|
-
export function determineAppTemplate(templateName: string): boolean {
|
|
12
|
-
return appTemplates.includes(templateName)
|
|
13
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs'
|
|
2
|
-
import os from 'node:os'
|
|
3
|
-
import path from 'node:path'
|
|
4
|
-
|
|
5
|
-
export function validateEmptyPath(dir: string): true | string {
|
|
6
|
-
const checkPath = absolutify(dir)
|
|
7
|
-
return pathIsEmpty(checkPath) ? true : 'Given path is not empty'
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function absolutify(dir: string): string {
|
|
11
|
-
const pathName = expandHome(dir)
|
|
12
|
-
return path.isAbsolute(pathName) ? pathName : path.resolve(process.cwd(), pathName)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function pathIsEmpty(dir: string): boolean {
|
|
16
|
-
try {
|
|
17
|
-
// eslint-disable-next-line no-sync
|
|
18
|
-
const content = fs.readdirSync(dir)
|
|
19
|
-
return content.length === 0
|
|
20
|
-
} catch (err) {
|
|
21
|
-
if (err.code === 'ENOENT') {
|
|
22
|
-
return true
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
throw err
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function expandHome(filePath: string): string {
|
|
30
|
-
if (filePath.charCodeAt(0) === 126 /* ~ */) {
|
|
31
|
-
if (filePath.charCodeAt(1) === 43 /* + */) {
|
|
32
|
-
return path.join(process.cwd(), filePath.slice(2))
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const home = os.homedir()
|
|
36
|
-
return home ? path.join(home, filePath.slice(1)) : filePath
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return filePath
|
|
40
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import {execFileSync, execSync, type ExecSyncOptions} from 'node:child_process'
|
|
2
|
-
import path from 'node:path'
|
|
3
|
-
|
|
4
|
-
import {rimrafSync} from 'rimraf'
|
|
5
|
-
|
|
6
|
-
const defaultCommitMessage = 'feat: bootstrap sanity studio'
|
|
7
|
-
|
|
8
|
-
export function tryGitInit(rootDir: string, commitMessage?: string): boolean {
|
|
9
|
-
const execOptions: ExecSyncOptions = {stdio: 'ignore', cwd: rootDir}
|
|
10
|
-
|
|
11
|
-
let didInit = false
|
|
12
|
-
try {
|
|
13
|
-
execSync('git --version', execOptions)
|
|
14
|
-
if (isInGitRepository(rootDir) || isInMercurialRepository(rootDir)) {
|
|
15
|
-
return false
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
execSync('git init', execOptions)
|
|
19
|
-
didInit = true
|
|
20
|
-
|
|
21
|
-
execSync('git checkout -b main', execOptions)
|
|
22
|
-
|
|
23
|
-
execSync('git add -A', execOptions)
|
|
24
|
-
execFileSync('git', ['commit', '-m', commitMessage || defaultCommitMessage], {
|
|
25
|
-
stdio: 'ignore',
|
|
26
|
-
cwd: rootDir,
|
|
27
|
-
})
|
|
28
|
-
return true
|
|
29
|
-
} catch {
|
|
30
|
-
if (didInit) {
|
|
31
|
-
try {
|
|
32
|
-
rimrafSync(path.join(rootDir, '.git'))
|
|
33
|
-
} catch {
|
|
34
|
-
// intentional noop
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return false
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function isInGitRepository(rootDir: string): boolean {
|
|
42
|
-
try {
|
|
43
|
-
execSync('git rev-parse --is-inside-work-tree', {stdio: 'ignore', cwd: rootDir})
|
|
44
|
-
return true
|
|
45
|
-
} catch {
|
|
46
|
-
// intentional noop
|
|
47
|
-
}
|
|
48
|
-
return false
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function isInMercurialRepository(rootDir: string): boolean {
|
|
52
|
-
try {
|
|
53
|
-
execSync('hg --cwd . root', {stdio: 'ignore', cwd: rootDir})
|
|
54
|
-
return true
|
|
55
|
-
} catch {
|
|
56
|
-
// intentional noop
|
|
57
|
-
}
|
|
58
|
-
return false
|
|
59
|
-
}
|