@sanity/cli 3.92.1-next.31.52ea1d6df9 → 3.92.1-next.33.093bcb6a02
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/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.33.093bcb6a02",
|
|
4
4
|
"description": "Sanity CLI tool for managing Sanity installations, managing plugins, schemas and datasets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@babel/traverse": "^7.23.5",
|
|
61
61
|
"@sanity/client": "^7.6.0",
|
|
62
|
-
"@sanity/codegen": "3.92.1-next.
|
|
63
|
-
"@sanity/runtime-cli": "^8.
|
|
62
|
+
"@sanity/codegen": "3.92.1-next.33.093bcb6a02",
|
|
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.33.093bcb6a02",
|
|
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.
|
|
86
|
+
"@sanity/types": "3.92.1-next.33.093bcb6a02",
|
|
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": "093bcb6a023c98e6f22fb74ab797b7bb8ff3b78f"
|
|
139
139
|
}
|
|
@@ -25,6 +25,9 @@ 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
|
+
|
|
28
31
|
# Add a JavaScript Function
|
|
29
32
|
sanity blueprints add function --js
|
|
30
33
|
|
|
@@ -36,6 +39,8 @@ Examples:
|
|
|
36
39
|
`
|
|
37
40
|
|
|
38
41
|
export interface BlueprintsAddFlags {
|
|
42
|
+
'example'?: string
|
|
43
|
+
|
|
39
44
|
'name'?: string
|
|
40
45
|
'n'?: string
|
|
41
46
|
|
|
@@ -44,8 +49,8 @@ export interface BlueprintsAddFlags {
|
|
|
44
49
|
'fn-language'?: string
|
|
45
50
|
'lang'?: string
|
|
46
51
|
|
|
47
|
-
'js'?: boolean
|
|
48
52
|
'javascript'?: boolean
|
|
53
|
+
'js'?: boolean
|
|
49
54
|
|
|
50
55
|
'fn-helpers'?: boolean
|
|
51
56
|
'helpers'?: boolean
|
|
@@ -73,7 +78,31 @@ const addBlueprintsCommand: CliCommandDefinition<BlueprintsAddFlags> = {
|
|
|
73
78
|
|
|
74
79
|
async action(args, context) {
|
|
75
80
|
const {output, apiClient} = context
|
|
76
|
-
const
|
|
81
|
+
const {extOptions} = args
|
|
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}
|
|
77
106
|
|
|
78
107
|
const client = apiClient({
|
|
79
108
|
requireUser: true,
|
|
@@ -108,6 +137,7 @@ const addBlueprintsCommand: CliCommandDefinition<BlueprintsAddFlags> = {
|
|
|
108
137
|
...cmdConfig.value,
|
|
109
138
|
args: {type: resourceType},
|
|
110
139
|
flags: {
|
|
140
|
+
'example': flags.example,
|
|
111
141
|
'name': flags.n ?? flags.name,
|
|
112
142
|
'fn-type': flags['fn-type'],
|
|
113
143
|
'language': flags.lang ?? flags['fn-language'],
|
|
@@ -9,14 +9,18 @@ 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 project in the current directory
|
|
13
13
|
sanity blueprints init
|
|
14
14
|
|
|
15
|
-
# Create a new Blueprint
|
|
15
|
+
# Create a new Blueprint project 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
|
|
17
20
|
`
|
|
18
21
|
|
|
19
22
|
export interface BlueprintsInitFlags {
|
|
23
|
+
'example'?: string
|
|
20
24
|
'dir'?: string
|
|
21
25
|
'blueprint-type'?: string
|
|
22
26
|
'type'?: string
|
|
@@ -56,6 +60,22 @@ const initBlueprintsCommand: CliCommandDefinition<BlueprintsInitFlags> = {
|
|
|
56
60
|
|
|
57
61
|
const {blueprintInitCore} = await import('@sanity/runtime-cli/cores/blueprints')
|
|
58
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
|
+
|
|
59
79
|
const {success, error} = await blueprintInitCore({
|
|
60
80
|
bin: 'sanity',
|
|
61
81
|
log: (message) => output.print(message),
|
|
@@ -64,6 +84,7 @@ const initBlueprintsCommand: CliCommandDefinition<BlueprintsInitFlags> = {
|
|
|
64
84
|
dir: dir ?? flags.dir,
|
|
65
85
|
},
|
|
66
86
|
flags: {
|
|
87
|
+
'example': flags.example,
|
|
67
88
|
'blueprint-type': flags['blueprint-type'] ?? flags.type,
|
|
68
89
|
'project-id': flags['project-id'] ?? flags.projectId ?? flags.project,
|
|
69
90
|
'stack-id': flags['stack-id'] ?? flags.stackId ?? flags.stack,
|