@sanity/cli 3.58.0 → 3.59.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 +52 -30
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/lib/cli.js +0 -1
- package/lib/cli.js.map +1 -1
- package/lib/index.d.mts +0 -1
- package/lib/index.d.ts +0 -1
- package/package.json +8 -8
- package/src/actions/init-project/initProject.ts +25 -20
- package/src/cli.ts +0 -2
- package/src/commands/projects/listProjectsCommand.ts +3 -3
- package/src/types.ts +0 -1
package/lib/_chunks-cjs/cli.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
-
var fs$p = require("node:fs"), os$6 = require("node:os"), path$t = require("node:path"), chalk$2 = require("chalk"), loadEnv = require("./loadEnv.js"),
|
2
|
+
var fs$p = require("node:fs"), os$6 = require("node:os"), path$t = require("node:path"), chalk$2 = require("chalk"), loadEnv = require("./loadEnv.js"), require$$0$4 = require("path"), require$$1$2 = require("module"), require$$0$5 = require("fs"), telemetry = require("@sanity/telemetry"), childProcess$2 = require("node:child_process"), fs$o = require("node:fs/promises"), util$a = require("node:util"), require$$0$6 = require("os"), require$$0$a = require("url"), require$$1$3 = require("get-it"), require$$2$1 = require("get-it/middleware"), require$$0$7 = require("constants"), require$$0$8 = require("stream"), require$$0$9 = require("util"), require$$5$1 = require("assert"), require$$3$1 = require("events"), require$$6$1 = require("http"), semver$2 = require("semver"), pkgDir = require("pkg-dir"), client$1 = require("@sanity/client"), require$$3$2 = require("crypto"), require$$0$b = require("child_process"), require$$0$c = require("fs/promises"), fs$q = require("@sanity/util/fs"), decompress = require("decompress"), validateNpmPackageName = require("validate-npm-package-name"), getCliConfig = require("./getCliConfig.js"), require$$0$d = require("buffer"), silverFleece = require("silver-fleece"), journeyConfig = require("./journeyConfig.js"), http$1 = require("node:http"), traverse = require("@babel/traverse"), process$2 = require("node:process"), require$$2$2 = require("readline"), require$$0$e = require("tty");
|
3
3
|
function _interopDefaultCompat(e) {
|
4
4
|
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
5
5
|
}
|
@@ -33266,6 +33266,17 @@ function requireLib$1() {
|
|
33266
33266
|
syntaxPlugin
|
33267
33267
|
}) {
|
33268
33268
|
const hasMissingPlugin = reasonCode === "MissingPlugin" || reasonCode === "MissingOneOfPlugins";
|
33269
|
+
{
|
33270
|
+
const oldReasonCodes = {
|
33271
|
+
AccessorCannotDeclareThisParameter: "AccesorCannotDeclareThisParameter",
|
33272
|
+
AccessorCannotHaveTypeParameters: "AccesorCannotHaveTypeParameters",
|
33273
|
+
ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: "ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",
|
33274
|
+
SetAccessorCannotHaveOptionalParameter: "SetAccesorCannotHaveOptionalParameter",
|
33275
|
+
SetAccessorCannotHaveRestParameter: "SetAccesorCannotHaveRestParameter",
|
33276
|
+
SetAccessorCannotHaveReturnType: "SetAccesorCannotHaveReturnType"
|
33277
|
+
};
|
33278
|
+
oldReasonCodes[reasonCode] && (reasonCode = oldReasonCodes[reasonCode]);
|
33279
|
+
}
|
33269
33280
|
return function constructor(loc, details) {
|
33270
33281
|
const error2 = new SyntaxError();
|
33271
33282
|
return error2.code = code2, error2.reasonCode = reasonCode, error2.loc = loc, error2.pos = loc.index, error2.syntaxPlugin = syntaxPlugin, hasMissingPlugin && (error2.missingPlugin = details.missingPlugin), defineHidden(error2, "clone", function(overrides = {}) {
|
@@ -38055,12 +38066,12 @@ function requireLib$1() {
|
|
38055
38066
|
AbstractPropertyHasInitializer: ({
|
38056
38067
|
propertyName
|
38057
38068
|
}) => `Property '${propertyName}' cannot have an initializer because it is marked abstract.`,
|
38058
|
-
AccesorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
|
38059
|
-
AccesorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
|
38060
38069
|
AccessorCannotBeOptional: "An 'accessor' property cannot be declared optional.",
|
38070
|
+
AccessorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
|
38071
|
+
AccessorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
|
38061
38072
|
ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
|
38062
38073
|
ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.",
|
38063
|
-
|
38074
|
+
ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
|
38064
38075
|
ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.",
|
38065
38076
|
DeclareAccessor: ({
|
38066
38077
|
kind
|
@@ -38119,9 +38130,9 @@ function requireLib$1() {
|
|
38119
38130
|
ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.",
|
38120
38131
|
ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",
|
38121
38132
|
ReservedTypeAssertion: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",
|
38122
|
-
|
38123
|
-
|
38124
|
-
|
38133
|
+
SetAccessorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.",
|
38134
|
+
SetAccessorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.",
|
38135
|
+
SetAccessorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.",
|
38125
38136
|
SingleTypeParameterWithoutTrailingComma: ({
|
38126
38137
|
typeParameterName
|
38127
38138
|
}) => `Single type parameter ${typeParameterName} should have a trailing comma. Example usage: <${typeParameterName},>.`,
|
@@ -38196,10 +38207,13 @@ function requireLib$1() {
|
|
38196
38207
|
return tokenIsIdentifier(this.state.type);
|
38197
38208
|
}
|
38198
38209
|
tsTokenCanFollowModifier() {
|
38199
|
-
return
|
38210
|
+
return this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(138) || this.isLiteralPropertyName();
|
38211
|
+
}
|
38212
|
+
tsNextTokenOnSameLineAndCanFollowModifier() {
|
38213
|
+
return this.next(), this.hasPrecedingLineBreak() ? !1 : this.tsTokenCanFollowModifier();
|
38200
38214
|
}
|
38201
38215
|
tsNextTokenCanFollowModifier() {
|
38202
|
-
return this.next(), this.tsTokenCanFollowModifier();
|
38216
|
+
return this.match(106) ? (this.next(), this.tsTokenCanFollowModifier()) : this.tsNextTokenOnSameLineAndCanFollowModifier();
|
38203
38217
|
}
|
38204
38218
|
tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
|
38205
38219
|
if (!tokenIsIdentifier(this.state.type) && this.state.type !== 58 && this.state.type !== 75)
|
@@ -38374,18 +38388,18 @@ function requireLib$1() {
|
|
38374
38388
|
if (this.match(10) || this.match(47)) {
|
38375
38389
|
readonly && this.raise(TSErrors.ReadonlyForMethodSignature, node);
|
38376
38390
|
const method = nodeAny;
|
38377
|
-
method.kind && this.match(47) && this.raise(TSErrors.
|
38391
|
+
method.kind && this.match(47) && this.raise(TSErrors.AccessorCannotHaveTypeParameters, this.state.curPosition()), this.tsFillSignature(14, method), this.tsParseTypeMemberSemicolon();
|
38378
38392
|
const paramsKey = "parameters", returnTypeKey = "typeAnnotation";
|
38379
38393
|
if (method.kind === "get")
|
38380
|
-
method[paramsKey].length > 0 && (this.raise(Errors.BadGetterArity, this.state.curPosition()), this.isThisParam(method[paramsKey][0]) && this.raise(TSErrors.
|
38394
|
+
method[paramsKey].length > 0 && (this.raise(Errors.BadGetterArity, this.state.curPosition()), this.isThisParam(method[paramsKey][0]) && this.raise(TSErrors.AccessorCannotDeclareThisParameter, this.state.curPosition()));
|
38381
38395
|
else if (method.kind === "set") {
|
38382
38396
|
if (method[paramsKey].length !== 1)
|
38383
38397
|
this.raise(Errors.BadSetterArity, this.state.curPosition());
|
38384
38398
|
else {
|
38385
38399
|
const firstParameter = method[paramsKey][0];
|
38386
|
-
this.isThisParam(firstParameter) && this.raise(TSErrors.
|
38400
|
+
this.isThisParam(firstParameter) && this.raise(TSErrors.AccessorCannotDeclareThisParameter, this.state.curPosition()), firstParameter.type === "Identifier" && firstParameter.optional && this.raise(TSErrors.SetAccessorCannotHaveOptionalParameter, this.state.curPosition()), firstParameter.type === "RestElement" && this.raise(TSErrors.SetAccessorCannotHaveRestParameter, this.state.curPosition());
|
38387
38401
|
}
|
38388
|
-
method[returnTypeKey] && this.raise(TSErrors.
|
38402
|
+
method[returnTypeKey] && this.raise(TSErrors.SetAccessorCannotHaveReturnType, method[returnTypeKey]);
|
38389
38403
|
} else
|
38390
38404
|
method.kind = "method";
|
38391
38405
|
return this.finishNode(method, "TSMethodSignature");
|
@@ -38423,13 +38437,14 @@ function requireLib$1() {
|
|
38423
38437
|
tsIsStartOfMappedType() {
|
38424
38438
|
return this.next(), this.eat(53) ? this.isContextual(122) : (this.isContextual(122) && this.next(), !this.match(0) || (this.next(), !this.tsIsIdentifier()) ? !1 : (this.next(), this.match(58)));
|
38425
38439
|
}
|
38426
|
-
tsParseMappedTypeParameter() {
|
38427
|
-
const node = this.startNode();
|
38428
|
-
return node.name = this.tsParseTypeParameterName(), node.constraint = this.tsExpectThenParseType(58), this.finishNode(node, "TSTypeParameter");
|
38429
|
-
}
|
38430
38440
|
tsParseMappedType() {
|
38431
38441
|
const node = this.startNode();
|
38432
|
-
|
38442
|
+
this.expect(5), this.match(53) ? (node.readonly = this.state.value, this.next(), this.expectContextual(122)) : this.eatContextual(122) && (node.readonly = !0), this.expect(0);
|
38443
|
+
{
|
38444
|
+
const typeParameter = this.startNode();
|
38445
|
+
typeParameter.name = this.tsParseTypeParameterName(), typeParameter.constraint = this.tsExpectThenParseType(58), node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
|
38446
|
+
}
|
38447
|
+
return node.nameType = this.eatContextual(93) ? this.tsParseType() : null, this.expect(3), this.match(53) ? (node.optional = this.state.value, this.next(), this.expect(17)) : this.eat(17) && (node.optional = !0), node.typeAnnotation = this.tsTryParseType(), this.semicolon(), this.expect(8), this.finishNode(node, "TSMappedType");
|
38433
38448
|
}
|
38434
38449
|
tsParseTupleType() {
|
38435
38450
|
const node = this.startNode();
|
@@ -39107,7 +39122,7 @@ function requireLib$1() {
|
|
39107
39122
|
id,
|
39108
39123
|
init
|
39109
39124
|
} of declaration.declarations)
|
39110
|
-
init && (kind !== "const" || id.typeAnnotation ? this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init) : isValidAmbientConstInitializer(init, this.hasPlugin("estree")) || this.raise(TSErrors.
|
39125
|
+
init && (kind !== "const" || id.typeAnnotation ? this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init) : isValidAmbientConstInitializer(init, this.hasPlugin("estree")) || this.raise(TSErrors.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference, init));
|
39111
39126
|
return declaration;
|
39112
39127
|
}
|
39113
39128
|
parseStatementContent(flags, decorators) {
|
@@ -44435,13 +44450,21 @@ ${chalk2.green("Success!")} Your Sanity configuration files has been added to th
|
|
44435
44450
|
projectName: displayName || answers.projectName
|
44436
44451
|
}
|
44437
44452
|
}, shouldImport = !unattended && template.datasetUrl && await promptForDatasetImport(template.importPrompt);
|
44438
|
-
trace.log({ step: "importTemplateDataset", selectedOption: shouldImport ? "yes" : "no" })
|
44439
|
-
|
44440
|
-
|
44441
|
-
|
44442
|
-
|
44443
|
-
|
44444
|
-
|
44453
|
+
trace.log({ step: "importTemplateDataset", selectedOption: shouldImport ? "yes" : "no" });
|
44454
|
+
const [_2, bootstrapPromise] = await Promise.allSettled([
|
44455
|
+
// record template files attempted to be created locally
|
44456
|
+
apiClient({ api: { projectId } }).request({ uri: `/projects/${projectId}` }).then((project) => project?.metadata?.cliInitializedAt ? Promise.resolve() : apiClient({ api: { projectId } }).request({
|
44457
|
+
method: "PATCH",
|
44458
|
+
uri: `/projects/${projectId}`,
|
44459
|
+
body: { metadata: { cliInitializedAt: (/* @__PURE__ */ new Date()).toISOString() } }
|
44460
|
+
})).catch(() => {
|
44461
|
+
loadEnv.debug("Failed to update cliInitializedAt metadata");
|
44462
|
+
}),
|
44463
|
+
// Bootstrap Sanity, creating required project files, manifests etc
|
44464
|
+
bootstrapTemplate(templateOptions, context)
|
44465
|
+
]);
|
44466
|
+
if (bootstrapPromise.status === "rejected" && bootstrapPromise.reason instanceof Error)
|
44467
|
+
throw bootstrapPromise.reason;
|
44445
44468
|
let pkgManager;
|
44446
44469
|
if (packageManager && ALLOWED_PACKAGE_MANAGERS.includes(packageManager) ? pkgManager = packageManager : (pkgManager = (await getPackageManagerChoice(outputPath, {
|
44447
44470
|
prompt: prompt2,
|
@@ -45106,9 +45129,9 @@ Examples
|
|
45106
45129
|
requireUser: !0,
|
45107
45130
|
requireProject: !1
|
45108
45131
|
}).projects.list(), ordered = lodashExports.sortBy(
|
45109
|
-
projects.map(({ displayName, id, members = [],
|
45110
|
-
const
|
45111
|
-
return [id, members.length, displayName,
|
45132
|
+
projects.map(({ displayName, id, members = [], createdAt }) => {
|
45133
|
+
const manage = `https://www.sanity.io/manage/project/${id}`;
|
45134
|
+
return [id, members.length, displayName, manage, createdAt].map(String);
|
45112
45135
|
}),
|
45113
45136
|
[headings.indexOf(flags.sort)]
|
45114
45137
|
), rows = flags.order === "asc" ? ordered : ordered.reverse(), maxWidths = rows.reduce(
|
@@ -70316,7 +70339,6 @@ async function runCli(cliRoot, { cliVersion }) {
|
|
70316
70339
|
Promise.race([wait(2e3), flushTelemetry()])
|
70317
70340
|
)
|
70318
70341
|
), telemetry2.updateUserProperties({
|
70319
|
-
deviceId: await nodeMachineId.machineId(),
|
70320
70342
|
runtimeVersion: process.version,
|
70321
70343
|
runtime: detectRuntime(),
|
70322
70344
|
cliVersion: pkg.version,
|