@sanity/cli 3.92.1-next.33.093bcb6a02 → 3.92.1-next.33.d62ed552cc
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 +33 -73
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/package.json +7 -7
- package/src/actions/init-project/initProject.ts +11 -23
- package/src/cli.ts +0 -3
- package/src/commands/blueprints/addBlueprintsCommand.ts +2 -32
- package/src/commands/blueprints/initBlueprintsCommand.ts +2 -23
- package/src/packageManager/installPackages.ts +21 -33
- package/templates/blog/README.md +1 -1
- package/templates/clean/README.md +1 -1
- package/templates/ecommerce/README.md +1 -1
- package/templates/get-started/README.md +1 -1
- package/templates/moviedb/README.md +1 -1
- package/templates/quickstart/README.md +1 -1
package/lib/_chunks-cjs/cli.js
CHANGED
|
@@ -3792,9 +3792,6 @@ 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
|
-
|
|
3798
3795
|
# Add a JavaScript Function
|
|
3799
3796
|
sanity blueprints add function --js
|
|
3800
3797
|
|
|
@@ -3813,25 +3810,7 @@ Examples:
|
|
|
3813
3810
|
signature: "<type> [--name <name>] [--fn-type <document-publish>] [--fn-lang <ts|js>] [--javascript]",
|
|
3814
3811
|
description: "Add a Resource to a Blueprint",
|
|
3815
3812
|
async action(args, context) {
|
|
3816
|
-
const { output, apiClient } = context, { extOptions } =
|
|
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({
|
|
3813
|
+
const { output, apiClient } = context, flags = { ...defaultFlags$b, ...args.extOptions }, client2 = apiClient({
|
|
3835
3814
|
requireUser: !0,
|
|
3836
3815
|
requireProject: !1
|
|
3837
3816
|
}), { token: token2 } = client2.config();
|
|
@@ -3853,7 +3832,6 @@ Examples:
|
|
|
3853
3832
|
...cmdConfig.value,
|
|
3854
3833
|
args: { type: resourceType },
|
|
3855
3834
|
flags: {
|
|
3856
|
-
example: flags.example,
|
|
3857
3835
|
name: flags.n ?? flags.name,
|
|
3858
3836
|
"fn-type": flags["fn-type"],
|
|
3859
3837
|
language: flags.lang ?? flags["fn-language"],
|
|
@@ -4042,14 +4020,11 @@ Options
|
|
|
4042
4020
|
--project-id <id> Project ID to use
|
|
4043
4021
|
|
|
4044
4022
|
Examples:
|
|
4045
|
-
# Create a new Blueprint
|
|
4023
|
+
# Create a new Blueprint manifest file in the current directory
|
|
4046
4024
|
sanity blueprints init
|
|
4047
4025
|
|
|
4048
|
-
# Create a new Blueprint
|
|
4026
|
+
# Create a new Blueprint manifest file in a specific directory
|
|
4049
4027
|
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
|
|
4053
4028
|
`, defaultFlags$6 = {
|
|
4054
4029
|
//
|
|
4055
4030
|
}, initBlueprintsCommand = {
|
|
@@ -4064,21 +4039,7 @@ Examples:
|
|
|
4064
4039
|
requireProject: !1
|
|
4065
4040
|
}), { token: token2 } = client2.config();
|
|
4066
4041
|
if (!token2) throw new Error("No API token found. Please run `sanity login`.");
|
|
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({
|
|
4042
|
+
const { blueprintInitCore } = await import("@sanity/runtime-cli/cores/blueprints"), { success, error: error2 } = await blueprintInitCore({
|
|
4082
4043
|
bin: "sanity",
|
|
4083
4044
|
log: (message) => output.print(message),
|
|
4084
4045
|
token: token2,
|
|
@@ -4086,7 +4047,6 @@ Examples:
|
|
|
4086
4047
|
dir: dir ?? flags.dir
|
|
4087
4048
|
},
|
|
4088
4049
|
flags: {
|
|
4089
|
-
example: flags.example,
|
|
4090
4050
|
"blueprint-type": flags["blueprint-type"] ?? flags.type,
|
|
4091
4051
|
"project-id": flags["project-id"] ?? flags.projectId ?? flags.project,
|
|
4092
4052
|
"stack-id": flags["stack-id"] ?? flags.stackId ?? flags.stack,
|
|
@@ -23562,23 +23522,23 @@ async function installDeclaredPackages(cwd, packageManager, context) {
|
|
|
23562
23522
|
encoding: "utf8",
|
|
23563
23523
|
env: getPartialEnvWithNpmPath(cwd),
|
|
23564
23524
|
cwd,
|
|
23565
|
-
stdio: "
|
|
23566
|
-
};
|
|
23525
|
+
stdio: "inherit"
|
|
23526
|
+
}, npmArgs = ["install", "--legacy-peer-deps"];
|
|
23567
23527
|
let result;
|
|
23568
|
-
|
|
23569
|
-
npm
|
|
23570
|
-
|
|
23571
|
-
|
|
23572
|
-
|
|
23573
|
-
}
|
|
23574
|
-
|
|
23575
|
-
|
|
23576
|
-
|
|
23577
|
-
|
|
23578
|
-
|
|
23579
|
-
|
|
23580
|
-
|
|
23581
|
-
|
|
23528
|
+
if (packageManager === "npm")
|
|
23529
|
+
output.print(`Running 'npm ${npmArgs.join(" ")}'`), result = await execa("npm", npmArgs, execOptions);
|
|
23530
|
+
else if (packageManager === "yarn") {
|
|
23531
|
+
const yarnArgs = ["install"];
|
|
23532
|
+
output.print(`Running 'yarn ${yarnArgs.join(" ")}'`), result = await execa("yarn", yarnArgs, execOptions);
|
|
23533
|
+
} else if (packageManager === "pnpm") {
|
|
23534
|
+
const pnpmArgs = ["install"];
|
|
23535
|
+
output.print(`Running 'pnpm ${pnpmArgs.join(" ")}'`), result = await execa("pnpm", pnpmArgs, execOptions);
|
|
23536
|
+
} else if (packageManager === "bun") {
|
|
23537
|
+
const bunArgs = ["install"];
|
|
23538
|
+
output.print(`Running 'bun ${bunArgs.join(" ")}'`), result = await execa("bun", bunArgs, execOptions);
|
|
23539
|
+
} else packageManager === "manual" && output.print(`Manual installation selected - run 'npm ${npmArgs.join(" ")}' or similar`);
|
|
23540
|
+
if (result?.exitCode || result?.failed)
|
|
23541
|
+
throw new Error("Dependency installation failed");
|
|
23582
23542
|
}
|
|
23583
23543
|
async function installNewPackages(options2, context) {
|
|
23584
23544
|
const { packageManager, packages } = options2, { output, workDir } = context, execOptions = {
|
|
@@ -53736,15 +53696,18 @@ ${chalk2.green("Success!")} Your Sanity configuration files has been added to th
|
|
|
53736
53696
|
pnpm: "pnpm dev",
|
|
53737
53697
|
bun: "bun dev",
|
|
53738
53698
|
manual: "npm run dev"
|
|
53739
|
-
}[pkgManager]
|
|
53740
|
-
|
|
53741
|
-
|
|
53742
|
-
|
|
53743
|
-
|
|
53744
|
-
`
|
|
53745
|
-
|
|
53746
|
-
|
|
53747
|
-
`), print(
|
|
53699
|
+
}[pkgManager];
|
|
53700
|
+
outputPath === process.cwd() ? (print(`
|
|
53701
|
+
${chalk2.green("Success!")} Now, use this command to continue:
|
|
53702
|
+
`), print(
|
|
53703
|
+
`${chalk2.cyan(devCommand)} - to run ${isAppTemplate ? "your Sanity application" : "Sanity Studio"}
|
|
53704
|
+
`
|
|
53705
|
+
)) : (print(`
|
|
53706
|
+
${chalk2.green("Success!")} Now, use these commands to continue:
|
|
53707
|
+
`), print(`First: ${chalk2.cyan(`cd ${outputPath}`)} - to enter project's directory`), print(
|
|
53708
|
+
`Then: ${chalk2.cyan(devCommand)} -to run ${isAppTemplate ? "your Sanity application" : "Sanity Studio"}
|
|
53709
|
+
`
|
|
53710
|
+
)), print("Other helpful commands"), print("npx sanity docs - to open the documentation in a browser"), print("npx sanity manage - to open the project settings in a browser"), print("npx sanity help - to explore the CLI manual"), isFirstProject && (trace.log({ step: "sendCommunityInvite", selectedOption: "yes" }), print(`
|
|
53748
53711
|
Join our wonderful developer community as well: ${chalk2.cyan("https://snty.link/community")}`), print(`We look forward to seeing you there!
|
|
53749
53712
|
`)), trace.complete();
|
|
53750
53713
|
async function getOrCreateUser() {
|
|
@@ -79686,10 +79649,7 @@ async function runCli(cliRoot, { cliVersion }) {
|
|
|
79686
79649
|
await flushTelemetry();
|
|
79687
79650
|
const error2 = typeof err.details == "string" ? err.details : err;
|
|
79688
79651
|
console.error(`
|
|
79689
|
-
${error2.stack ? neatStack(err) : error2}`),
|
|
79690
|
-
Caused by:
|
|
79691
|
-
|
|
79692
|
-
${err.cause.stack ? neatStack(err.cause) : err.cause}`), cliCommandTrace.error(error2), process.exit(1);
|
|
79652
|
+
${error2.stack ? neatStack(err) : error2}`), cliCommandTrace.error(error2), process.exit(1);
|
|
79693
79653
|
});
|
|
79694
79654
|
}
|
|
79695
79655
|
async function getCoreModulePath(workDir, cliConfig) {
|