@sanity/cli 3.91.1-next.33.f33154ba73 → 3.91.1-next.34.844b3d4b3a
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
@@ -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);
|