@sanity/cli 3.97.2-next.6 → 3.98.1-0eb00fd33c-202507091455
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 +11 -3
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/package.json +24 -26
package/lib/_chunks-cjs/cli.js
CHANGED
|
@@ -8121,14 +8121,22 @@ Examples
|
|
|
8121
8121
|
signature: "<name> [--data <json>] [--file <filename>] [--timeout <seconds>] [--api <version>] [--dataset <name>] [--project-id] <id>] [--with-user-token]",
|
|
8122
8122
|
description: "Invoke a local Sanity Function",
|
|
8123
8123
|
async action(args, context) {
|
|
8124
|
-
const { apiClient, output } = context, [name] = args.argsWithoutOptions, flags = { ...defaultFlags$1, ...args.extOptions }, client2 = apiClient({
|
|
8124
|
+
const { apiClient, output, chalk: chalk2 } = context, [name] = args.argsWithoutOptions, flags = { ...defaultFlags$1, ...args.extOptions }, client2 = apiClient({
|
|
8125
8125
|
requireUser: !0,
|
|
8126
8126
|
requireProject: !1
|
|
8127
8127
|
}), { dataset, projectId, token: token2 } = client2.config(), actualDataset = dataset === "~dummy-placeholder-dataset-" ? void 0 : dataset;
|
|
8128
8128
|
if (!token2) throw new Error("No API token found. Please run `sanity login`.");
|
|
8129
8129
|
if (!name)
|
|
8130
8130
|
throw new Error("You must provide a function name as the first argument");
|
|
8131
|
-
const { initBlueprintConfig } = await import("@sanity/runtime-cli/cores"), { functionTestCore } = await import("@sanity/runtime-cli/cores/functions"),
|
|
8131
|
+
const { initBlueprintConfig } = await import("@sanity/runtime-cli/cores"), { functionTestCore } = await import("@sanity/runtime-cli/cores/functions"), { blueprint } = await import("@sanity/runtime-cli/actions/blueprints"), { projectId: bpProjectId } = await blueprint.readLocalBlueprint();
|
|
8132
|
+
projectId && projectId !== bpProjectId && (output.print(
|
|
8133
|
+
chalk2.yellow("WARNING"),
|
|
8134
|
+
`Project ID ${chalk2.cyan(projectId)} in ${chalk2.green("sanity.cli.ts")} does not match Project ID ${chalk2.cyan(bpProjectId)} in ${chalk2.green("./sanity/blueprint.config.json")}.`
|
|
8135
|
+
), output.print(
|
|
8136
|
+
`Defaulting to Project ID ${chalk2.cyan(bpProjectId)}. To override use the ${chalk2.green("--project-id")} flag.
|
|
8137
|
+
`
|
|
8138
|
+
));
|
|
8139
|
+
const cmdConfig = await initBlueprintConfig({
|
|
8132
8140
|
bin: "sanity",
|
|
8133
8141
|
log: (message) => output.print(message),
|
|
8134
8142
|
token: token2
|
|
@@ -8143,7 +8151,7 @@ Examples
|
|
|
8143
8151
|
timeout: flags.timeout,
|
|
8144
8152
|
api: flags.api,
|
|
8145
8153
|
dataset: flags.dataset || actualDataset,
|
|
8146
|
-
"project-id": flags["project-id"] ||
|
|
8154
|
+
"project-id": flags["project-id"] || bpProjectId,
|
|
8147
8155
|
"with-user-token": flags["with-user-token"]
|
|
8148
8156
|
}
|
|
8149
8157
|
});
|