@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/lib/_chunks-cjs/cli.js
CHANGED
|
@@ -3792,6 +3792,9 @@ Examples:
|
|
|
3792
3792
|
# Add a Function with a specific type
|
|
3793
3793
|
sanity blueprints add function --fn-type document-publish
|
|
3794
3794
|
|
|
3795
|
+
# Add a Function using an example
|
|
3796
|
+
sanity blueprints add function --example example-name
|
|
3797
|
+
|
|
3795
3798
|
# Add a JavaScript Function
|
|
3796
3799
|
sanity blueprints add function --js
|
|
3797
3800
|
|
|
@@ -3810,7 +3813,25 @@ Examples:
|
|
|
3810
3813
|
signature: "<type> [--name <name>] [--fn-type <document-publish>] [--fn-lang <ts|js>] [--javascript]",
|
|
3811
3814
|
description: "Add a Resource to a Blueprint",
|
|
3812
3815
|
async action(args, context) {
|
|
3813
|
-
const { output, apiClient } = context,
|
|
3816
|
+
const { output, apiClient } = context, { extOptions } = args;
|
|
3817
|
+
if (extOptions.example) {
|
|
3818
|
+
const foundConflict = [
|
|
3819
|
+
"name",
|
|
3820
|
+
"n",
|
|
3821
|
+
"fn-type",
|
|
3822
|
+
"fn-language",
|
|
3823
|
+
"lang",
|
|
3824
|
+
"javascript",
|
|
3825
|
+
"js",
|
|
3826
|
+
"fn-helpers",
|
|
3827
|
+
"helpers",
|
|
3828
|
+
"fn-installer",
|
|
3829
|
+
"installer"
|
|
3830
|
+
].find((key2) => extOptions[key2]);
|
|
3831
|
+
if (foundConflict)
|
|
3832
|
+
throw new Error(`--example can't be used with --${foundConflict}`);
|
|
3833
|
+
}
|
|
3834
|
+
const flags = { ...defaultFlags$b, ...extOptions }, client2 = apiClient({
|
|
3814
3835
|
requireUser: !0,
|
|
3815
3836
|
requireProject: !1
|
|
3816
3837
|
}), { token: token2 } = client2.config();
|
|
@@ -3832,6 +3853,7 @@ Examples:
|
|
|
3832
3853
|
...cmdConfig.value,
|
|
3833
3854
|
args: { type: resourceType },
|
|
3834
3855
|
flags: {
|
|
3856
|
+
example: flags.example,
|
|
3835
3857
|
name: flags.n ?? flags.name,
|
|
3836
3858
|
"fn-type": flags["fn-type"],
|
|
3837
3859
|
language: flags.lang ?? flags["fn-language"],
|
|
@@ -4020,11 +4042,14 @@ Options
|
|
|
4020
4042
|
--project-id <id> Project ID to use
|
|
4021
4043
|
|
|
4022
4044
|
Examples:
|
|
4023
|
-
# Create a new Blueprint
|
|
4045
|
+
# Create a new Blueprint project in the current directory
|
|
4024
4046
|
sanity blueprints init
|
|
4025
4047
|
|
|
4026
|
-
# Create a new Blueprint
|
|
4048
|
+
# Create a new Blueprint project in a specific directory
|
|
4027
4049
|
sanity blueprints init my-sanity-project --type json
|
|
4050
|
+
|
|
4051
|
+
# Create a new Blueprint project in a specific directory with an example
|
|
4052
|
+
sanity blueprints init --example example-name
|
|
4028
4053
|
`, defaultFlags$6 = {
|
|
4029
4054
|
//
|
|
4030
4055
|
}, initBlueprintsCommand = {
|
|
@@ -4039,7 +4064,21 @@ Examples:
|
|
|
4039
4064
|
requireProject: !1
|
|
4040
4065
|
}), { token: token2 } = client2.config();
|
|
4041
4066
|
if (!token2) throw new Error("No API token found. Please run `sanity login`.");
|
|
4042
|
-
const { blueprintInitCore } = await import("@sanity/runtime-cli/cores/blueprints")
|
|
4067
|
+
const { blueprintInitCore } = await import("@sanity/runtime-cli/cores/blueprints");
|
|
4068
|
+
if (flags.example) {
|
|
4069
|
+
const foundConflict = [
|
|
4070
|
+
"blueprint-type",
|
|
4071
|
+
"type",
|
|
4072
|
+
"stack-id",
|
|
4073
|
+
"stackId",
|
|
4074
|
+
"stack",
|
|
4075
|
+
"stack-name",
|
|
4076
|
+
"name"
|
|
4077
|
+
].find((key2) => flags[key2]);
|
|
4078
|
+
if (foundConflict)
|
|
4079
|
+
throw new Error(`--example can't be used with --${foundConflict}`);
|
|
4080
|
+
}
|
|
4081
|
+
const { success, error: error2 } = await blueprintInitCore({
|
|
4043
4082
|
bin: "sanity",
|
|
4044
4083
|
log: (message) => output.print(message),
|
|
4045
4084
|
token: token2,
|
|
@@ -4047,6 +4086,7 @@ Examples:
|
|
|
4047
4086
|
dir: dir ?? flags.dir
|
|
4048
4087
|
},
|
|
4049
4088
|
flags: {
|
|
4089
|
+
example: flags.example,
|
|
4050
4090
|
"blueprint-type": flags["blueprint-type"] ?? flags.type,
|
|
4051
4091
|
"project-id": flags["project-id"] ?? flags.projectId ?? flags.project,
|
|
4052
4092
|
"stack-id": flags["stack-id"] ?? flags.stackId ?? flags.stack,
|