@sanity/cli 3.57.2 → 3.57.3
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 +32 -4
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/package.json +6 -6
- package/src/actions/init-project/bootstrapTemplate.ts +1 -0
- package/src/actions/init-project/createCliConfig.ts +33 -4
- package/src/actions/init-project/createStudioConfig.ts +7 -2
- package/src/actions/init-project/initProject.ts +7 -0
- package/src/commands/init/initCommand.ts +2 -0
package/lib/_chunks-cjs/cli.js
CHANGED
@@ -42045,7 +42045,12 @@ export default defineCliConfig({
|
|
42045
42045
|
api: {
|
42046
42046
|
projectId: '%projectId%',
|
42047
42047
|
dataset: '%dataset%'
|
42048
|
-
}
|
42048
|
+
},
|
42049
|
+
/**
|
42050
|
+
* Enable auto-updates for studios.
|
42051
|
+
* Learn more at https://www.sanity.io/docs/cli#auto-updates
|
42052
|
+
*/
|
42053
|
+
autoUpdates: __BOOL__autoUpdates__,
|
42049
42054
|
})
|
42050
42055
|
`;
|
42051
42056
|
function createCliConfig(options2) {
|
@@ -42059,7 +42064,24 @@ function createCliConfig(options2) {
|
|
42059
42064
|
const variableName = value.slice(1, -1);
|
42060
42065
|
if (!(variableName in variables))
|
42061
42066
|
throw new Error(`Template variable '${value}' not defined`);
|
42062
|
-
|
42067
|
+
const newValue = variables[variableName];
|
42068
|
+
node.value = typeof newValue == "string" ? newValue : "";
|
42069
|
+
}
|
42070
|
+
},
|
42071
|
+
Identifier: {
|
42072
|
+
enter(path2) {
|
42073
|
+
if (!path2.node.name.startsWith("__BOOL__"))
|
42074
|
+
return;
|
42075
|
+
const variableName = path2.node.name.replace(
|
42076
|
+
/^__BOOL__(.+?)__$/,
|
42077
|
+
"$1"
|
42078
|
+
);
|
42079
|
+
if (!(variableName in variables))
|
42080
|
+
throw new Error(`Template variable '${variableName}' not defined`);
|
42081
|
+
const value = variables[variableName];
|
42082
|
+
if (typeof value != "boolean")
|
42083
|
+
throw new Error(`Expected boolean value for '${variableName}'`);
|
42084
|
+
path2.replaceWith({ type: "BooleanLiteral", value });
|
42063
42085
|
}
|
42064
42086
|
}
|
42065
42087
|
}), main$3.print(ast, { quote: "single" }).code;
|
@@ -42198,7 +42220,8 @@ function createStudioConfig(options2) {
|
|
42198
42220
|
const variableName = value.slice(1, -1);
|
42199
42221
|
if (!(variableName in variables))
|
42200
42222
|
throw new Error(`Template variable '${value}' not defined`);
|
42201
|
-
|
42223
|
+
const newValue = variables[variableName];
|
42224
|
+
node.value = typeof newValue == "string" ? newValue : "";
|
42202
42225
|
}
|
42203
42226
|
}
|
42204
42227
|
}), main$3.print(ast, { quote: "single" }).code;
|
@@ -42432,7 +42455,8 @@ async function bootstrapTemplate(opts, context) {
|
|
42432
42455
|
variables
|
42433
42456
|
}), cliConfig = await createCliConfig({
|
42434
42457
|
projectId: variables.projectId,
|
42435
|
-
dataset: variables.dataset
|
42458
|
+
dataset: variables.dataset,
|
42459
|
+
autoUpdates: variables.autoUpdates
|
42436
42460
|
}), codeExt = useTypeScript ? "ts" : "js";
|
42437
42461
|
await Promise.all([
|
42438
42462
|
writeFileIfNotExists(`sanity.config.${codeExt}`, studioConfig),
|
@@ -44396,6 +44420,8 @@ ${chalk2.green("Success!")} Your Sanity configuration files has been added to th
|
|
44396
44420
|
const typescriptOnly = template.typescriptOnly === !0;
|
44397
44421
|
let useTypeScript = !0;
|
44398
44422
|
!typescriptOnly && typeof cliFlags.typescript == "boolean" ? useTypeScript = cliFlags.typescript : !typescriptOnly && !unattended && (useTypeScript = await promptForTypeScript(prompt2), trace.log({ step: "useTypeScript", selectedOption: useTypeScript ? "yes" : "no" }));
|
44423
|
+
let autoUpdates = !0;
|
44424
|
+
typeof cliFlags["auto-updates"] == "boolean" && (autoUpdates = cliFlags["auto-updates"]);
|
44399
44425
|
const templateOptions = {
|
44400
44426
|
outputPath,
|
44401
44427
|
packageName: sluggedName,
|
@@ -44403,6 +44429,7 @@ ${chalk2.green("Success!")} Your Sanity configuration files has been added to th
|
|
44403
44429
|
schemaUrl,
|
44404
44430
|
useTypeScript,
|
44405
44431
|
variables: {
|
44432
|
+
autoUpdates,
|
44406
44433
|
dataset: datasetName,
|
44407
44434
|
projectId,
|
44408
44435
|
projectName: displayName || answers.projectName
|
@@ -44926,6 +44953,7 @@ Options
|
|
44926
44953
|
--coupon <name> Optionally select a coupon for a new project (cannot be used with --project-plan)
|
44927
44954
|
--no-typescript Do not use TypeScript for template files
|
44928
44955
|
--package-manager <name> Specify which package manager to use [allowed: ${allowedPackageManagersString}]
|
44956
|
+
--no-auto-updates Disable auto updates of studio versions
|
44929
44957
|
|
44930
44958
|
Examples
|
44931
44959
|
# Initialize a new project, prompt for required information along the way
|