@sanity/cli 3.93.0 → 3.93.1-bump-pkg-utils.34.5d0c0b3d22

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.
Files changed (160) hide show
  1. package/lib/_chunks-cjs/cli.js +5 -5
  2. package/lib/_chunks-cjs/cli.js.map +1 -1
  3. package/lib/_chunks-cjs/cliWorker.js.map +1 -1
  4. package/lib/_chunks-cjs/generateAction.js.map +1 -1
  5. package/lib/_chunks-cjs/getCliConfig.js.map +1 -1
  6. package/lib/_chunks-cjs/journeyConfig.js.map +1 -1
  7. package/lib/_chunks-cjs/loadEnv.js.map +1 -1
  8. package/lib/index.js.map +1 -1
  9. package/lib/index.mjs.map +1 -1
  10. package/lib/run.js.map +1 -1
  11. package/lib/workers/getAndWriteJourneySchema.js.map +1 -1
  12. package/lib/workers/getCliConfig.js.map +1 -1
  13. package/lib/workers/typegenGenerate.js.map +1 -1
  14. package/package.json +6 -7
  15. package/templates/blog/README.md +1 -1
  16. package/templates/clean/README.md +1 -1
  17. package/templates/ecommerce/README.md +1 -1
  18. package/templates/get-started/README.md +1 -1
  19. package/templates/moviedb/README.md +1 -1
  20. package/templates/quickstart/README.md +1 -1
  21. package/src/CommandRunner.ts +0 -219
  22. package/src/__telemetry__/cli.telemetry.ts +0 -29
  23. package/src/__telemetry__/init.telemetry.ts +0 -95
  24. package/src/actions/codemod/codemodAction.ts +0 -109
  25. package/src/actions/codemod/mods/deskRename.ts +0 -19
  26. package/src/actions/codemod/mods/index.ts +0 -9
  27. package/src/actions/codemod/mods/partsTypeDirective.ts +0 -28
  28. package/src/actions/codemod/mods/reactIconsV3.ts +0 -54
  29. package/src/actions/codemod/types.ts +0 -10
  30. package/src/actions/init-plugin/bootstrapFromTemplate.ts +0 -196
  31. package/src/actions/init-project/bootstrapLocalTemplate.ts +0 -201
  32. package/src/actions/init-project/bootstrapRemoteTemplate.ts +0 -118
  33. package/src/actions/init-project/createAppCliConfig.ts +0 -24
  34. package/src/actions/init-project/createCliConfig.ts +0 -31
  35. package/src/actions/init-project/createPackageManifest.ts +0 -102
  36. package/src/actions/init-project/createStudioConfig.ts +0 -53
  37. package/src/actions/init-project/determineAppTemplate.ts +0 -13
  38. package/src/actions/init-project/fsUtils.ts +0 -40
  39. package/src/actions/init-project/git.ts +0 -59
  40. package/src/actions/init-project/initProject.ts +0 -1708
  41. package/src/actions/init-project/processTemplate.ts +0 -55
  42. package/src/actions/init-project/promptForDatasetName.ts +0 -68
  43. package/src/actions/init-project/prompts/index.ts +0 -51
  44. package/src/actions/init-project/prompts/nextjs.ts +0 -59
  45. package/src/actions/init-project/readPackageJson.ts +0 -17
  46. package/src/actions/init-project/templates/appQuickstart.ts +0 -23
  47. package/src/actions/init-project/templates/appSanityUi.ts +0 -25
  48. package/src/actions/init-project/templates/blog.ts +0 -5
  49. package/src/actions/init-project/templates/clean.ts +0 -5
  50. package/src/actions/init-project/templates/getStarted.ts +0 -37
  51. package/src/actions/init-project/templates/index.ts +0 -24
  52. package/src/actions/init-project/templates/moviedb.ts +0 -35
  53. package/src/actions/init-project/templates/nextjs/index.ts +0 -238
  54. package/src/actions/init-project/templates/nextjs/schemaTypes/blog.ts +0 -252
  55. package/src/actions/init-project/templates/quickstart.ts +0 -5
  56. package/src/actions/init-project/templates/shopify.ts +0 -78
  57. package/src/actions/init-project/templates/shopifyOnline.ts +0 -50
  58. package/src/actions/init-project/updateInitialTemplateMetadata.ts +0 -24
  59. package/src/actions/login/login.telemetry.ts +0 -18
  60. package/src/actions/login/login.ts +0 -350
  61. package/src/actions/login/types.ts +0 -19
  62. package/src/actions/project/createProject.ts +0 -36
  63. package/src/actions/telemetry/setTelemetryConsent.ts +0 -101
  64. package/src/actions/typegen/generate.telemetry.ts +0 -20
  65. package/src/actions/typegen/generateAction.ts +0 -210
  66. package/src/actions/versions/findSanityModuleVersions.ts +0 -185
  67. package/src/actions/yarn/events.ts +0 -73
  68. package/src/cli.ts +0 -350
  69. package/src/cliClient.ts +0 -62
  70. package/src/commands/blueprints/addBlueprintsCommand.ts +0 -155
  71. package/src/commands/blueprints/blueprintsGroup.ts +0 -10
  72. package/src/commands/blueprints/configBlueprintsCommand.ts +0 -86
  73. package/src/commands/blueprints/deployBlueprintsCommand.ts +0 -63
  74. package/src/commands/blueprints/destroyBlueprintsCommand.ts +0 -78
  75. package/src/commands/blueprints/infoBlueprintsCommand.ts +0 -55
  76. package/src/commands/blueprints/initBlueprintsCommand.ts +0 -99
  77. package/src/commands/blueprints/logsBlueprintsCommand.ts +0 -66
  78. package/src/commands/blueprints/planBlueprintsCommand.ts +0 -51
  79. package/src/commands/blueprints/stacksBlueprintsCommand.ts +0 -66
  80. package/src/commands/codemod/codemodCommand.ts +0 -32
  81. package/src/commands/debug/debugCommand.ts +0 -26
  82. package/src/commands/debug/printDebugInfo.ts +0 -243
  83. package/src/commands/docs/docsCommand.ts +0 -20
  84. package/src/commands/functions/devFunctionsCommand.ts +0 -73
  85. package/src/commands/functions/envFunctionsCommand.ts +0 -105
  86. package/src/commands/functions/functionsGroup.ts +0 -10
  87. package/src/commands/functions/logsFunctionsCommand.ts +0 -94
  88. package/src/commands/functions/testFunctionsCommand.ts +0 -93
  89. package/src/commands/help/helpCommand.ts +0 -21
  90. package/src/commands/help/showHelp.ts +0 -58
  91. package/src/commands/index.ts +0 -72
  92. package/src/commands/init/initCommand.ts +0 -123
  93. package/src/commands/install/installCommand.ts +0 -38
  94. package/src/commands/learn/learnCommand.ts +0 -20
  95. package/src/commands/login/loginCommand.ts +0 -29
  96. package/src/commands/logout/logoutCommand.ts +0 -52
  97. package/src/commands/manage/manageCommand.ts +0 -24
  98. package/src/commands/projects/listProjectsCommand.ts +0 -62
  99. package/src/commands/projects/projectsGroup.ts +0 -10
  100. package/src/commands/telemetry/disableTelemetryCommand.ts +0 -19
  101. package/src/commands/telemetry/enableTelemetryCommand.ts +0 -19
  102. package/src/commands/telemetry/telemetryGroup.ts +0 -10
  103. package/src/commands/telemetry/telemetryStatusCommand.ts +0 -89
  104. package/src/commands/typegen/generateTypesCommand.ts +0 -56
  105. package/src/commands/typegen/typegenGroup.ts +0 -10
  106. package/src/commands/versions/printVersionResult.ts +0 -51
  107. package/src/commands/versions/versionsCommand.ts +0 -13
  108. package/src/config.ts +0 -14
  109. package/src/debug.ts +0 -3
  110. package/src/index.ts +0 -6
  111. package/src/outputters/cliOutputter.ts +0 -47
  112. package/src/packageManager/getInstallCommand.ts +0 -26
  113. package/src/packageManager/getUpgradeCommand.ts +0 -52
  114. package/src/packageManager/index.ts +0 -33
  115. package/src/packageManager/installPackages.ts +0 -99
  116. package/src/packageManager/packageManagerChoice.ts +0 -204
  117. package/src/packageManager/uninstallPackages.ts +0 -44
  118. package/src/packageManager/yarnStub.ts +0 -22
  119. package/src/prompters/cliPrompter.ts +0 -9
  120. package/src/run.ts +0 -8
  121. package/src/studioDependencies.ts +0 -25
  122. package/src/types.ts +0 -387
  123. package/src/util/canLaunchBrowser.ts +0 -12
  124. package/src/util/cliWorker.ts +0 -34
  125. package/src/util/clientWrapper.ts +0 -119
  126. package/src/util/copy.ts +0 -50
  127. package/src/util/createExpiringConfig.ts +0 -80
  128. package/src/util/createTelemetryStore.ts +0 -204
  129. package/src/util/detectRuntime.ts +0 -12
  130. package/src/util/dynamicRequire.ts +0 -17
  131. package/src/util/frameworkPort.ts +0 -63
  132. package/src/util/generateCommandsDocumentation.ts +0 -62
  133. package/src/util/getCliConfig.ts +0 -172
  134. package/src/util/getCliVersion.ts +0 -22
  135. package/src/util/getLocalVersion.ts +0 -35
  136. package/src/util/getProjectDefaults.ts +0 -103
  137. package/src/util/getProviderName.ts +0 -9
  138. package/src/util/getUserConfig.ts +0 -15
  139. package/src/util/isCi.ts +0 -7
  140. package/src/util/isCommandGroup.ts +0 -7
  141. package/src/util/isInteractive.ts +0 -3
  142. package/src/util/isTrueish.ts +0 -8
  143. package/src/util/journeyConfig.ts +0 -280
  144. package/src/util/loadEnv.ts +0 -110
  145. package/src/util/mergeCommands.ts +0 -78
  146. package/src/util/neatStack.ts +0 -30
  147. package/src/util/noSuchCommandText.ts +0 -91
  148. package/src/util/parseArguments.ts +0 -76
  149. package/src/util/pathExists.ts +0 -14
  150. package/src/util/readJson.ts +0 -6
  151. package/src/util/readdirRecursive.ts +0 -26
  152. package/src/util/remoteTemplate.ts +0 -320
  153. package/src/util/resolveLatestVersions.ts +0 -24
  154. package/src/util/resolveRootDir.ts +0 -59
  155. package/src/util/telemetryDisclosure.ts +0 -45
  156. package/src/util/updateNotifier.ts +0 -158
  157. package/src/util/writeJson.ts +0 -6
  158. package/src/workers/getAndWriteJourneySchema.ts +0 -7
  159. package/src/workers/getCliConfig.ts +0 -14
  160. package/src/workers/typegenGenerate.ts +0 -228
@@ -1,102 +0,0 @@
1
- import sortObject from 'deep-sort-object'
2
-
3
- import {type PackageJson, type SanityJson} from '../../types'
4
-
5
- const manifestPropOrder = [
6
- 'name',
7
- 'private',
8
- 'version',
9
- 'description',
10
- 'main',
11
- 'author',
12
- 'license',
13
- 'scripts',
14
- 'keywords',
15
- 'dependencies',
16
- 'devDependencies',
17
- ]
18
-
19
- export function createPackageManifest(
20
- data: Omit<PackageJson, 'version'> & {gitRemote?: string} & {isAppTemplate?: boolean},
21
- ): string {
22
- const {isAppTemplate} = data
23
-
24
- const dependencies = data.dependencies ? {dependencies: sortObject(data.dependencies)} : {}
25
-
26
- const devDependencies = data.devDependencies
27
- ? {devDependencies: sortObject(data.devDependencies)}
28
- : {}
29
-
30
- // Don't write a prettier config for SDK apps; we want to allow developers to use their own
31
- const prettierConfig = isAppTemplate
32
- ? {}
33
- : {
34
- prettier: {
35
- semi: false,
36
- printWidth: 100,
37
- bracketSpacing: false,
38
- singleQuote: true,
39
- },
40
- }
41
-
42
- const pkg = {
43
- ...getCommonManifest(data),
44
-
45
- main: 'package.json',
46
- keywords: ['sanity'],
47
- scripts: data.scripts || {
48
- 'dev': 'sanity dev',
49
- 'start': 'sanity start',
50
- 'build': 'sanity build',
51
- 'deploy': 'sanity deploy',
52
- 'deploy-graphql': 'sanity graphql deploy',
53
- },
54
-
55
- ...dependencies,
56
- ...devDependencies,
57
- ...prettierConfig,
58
- }
59
-
60
- return serializeManifest(pkg)
61
- }
62
-
63
- function getCommonManifest(data: Omit<PackageJson, 'version'> & {gitRemote?: string}) {
64
- const pkg: PackageJson = {
65
- name: data.name,
66
- version: '1.0.0',
67
- description: data.description,
68
- author: data.author,
69
- license: data.license || 'UNLICENSED',
70
- devDependencies: {},
71
- }
72
-
73
- if (pkg.license === 'UNLICENSED') {
74
- pkg.private = true
75
- }
76
-
77
- if (data.gitRemote) {
78
- pkg.repository = {
79
- type: 'git',
80
- url: data.gitRemote,
81
- }
82
- }
83
-
84
- return pkg
85
- }
86
-
87
- function serializeManifest(src: PackageJson | SanityJson): string {
88
- const props = manifestPropOrder.concat(Object.keys(src))
89
- const ordered = props.reduce(
90
- (target, prop) => {
91
- const source = src as any
92
- if (typeof source[prop] !== 'undefined' && typeof target[prop] === 'undefined') {
93
- target[prop] = source[prop]
94
- }
95
-
96
- return target
97
- },
98
- {} as Record<string, any>,
99
- )
100
-
101
- return `${JSON.stringify(ordered, null, 2)}\n`
102
- }
@@ -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
- }