@sanity/cli 3.91.1-next.9.e9b861a7e3 → 3.92.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 +45 -27
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/package.json +11 -11
- package/src/actions/init-project/initProject.ts +19 -10
- package/src/actions/init-project/templates/appQuickstart.ts +1 -1
- package/src/actions/init-project/templates/appSanityUi.ts +1 -1
- package/src/commands/blueprints/stacksBlueprintsCommand.ts +1 -1
- package/src/commands/functions/devFunctionsCommand.ts +11 -2
- package/src/commands/functions/logsFunctionsCommand.ts +10 -6
- package/src/commands/functions/testFunctionsCommand.ts +4 -3
- package/src/studioDependencies.ts +7 -7
package/lib/_chunks-cjs/cli.js
CHANGED
@@ -4156,7 +4156,7 @@ Examples:
|
|
4156
4156
|
const { success, error: error2 } = await blueprintStacksCore({
|
4157
4157
|
...cmdConfig.value,
|
4158
4158
|
flags: {
|
4159
|
-
|
4159
|
+
"project-id": flags["project-id"] ?? flags.projectId ?? flags.project
|
4160
4160
|
}
|
4161
4161
|
});
|
4162
4162
|
if (!success) throw new Error(error2);
|
@@ -7868,6 +7868,7 @@ const docsCommand = {
|
|
7868
7868
|
}, helpText$c = `
|
7869
7869
|
Options
|
7870
7870
|
--port <port> Port to start emulator on
|
7871
|
+
--open Open dev server in a new browser tab
|
7871
7872
|
|
7872
7873
|
Examples
|
7873
7874
|
# Start dev server on default port
|
@@ -7875,16 +7876,20 @@ Examples
|
|
7875
7876
|
|
7876
7877
|
# Start dev server on specific port
|
7877
7878
|
sanity functions dev --port 3333
|
7879
|
+
|
7880
|
+
# Start dev server and open a new browser tab
|
7881
|
+
sanity functions dev --open
|
7878
7882
|
`, defaultFlags$3 = {
|
7883
|
+
open: !1,
|
7879
7884
|
port: 8080
|
7880
7885
|
}, devFunctionsCommand = {
|
7881
7886
|
name: "dev",
|
7882
7887
|
group: "functions",
|
7883
7888
|
helpText: helpText$c,
|
7884
|
-
signature: "[--port <port>]",
|
7889
|
+
signature: "[--port <port> --open]",
|
7885
7890
|
description: "Start the Sanity Function emulator",
|
7886
7891
|
async action(args, context) {
|
7887
|
-
const { apiClient, output } = context, flags = { ...defaultFlags$3, ...args.extOptions }, client2 = apiClient({ requireUser: !0, requireProject: !1 }), { token: token2 } = client2.config();
|
7892
|
+
const { apiClient, output } = context, flags = { ...defaultFlags$3, ...args.extOptions }, { open: shouldOpen } = flags, client2 = apiClient({ requireUser: !0, requireProject: !1 }), { token: token2 } = client2.config();
|
7888
7893
|
if (!token2) throw new Error("No API token found. Please run `sanity login`.");
|
7889
7894
|
const { initBlueprintConfig } = await import("@sanity/runtime-cli/cores"), { functionDevCore } = await import("@sanity/runtime-cli/cores/functions"), cmdConfig = await initBlueprintConfig({
|
7890
7895
|
bin: "sanity",
|
@@ -7899,7 +7904,7 @@ Examples
|
|
7899
7904
|
}
|
7900
7905
|
});
|
7901
7906
|
if (!success) throw new Error(error2);
|
7902
|
-
open(`http://localhost:${flags.port}`);
|
7907
|
+
shouldOpen && open(`http://localhost:${flags.port}`);
|
7903
7908
|
}
|
7904
7909
|
}, helpText$b = `
|
7905
7910
|
Commands
|
@@ -7986,10 +7991,11 @@ Arguments
|
|
7986
7991
|
|
7987
7992
|
Options
|
7988
7993
|
--limit <limit> The number of log entries to retrieve [default 50]
|
7989
|
-
--json
|
7990
|
-
--utc
|
7991
|
-
--delete
|
7992
|
-
--force
|
7994
|
+
--json If set return json
|
7995
|
+
--utc Use UTC dates in logs
|
7996
|
+
--delete Delete all logs for the Function
|
7997
|
+
--force Force delete all logs for the Function
|
7998
|
+
--watch Watch for new logs (streaming mode)
|
7993
7999
|
|
7994
8000
|
Examples
|
7995
8001
|
# Retrieve logs for Sanity Function
|
@@ -7999,10 +8005,13 @@ Examples
|
|
7999
8005
|
sanity functions logs echo --limit 2
|
8000
8006
|
|
8001
8007
|
# Retrieve logs for Sanity Function in json format
|
8002
|
-
sanity functions logs
|
8008
|
+
sanity functions logs echo --json
|
8003
8009
|
|
8004
8010
|
# Delete all logs for Sanity Function
|
8005
|
-
sanity functions logs
|
8011
|
+
sanity functions logs echo --delete
|
8012
|
+
|
8013
|
+
# Watch for new logs (streaming mode)
|
8014
|
+
sanity functions logs echo --watch
|
8006
8015
|
`, defaultFlags$2 = {
|
8007
8016
|
limit: 50,
|
8008
8017
|
json: !1,
|
@@ -8073,7 +8082,7 @@ Examples
|
|
8073
8082
|
const { apiClient, output } = context, [name] = args.argsWithoutOptions, flags = { ...defaultFlags$1, ...args.extOptions }, client2 = apiClient({
|
8074
8083
|
requireUser: !0,
|
8075
8084
|
requireProject: !1
|
8076
|
-
}), { token: token2 } = client2.config();
|
8085
|
+
}), { dataset, projectId, token: token2 } = client2.config(), actualDataset = dataset === "~dummy-placeholder-dataset-" ? void 0 : dataset;
|
8077
8086
|
if (!token2) throw new Error("No API token found. Please run `sanity login`.");
|
8078
8087
|
if (!name)
|
8079
8088
|
throw new Error("You must provide a function name as the first argument");
|
@@ -8091,8 +8100,8 @@ Examples
|
|
8091
8100
|
file: flags.file,
|
8092
8101
|
timeout: flags.timeout,
|
8093
8102
|
api: flags.api,
|
8094
|
-
dataset: flags.dataset,
|
8095
|
-
"project-id": flags["project-id"]
|
8103
|
+
dataset: flags.dataset || actualDataset,
|
8104
|
+
"project-id": flags["project-id"] || projectId
|
8096
8105
|
}
|
8097
8106
|
});
|
8098
8107
|
if (!success) throw new Error(error2);
|
@@ -27797,18 +27806,18 @@ const studioDependencies = {
|
|
27797
27806
|
// Official studio plugin dependencies
|
27798
27807
|
"@sanity/vision": "latest",
|
27799
27808
|
// Non-Sanity dependencies
|
27800
|
-
react: "^
|
27801
|
-
"react-dom": "^
|
27802
|
-
"styled-components": "^6.1.
|
27809
|
+
react: "^19.1",
|
27810
|
+
"react-dom": "^19.1",
|
27811
|
+
"styled-components": "^6.1.18"
|
27803
27812
|
},
|
27804
27813
|
devDependencies: {
|
27805
27814
|
// Linting/tooling
|
27806
27815
|
"@sanity/eslint-config-studio": "latest",
|
27807
27816
|
// When using typescript, we'll want the these types too, so might as well install them
|
27808
|
-
"@types/react": "^
|
27809
|
-
eslint: "^9.
|
27810
|
-
prettier: "^3.
|
27811
|
-
typescript: "^5.
|
27817
|
+
"@types/react": "^19.1",
|
27818
|
+
eslint: "^9.28",
|
27819
|
+
prettier: "^3.5",
|
27820
|
+
typescript: "^5.8"
|
27812
27821
|
// Peer dependency of eslint-config-studio (implicitly)
|
27813
27822
|
}
|
27814
27823
|
};
|
@@ -47588,7 +47597,7 @@ const appTemplate = {
|
|
47588
47597
|
"react-dom": "^19"
|
47589
47598
|
},
|
47590
47599
|
devDependencies: {
|
47591
|
-
"@types/react": "^
|
47600
|
+
"@types/react": "^19",
|
47592
47601
|
sanity: "^3",
|
47593
47602
|
typescript: "^5.1.6"
|
47594
47603
|
},
|
@@ -47608,7 +47617,7 @@ const appTemplate = {
|
|
47608
47617
|
"styled-components": "^6.1.17"
|
47609
47618
|
},
|
47610
47619
|
devDependencies: {
|
47611
|
-
"@types/react": "^
|
47620
|
+
"@types/react": "^19",
|
47612
47621
|
sanity: "^3",
|
47613
47622
|
typescript: "^5.1.6"
|
47614
47623
|
},
|
@@ -53812,7 +53821,7 @@ ${err.message}`);
|
|
53812
53821
|
});
|
53813
53822
|
return createProject(apiClient, {
|
53814
53823
|
displayName: projectName,
|
53815
|
-
organizationId: await getOrganizationId(organizations),
|
53824
|
+
organizationId: cliFlags.organization || await getOrganizationId(organizations),
|
53816
53825
|
subscription: selectedPlan ? { planId: selectedPlan } : void 0,
|
53817
53826
|
metadata: { coupon: intendedCoupon }
|
53818
53827
|
}).then((response) => ({
|
@@ -53841,7 +53850,7 @@ ${err.message}`);
|
|
53841
53850
|
message: "Your project name:",
|
53842
53851
|
default: "My Sanity Project"
|
53843
53852
|
}),
|
53844
|
-
organizationId: await getOrganizationId(organizations),
|
53853
|
+
organizationId: cliFlags.organization || await getOrganizationId(organizations),
|
53845
53854
|
subscription: selectedPlan ? { planId: selectedPlan } : void 0,
|
53846
53855
|
metadata: { coupon: intendedCoupon }
|
53847
53856
|
}).then((response) => ({
|
@@ -54025,12 +54034,23 @@ The default dataset configuration has a public dataset named "production".`;
|
|
54025
54034
|
throw new Error(
|
54026
54035
|
"`--project <id>` or `--create-project <name>` must be specified in unattended mode"
|
54027
54036
|
);
|
54037
|
+
if (createProjectName && !cliFlags.organization)
|
54038
|
+
throw new Error(
|
54039
|
+
"--create-project is not supported in unattended mode without an organization, please specify an organization with `--organization <id>`"
|
54040
|
+
);
|
54028
54041
|
}
|
54029
54042
|
if (createProjectName) {
|
54030
54043
|
loadEnv.debug("--create-project specified, creating a new project");
|
54044
|
+
let orgForCreateProjectFlag = cliFlags.organization;
|
54045
|
+
if (!orgForCreateProjectFlag) {
|
54046
|
+
loadEnv.debug("no organization specified, selecting one");
|
54047
|
+
const organizations = await apiClient({ requireUser: !0, requireProject: !1 }).request({ uri: "/organizations" });
|
54048
|
+
orgForCreateProjectFlag = await getOrganizationId(organizations);
|
54049
|
+
}
|
54050
|
+
loadEnv.debug("creating a new project");
|
54031
54051
|
const createdProject = await createProject(apiClient, {
|
54032
54052
|
displayName: createProjectName.trim(),
|
54033
|
-
organizationId:
|
54053
|
+
organizationId: orgForCreateProjectFlag,
|
54034
54054
|
subscription: selectedPlan ? { planId: selectedPlan } : void 0,
|
54035
54055
|
metadata: { coupon: intendedCoupon }
|
54036
54056
|
});
|
@@ -54077,8 +54097,6 @@ The default dataset configuration has a public dataset named "production".`;
|
|
54077
54097
|
return chosenOrg === "-new-" ? createOrganization().then((org) => org.id) : chosenOrg || void 0;
|
54078
54098
|
}
|
54079
54099
|
async function getOrganizationId(organizations) {
|
54080
|
-
if (unattended || flags.organization)
|
54081
|
-
return flags.organization || void 0;
|
54082
54100
|
if (organizations.length === 0)
|
54083
54101
|
return createOrganization().then((org) => org.id);
|
54084
54102
|
loadEnv.debug(`User has ${organizations.length} organization(s), checking attach access`);
|