@sanity/cli 3.92.1-next.33.093bcb6a02 → 3.92.1-next.33.d62ed552cc
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 +33 -73
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/package.json +7 -7
- package/src/actions/init-project/initProject.ts +11 -23
- package/src/cli.ts +0 -3
- package/src/commands/blueprints/addBlueprintsCommand.ts +2 -32
- package/src/commands/blueprints/initBlueprintsCommand.ts +2 -23
- package/src/packageManager/installPackages.ts +21 -33
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli",
|
|
3
|
-
"version": "3.92.1-next.33.
|
|
3
|
+
"version": "3.92.1-next.33.d62ed552cc",
|
|
4
4
|
"description": "Sanity CLI tool for managing Sanity installations, managing plugins, schemas and datasets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@babel/traverse": "^7.23.5",
|
|
61
|
-
"@sanity/client": "^7.
|
|
62
|
-
"@sanity/codegen": "3.92.1-next.33.
|
|
63
|
-
"@sanity/runtime-cli": "^8.
|
|
61
|
+
"@sanity/client": "^7.5.0",
|
|
62
|
+
"@sanity/codegen": "3.92.1-next.33.d62ed552cc",
|
|
63
|
+
"@sanity/runtime-cli": "^8.0.0",
|
|
64
64
|
"@sanity/telemetry": "^0.8.0",
|
|
65
65
|
"@sanity/template-validator": "^2.4.3",
|
|
66
|
-
"@sanity/util": "3.92.1-next.33.
|
|
66
|
+
"@sanity/util": "3.92.1-next.33.d62ed552cc",
|
|
67
67
|
"chalk": "^4.1.2",
|
|
68
68
|
"debug": "^4.3.4",
|
|
69
69
|
"decompress": "^4.2.0",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
84
84
|
"@sanity/eslint-config-studio": "^4.0.0",
|
|
85
85
|
"@sanity/generate-help-url": "^3.0.0",
|
|
86
|
-
"@sanity/types": "3.92.1-next.33.
|
|
86
|
+
"@sanity/types": "3.92.1-next.33.d62ed552cc",
|
|
87
87
|
"@types/babel__traverse": "^7.20.5",
|
|
88
88
|
"@types/configstore": "^5.0.1",
|
|
89
89
|
"@types/cpx": "^1.5.2",
|
|
@@ -135,5 +135,5 @@
|
|
|
135
135
|
"engines": {
|
|
136
136
|
"node": ">=18"
|
|
137
137
|
},
|
|
138
|
-
"gitHead": "
|
|
138
|
+
"gitHead": "d62ed552cce175edbd64550780abd4ee16182ba2"
|
|
139
139
|
}
|
|
@@ -679,36 +679,24 @@ export default async function initSanity(
|
|
|
679
679
|
const devCommand = devCommandMap[pkgManager]
|
|
680
680
|
|
|
681
681
|
const isCurrentDir = outputPath === process.cwd()
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
if (isAppTemplate) {
|
|
685
|
-
//output for custom apps here
|
|
686
|
-
print(`✅ ${chalk.green.bold('Success!')} Your custom app has been scaffolded.`)
|
|
687
|
-
if (!isCurrentDir) print(goToProjectDir)
|
|
682
|
+
if (isCurrentDir) {
|
|
683
|
+
print(`\n${chalk.green('Success!')} Now, use this command to continue:\n`)
|
|
688
684
|
print(
|
|
689
|
-
|
|
685
|
+
`${chalk.cyan(devCommand)} - to run ${isAppTemplate ? 'your Sanity application' : 'Sanity Studio'}\n`,
|
|
690
686
|
)
|
|
691
|
-
print('\nGet started in `src/App.tsx`, or refer to our documentation for a walkthrough:')
|
|
692
|
-
print(chalk.blue.underline('https://www.sanity.io/docs/app-sdk/sdk-configuration'))
|
|
693
|
-
print('\n')
|
|
694
|
-
print(`Other helpful commands:`)
|
|
695
|
-
print(`npx sanity docs to open the documentation in a browser`)
|
|
696
|
-
print(`npx sanity dev to start the development server for your app`)
|
|
697
|
-
print(`npx sanity deploy to deploy your app`)
|
|
698
687
|
} else {
|
|
699
|
-
|
|
700
|
-
print(
|
|
701
|
-
if (!isCurrentDir) print(goToProjectDir)
|
|
688
|
+
print(`\n${chalk.green('Success!')} Now, use these commands to continue:\n`)
|
|
689
|
+
print(`First: ${chalk.cyan(`cd ${outputPath}`)} - to enter project's directory`)
|
|
702
690
|
print(
|
|
703
|
-
`
|
|
691
|
+
`Then: ${chalk.cyan(devCommand)} -to run ${isAppTemplate ? 'your Sanity application' : 'Sanity Studio'}\n`,
|
|
704
692
|
)
|
|
705
|
-
print('\n')
|
|
706
|
-
print(`Other helpful commands:`)
|
|
707
|
-
print(`npx sanity docs to open the documentation in a browser`)
|
|
708
|
-
print(`npx sanity manage to open the project settings in a browser`)
|
|
709
|
-
print(`npx sanity help to explore the CLI manual`)
|
|
710
693
|
}
|
|
711
694
|
|
|
695
|
+
print(`Other helpful commands`)
|
|
696
|
+
print(`npx sanity docs - to open the documentation in a browser`)
|
|
697
|
+
print(`npx sanity manage - to open the project settings in a browser`)
|
|
698
|
+
print(`npx sanity help - to explore the CLI manual`)
|
|
699
|
+
|
|
712
700
|
if (isFirstProject) {
|
|
713
701
|
trace.log({step: 'sendCommunityInvite', selectedOption: 'yes'})
|
|
714
702
|
|
package/src/cli.ts
CHANGED
|
@@ -157,9 +157,6 @@ export async function runCli(cliRoot: string, {cliVersion}: {cliVersion: string}
|
|
|
157
157
|
const error = typeof err.details === 'string' ? err.details : err
|
|
158
158
|
// eslint-disable-next-line no-console
|
|
159
159
|
console.error(`\n${error.stack ? neatStack(err) : error}`)
|
|
160
|
-
if (err.cause) {
|
|
161
|
-
console.error(`\nCaused by:\n\n${err.cause.stack ? neatStack(err.cause) : err.cause}`)
|
|
162
|
-
}
|
|
163
160
|
// eslint-disable-next-line no-process-exit
|
|
164
161
|
cliCommandTrace.error(error)
|
|
165
162
|
process.exit(1)
|
|
@@ -25,9 +25,6 @@ Examples:
|
|
|
25
25
|
# Add a Function with a specific type
|
|
26
26
|
sanity blueprints add function --fn-type document-publish
|
|
27
27
|
|
|
28
|
-
# Add a Function using an example
|
|
29
|
-
sanity blueprints add function --example example-name
|
|
30
|
-
|
|
31
28
|
# Add a JavaScript Function
|
|
32
29
|
sanity blueprints add function --js
|
|
33
30
|
|
|
@@ -39,8 +36,6 @@ Examples:
|
|
|
39
36
|
`
|
|
40
37
|
|
|
41
38
|
export interface BlueprintsAddFlags {
|
|
42
|
-
'example'?: string
|
|
43
|
-
|
|
44
39
|
'name'?: string
|
|
45
40
|
'n'?: string
|
|
46
41
|
|
|
@@ -49,8 +44,8 @@ export interface BlueprintsAddFlags {
|
|
|
49
44
|
'fn-language'?: string
|
|
50
45
|
'lang'?: string
|
|
51
46
|
|
|
52
|
-
'javascript'?: boolean
|
|
53
47
|
'js'?: boolean
|
|
48
|
+
'javascript'?: boolean
|
|
54
49
|
|
|
55
50
|
'fn-helpers'?: boolean
|
|
56
51
|
'helpers'?: boolean
|
|
@@ -78,31 +73,7 @@ const addBlueprintsCommand: CliCommandDefinition<BlueprintsAddFlags> = {
|
|
|
78
73
|
|
|
79
74
|
async action(args, context) {
|
|
80
75
|
const {output, apiClient} = context
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
if (extOptions.example) {
|
|
84
|
-
// example is exclusive to 'name', 'fn-type', 'fn-language', 'javascript', 'fn-helpers', 'fn-installer'
|
|
85
|
-
// check before merging default flags
|
|
86
|
-
const conflictingFlags: (keyof BlueprintsAddFlags)[] = [
|
|
87
|
-
'name',
|
|
88
|
-
'n',
|
|
89
|
-
'fn-type',
|
|
90
|
-
'fn-language',
|
|
91
|
-
'lang',
|
|
92
|
-
'javascript',
|
|
93
|
-
'js',
|
|
94
|
-
'fn-helpers',
|
|
95
|
-
'helpers',
|
|
96
|
-
'fn-installer',
|
|
97
|
-
'installer',
|
|
98
|
-
]
|
|
99
|
-
const foundConflict = conflictingFlags.find((key) => extOptions[key])
|
|
100
|
-
if (foundConflict) {
|
|
101
|
-
throw new Error(`--example can't be used with --${foundConflict}`)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const flags = {...defaultFlags, ...extOptions}
|
|
76
|
+
const flags = {...defaultFlags, ...args.extOptions}
|
|
106
77
|
|
|
107
78
|
const client = apiClient({
|
|
108
79
|
requireUser: true,
|
|
@@ -137,7 +108,6 @@ const addBlueprintsCommand: CliCommandDefinition<BlueprintsAddFlags> = {
|
|
|
137
108
|
...cmdConfig.value,
|
|
138
109
|
args: {type: resourceType},
|
|
139
110
|
flags: {
|
|
140
|
-
'example': flags.example,
|
|
141
111
|
'name': flags.n ?? flags.name,
|
|
142
112
|
'fn-type': flags['fn-type'],
|
|
143
113
|
'language': flags.lang ?? flags['fn-language'],
|
|
@@ -9,18 +9,14 @@ Options
|
|
|
9
9
|
--project-id <id> Project ID to use
|
|
10
10
|
|
|
11
11
|
Examples:
|
|
12
|
-
# Create a new Blueprint
|
|
12
|
+
# Create a new Blueprint manifest file in the current directory
|
|
13
13
|
sanity blueprints init
|
|
14
14
|
|
|
15
|
-
# Create a new Blueprint
|
|
15
|
+
# Create a new Blueprint manifest file in a specific directory
|
|
16
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
17
|
`
|
|
21
18
|
|
|
22
19
|
export interface BlueprintsInitFlags {
|
|
23
|
-
'example'?: string
|
|
24
20
|
'dir'?: string
|
|
25
21
|
'blueprint-type'?: string
|
|
26
22
|
'type'?: string
|
|
@@ -60,22 +56,6 @@ const initBlueprintsCommand: CliCommandDefinition<BlueprintsInitFlags> = {
|
|
|
60
56
|
|
|
61
57
|
const {blueprintInitCore} = await import('@sanity/runtime-cli/cores/blueprints')
|
|
62
58
|
|
|
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
59
|
const {success, error} = await blueprintInitCore({
|
|
80
60
|
bin: 'sanity',
|
|
81
61
|
log: (message) => output.print(message),
|
|
@@ -84,7 +64,6 @@ const initBlueprintsCommand: CliCommandDefinition<BlueprintsInitFlags> = {
|
|
|
84
64
|
dir: dir ?? flags.dir,
|
|
85
65
|
},
|
|
86
66
|
flags: {
|
|
87
|
-
'example': flags.example,
|
|
88
67
|
'blueprint-type': flags['blueprint-type'] ?? flags.type,
|
|
89
68
|
'project-id': flags['project-id'] ?? flags.projectId ?? flags.project,
|
|
90
69
|
'stack-id': flags['stack-id'] ?? flags.stackId ?? flags.stack,
|
|
@@ -18,44 +18,32 @@ export async function installDeclaredPackages(
|
|
|
18
18
|
encoding: 'utf8',
|
|
19
19
|
env: getPartialEnvWithNpmPath(cwd),
|
|
20
20
|
cwd,
|
|
21
|
-
stdio: '
|
|
21
|
+
stdio: 'inherit',
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
const npmArgs = ['install', '--legacy-peer-deps']
|
|
25
25
|
let result: ExecaReturnValue<string> | undefined
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// If the install fails, log execa's stdout and throw…
|
|
45
|
-
if (result?.exitCode || result?.failed) {
|
|
46
|
-
progress.fail()
|
|
47
|
-
output.print(result.stdout)
|
|
48
|
-
throw new Error('Dependency installation failed')
|
|
49
|
-
} else {
|
|
50
|
-
// …otherwise, just mark the install as successful
|
|
51
|
-
progress.succeed()
|
|
52
|
-
}
|
|
26
|
+
if (packageManager === 'npm') {
|
|
27
|
+
output.print(`Running 'npm ${npmArgs.join(' ')}'`)
|
|
28
|
+
result = await execa('npm', npmArgs, execOptions)
|
|
29
|
+
} else if (packageManager === 'yarn') {
|
|
30
|
+
const yarnArgs = ['install']
|
|
31
|
+
output.print(`Running 'yarn ${yarnArgs.join(' ')}'`)
|
|
32
|
+
result = await execa('yarn', yarnArgs, execOptions)
|
|
33
|
+
} else if (packageManager === 'pnpm') {
|
|
34
|
+
const pnpmArgs = ['install']
|
|
35
|
+
output.print(`Running 'pnpm ${pnpmArgs.join(' ')}'`)
|
|
36
|
+
result = await execa('pnpm', pnpmArgs, execOptions)
|
|
37
|
+
} else if (packageManager === 'bun') {
|
|
38
|
+
const bunArgs = ['install']
|
|
39
|
+
output.print(`Running 'bun ${bunArgs.join(' ')}'`)
|
|
40
|
+
result = await execa('bun', bunArgs, execOptions)
|
|
41
|
+
} else if (packageManager === 'manual') {
|
|
42
|
+
output.print(`Manual installation selected - run 'npm ${npmArgs.join(' ')}' or similar`)
|
|
53
43
|
}
|
|
54
44
|
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
} else {
|
|
58
|
-
await handleInstall(packageManager, installerArgs[packageManager])
|
|
45
|
+
if (result?.exitCode || result?.failed) {
|
|
46
|
+
throw new Error('Dependency installation failed')
|
|
59
47
|
}
|
|
60
48
|
}
|
|
61
49
|
|
package/templates/blog/README.md
CHANGED
|
@@ -7,5 +7,5 @@ Now you can do the following things:
|
|
|
7
7
|
- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme)
|
|
8
8
|
- Check out the example frontend: [React/Next.js](https://github.com/sanity-io/tutorial-sanity-blog-react-next)
|
|
9
9
|
- [Read the blog post about this template](https://www.sanity.io/blog/build-your-own-blog-with-sanity-and-next-js?utm_source=readme)
|
|
10
|
-
- [Join the community Slack](https://
|
|
10
|
+
- [Join the community Slack](https://slack.sanity.io/?utm_source=readme)
|
|
11
11
|
- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme)
|
|
@@ -5,5 +5,5 @@ Congratulations, you have now installed the Sanity Content Studio, an open-sourc
|
|
|
5
5
|
Now you can do the following things:
|
|
6
6
|
|
|
7
7
|
- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme)
|
|
8
|
-
- [Join the community Slack](https://
|
|
8
|
+
- [Join the community Slack](https://slack.sanity.io/?utm_source=readme)
|
|
9
9
|
- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme)
|
|
@@ -7,5 +7,5 @@ Now you can do the following things:
|
|
|
7
7
|
- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme)
|
|
8
8
|
- Check out the example frontend: [Vue/Nuxt.js](https://github.com/sanity-io/example-ecommerce-snipcart-vue)
|
|
9
9
|
- [Read the blog post about this template](https://www.sanity.io/blog/e-commerce-vue-nuxt-snipcart?uutm_source=readme)
|
|
10
|
-
- [Join the community Slack](https://
|
|
10
|
+
- [Join the community Slack](https://slack.sanity.io/?utm_source=readme)
|
|
11
11
|
- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme)
|
|
@@ -5,5 +5,5 @@ Congratulations, you have now installed the Sanity Content Studio, an open-sourc
|
|
|
5
5
|
Now you can do the following things:
|
|
6
6
|
|
|
7
7
|
- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme)
|
|
8
|
-
- [Join the community Slack](https://
|
|
8
|
+
- [Join the community Slack](https://slack.sanity.io/?utm_source=readme)
|
|
9
9
|
- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme)
|
|
@@ -6,5 +6,5 @@ Now you can do the following things:
|
|
|
6
6
|
|
|
7
7
|
- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme)
|
|
8
8
|
- Check out one of the example frontends: [React](https://github.com/sanity-io/example-frontend-next-js) | [React Native](https://github.com/sanity-io/example-app-react-native) | [Vue](https://github.com/sanity-io/example-frontend-vue-js) | [PHP](https://github.com/sanity-io/example-frontend-silex-twig)
|
|
9
|
-
- [Join the community Slack](https://
|
|
9
|
+
- [Join the community Slack](https://slack.sanity.io/?utm_source=readme)
|
|
10
10
|
- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme)
|
|
@@ -5,5 +5,5 @@ Congratulations, you have now installed Sanity Studio, an open-source real-time
|
|
|
5
5
|
Now you can do the following things:
|
|
6
6
|
|
|
7
7
|
- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme)
|
|
8
|
-
- [Join the community Slack](https://
|
|
8
|
+
- [Join the community Slack](https://slack.sanity.io/?utm_source=readme)
|
|
9
9
|
- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme)
|