@sanity/cli 3.79.1-media-library.124 → 3.79.1-media-library.102
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 +88 -92
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/lib/index.d.mts +2 -2
- package/lib/index.d.ts +2 -2
- package/package.json +5 -5
- package/src/actions/init-project/bootstrapLocalTemplate.ts +10 -10
- package/src/actions/init-project/{createCoreAppCliConfig.ts → createAppCliConfig.ts} +4 -4
- package/src/actions/init-project/{determineCoreAppTemplate.ts → determineAppTemplate.ts} +3 -3
- package/src/actions/init-project/initProject.ts +8 -8
- package/src/actions/init-project/templates/{coreApp.ts → appQuickstart.ts} +4 -4
- package/src/actions/init-project/templates/index.ts +2 -2
- package/src/types.ts +2 -2
- package/templates/core-app/src/App.tsx +2 -2
package/lib/_chunks-cjs/cli.js
CHANGED
@@ -37503,7 +37503,7 @@ function requireLib$1() {
|
|
37503
37503
|
if (r == null) return {};
|
37504
37504
|
var t = {};
|
37505
37505
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
37506
|
-
if (e.
|
37506
|
+
if (e.indexOf(n) !== -1) continue;
|
37507
37507
|
t[n] = r[n];
|
37508
37508
|
}
|
37509
37509
|
return t;
|
@@ -40876,8 +40876,7 @@ function requireLib$1() {
|
|
40876
40876
|
!this.eat(13) && !this.eat(12) && !this.match(8) && !this.match(9) && this.unexpected();
|
40877
40877
|
}
|
40878
40878
|
flowParseQualifiedTypeIdentifier(startLoc, id) {
|
40879
|
-
|
40880
|
-
(_startLoc = startLoc) != null || (startLoc = this.state.startLoc);
|
40879
|
+
startLoc ?? (startLoc = this.state.startLoc);
|
40881
40880
|
let node = id || this.flowParseRestrictedIdentifier(!0);
|
40882
40881
|
for (; this.eat(16); ) {
|
40883
40882
|
const node2 = this.startNodeAt(startLoc);
|
@@ -42494,17 +42493,18 @@ function requireLib$1() {
|
|
42494
42493
|
const end = exprList.length - 1;
|
42495
42494
|
for (let i = 0; i <= end; i++) {
|
42496
42495
|
const elt = exprList[i];
|
42497
|
-
|
42498
|
-
if (elt.type === "SpreadElement") {
|
42499
|
-
elt.type = "RestElement";
|
42500
|
-
const arg = elt.argument;
|
42501
|
-
this.checkToRestConversion(arg, !0), this.toAssignable(arg, isLHS);
|
42502
|
-
} else
|
42503
|
-
this.toAssignable(elt, isLHS);
|
42504
|
-
elt.type === "RestElement" && (i < end ? this.raise(Errors.RestTrailingComma, elt) : trailingCommaLoc && this.raise(Errors.RestTrailingComma, trailingCommaLoc));
|
42505
|
-
}
|
42496
|
+
elt && (this.toAssignableListItem(exprList, i, isLHS), elt.type === "RestElement" && (i < end ? this.raise(Errors.RestTrailingComma, elt) : trailingCommaLoc && this.raise(Errors.RestTrailingComma, trailingCommaLoc)));
|
42506
42497
|
}
|
42507
42498
|
}
|
42499
|
+
toAssignableListItem(exprList, index, isLHS) {
|
42500
|
+
const node = exprList[index];
|
42501
|
+
if (node.type === "SpreadElement") {
|
42502
|
+
node.type = "RestElement";
|
42503
|
+
const arg = node.argument;
|
42504
|
+
this.checkToRestConversion(arg, !0), this.toAssignable(arg, isLHS);
|
42505
|
+
} else
|
42506
|
+
this.toAssignable(node, isLHS);
|
42507
|
+
}
|
42508
42508
|
isAssignable(node, isBinding) {
|
42509
42509
|
switch (node.type) {
|
42510
42510
|
case "Identifier":
|
@@ -42578,9 +42578,10 @@ function requireLib$1() {
|
|
42578
42578
|
}
|
42579
42579
|
} else {
|
42580
42580
|
const decorators = [];
|
42581
|
-
|
42582
|
-
decorators.
|
42583
|
-
|
42581
|
+
if (flags & 2)
|
42582
|
+
for (this.match(26) && this.hasPlugin("decorators") && this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc); this.match(26); )
|
42583
|
+
decorators.push(this.parseDecorator());
|
42584
|
+
elts.push(this.parseBindingElement(flags, decorators));
|
42584
42585
|
}
|
42585
42586
|
}
|
42586
42587
|
return elts;
|
@@ -42598,7 +42599,7 @@ function requireLib$1() {
|
|
42598
42599
|
const prop = this.startNode();
|
42599
42600
|
return type2 === 139 ? (this.expectPlugin("destructuringPrivate", startLoc), this.classScope.usePrivateName(this.state.value, startLoc), prop.key = this.parsePrivateName()) : this.parsePropertyName(prop), prop.method = !1, this.parseObjPropValue(prop, startLoc, !1, !1, !0, !1);
|
42600
42601
|
}
|
42601
|
-
|
42602
|
+
parseBindingElement(flags, decorators) {
|
42602
42603
|
const left = this.parseMaybeDefault();
|
42603
42604
|
(this.hasPlugin("flow") || flags & 2) && this.parseFunctionParamType(left);
|
42604
42605
|
const elt = this.parseMaybeDefault(left.loc.start, left);
|
@@ -42608,8 +42609,7 @@ function requireLib$1() {
|
|
42608
42609
|
return param;
|
42609
42610
|
}
|
42610
42611
|
parseMaybeDefault(startLoc, left) {
|
42611
|
-
|
42612
|
-
if ((_startLoc = startLoc) != null || (startLoc = this.state.startLoc), left = (_left = left) != null ? _left : this.parseBindingAtom(), !this.eat(29)) return left;
|
42612
|
+
if (startLoc ?? (startLoc = this.state.startLoc), left = left ?? this.parseBindingAtom(), !this.eat(29)) return left;
|
42613
42613
|
const node = this.startNodeAt(startLoc);
|
42614
42614
|
return node.left = left, node.right = this.parseMaybeAssignAllowIn(), this.finishNode(node, "AssignmentPattern");
|
42615
42615
|
}
|
@@ -42753,6 +42753,9 @@ function requireLib$1() {
|
|
42753
42753
|
IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.",
|
42754
42754
|
IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.",
|
42755
42755
|
InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.",
|
42756
|
+
InvalidHeritageClauseType: ({
|
42757
|
+
token: token2
|
42758
|
+
}) => `'${token2}' list can only include identifiers or qualified-names with optional type arguments.`,
|
42756
42759
|
InvalidModifierOnTypeMember: ({
|
42757
42760
|
modifier
|
42758
42761
|
}) => `'${modifier}' modifier cannot appear on a type member.`,
|
@@ -43379,8 +43382,10 @@ function requireLib$1() {
|
|
43379
43382
|
}
|
43380
43383
|
tsParseHeritageClause(token2) {
|
43381
43384
|
const originalStartLoc = this.state.startLoc, delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => {
|
43382
|
-
|
43383
|
-
|
43385
|
+
{
|
43386
|
+
const node = this.startNode();
|
43387
|
+
return node.expression = this.tsParseEntityName(3), this.match(47) && (node.typeParameters = this.tsParseTypeArguments()), this.finishNode(node, "TSExpressionWithTypeArguments");
|
43388
|
+
}
|
43384
43389
|
});
|
43385
43390
|
return delimitedList.length || this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
|
43386
43391
|
token: token2
|
@@ -43612,7 +43617,7 @@ function requireLib$1() {
|
|
43612
43617
|
isExportDefaultSpecifier() {
|
43613
43618
|
return this.tsIsDeclarationStart() ? !1 : super.isExportDefaultSpecifier();
|
43614
43619
|
}
|
43615
|
-
|
43620
|
+
parseBindingElement(flags, decorators) {
|
43616
43621
|
const startLoc = this.state.startLoc, modified = {};
|
43617
43622
|
this.tsParseModifiers({
|
43618
43623
|
allowedModifiers: ["public", "private", "protected", "override", "readonly"]
|
@@ -43853,10 +43858,13 @@ function requireLib$1() {
|
|
43853
43858
|
return this.tsIsDeclarationStart() ? !0 : super.shouldParseExportDeclaration();
|
43854
43859
|
}
|
43855
43860
|
parseConditional(expr, startLoc, refExpressionErrors) {
|
43856
|
-
if (!this.
|
43857
|
-
|
43858
|
-
|
43859
|
-
|
43861
|
+
if (!this.match(17)) return expr;
|
43862
|
+
if (this.state.maybeInArrowParameters) {
|
43863
|
+
const nextCh = this.lookaheadCharCode();
|
43864
|
+
if (nextCh === 44 || nextCh === 61 || nextCh === 58 || nextCh === 41)
|
43865
|
+
return this.setOptionalParametersError(refExpressionErrors), expr;
|
43866
|
+
}
|
43867
|
+
return super.parseConditional(expr, startLoc, refExpressionErrors);
|
43860
43868
|
}
|
43861
43869
|
parseParenItem(node, startLoc) {
|
43862
43870
|
const newNode = super.parseParenItem(node, startLoc);
|
@@ -43976,8 +43984,8 @@ function requireLib$1() {
|
|
43976
43984
|
throw ((_jsx3 = jsx3) == null ? void 0 : _jsx3.error) || arrow4.error || ((_typeCast2 = typeCast) == null ? void 0 : _typeCast2.error);
|
43977
43985
|
}
|
43978
43986
|
reportReservedArrowTypeParam(node) {
|
43979
|
-
var _node$
|
43980
|
-
node.params.length === 1 && !node.params[0].constraint && !((_node$
|
43987
|
+
var _node$extra2;
|
43988
|
+
node.params.length === 1 && !node.params[0].constraint && !((_node$extra2 = node.extra) != null && _node$extra2.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike") && this.raise(TSErrors.ReservedArrowTypeParam, node);
|
43981
43989
|
}
|
43982
43990
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
43983
43991
|
return !this.hasPlugin("jsx") && this.match(47) ? this.tsParseTypeAssertion() : super.parseMaybeUnary(refExpressionErrors, sawUnary);
|
@@ -44057,7 +44065,6 @@ function requireLib$1() {
|
|
44057
44065
|
case "TSParameterProperty":
|
44058
44066
|
return "parameter";
|
44059
44067
|
case "TSNonNullExpression":
|
44060
|
-
case "TSInstantiationExpression":
|
44061
44068
|
return "expression";
|
44062
44069
|
case "TSAsExpression":
|
44063
44070
|
case "TSSatisfiesExpression":
|
@@ -44119,12 +44126,9 @@ function requireLib$1() {
|
|
44119
44126
|
} = this.state;
|
44120
44127
|
return type2 === 51 ? (this.state.pos -= 2, this.finishOp(47, 1), 47) : type2;
|
44121
44128
|
}
|
44122
|
-
|
44123
|
-
|
44124
|
-
|
44125
|
-
expr?.type === "TSTypeCastExpression" && (exprList[i] = this.typeCastToParameter(expr));
|
44126
|
-
}
|
44127
|
-
super.toAssignableList(exprList, trailingCommaLoc, isLHS);
|
44129
|
+
toAssignableListItem(exprList, index, isLHS) {
|
44130
|
+
const node = exprList[index];
|
44131
|
+
node.type === "TSTypeCastExpression" && (exprList[index] = this.typeCastToParameter(node)), super.toAssignableListItem(exprList, index, isLHS);
|
44128
44132
|
}
|
44129
44133
|
typeCastToParameter(node) {
|
44130
44134
|
return node.expression.typeAnnotation = node.typeAnnotation, this.resetEndLocation(node.expression, node.typeAnnotation.loc.end), node.expression;
|
@@ -44478,17 +44482,11 @@ function requireLib$1() {
|
|
44478
44482
|
placeholders
|
44479
44483
|
}, mixinPluginNames = Object.keys(mixinPlugins);
|
44480
44484
|
class ExpressionParser extends LValParser {
|
44481
|
-
checkProto(prop, isRecord,
|
44485
|
+
checkProto(prop, isRecord, sawProto, refExpressionErrors) {
|
44482
44486
|
if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand)
|
44483
|
-
return;
|
44487
|
+
return sawProto;
|
44484
44488
|
const key2 = prop.key;
|
44485
|
-
|
44486
|
-
if (isRecord) {
|
44487
|
-
this.raise(Errors.RecordNoProto, key2);
|
44488
|
-
return;
|
44489
|
-
}
|
44490
|
-
protoRef.used && (refExpressionErrors ? refExpressionErrors.doubleProtoLoc === null && (refExpressionErrors.doubleProtoLoc = key2.loc.start) : this.raise(Errors.DuplicateProto, key2)), protoRef.used = !0;
|
44491
|
-
}
|
44489
|
+
return (key2.type === "Identifier" ? key2.name : key2.value) === "__proto__" ? isRecord ? (this.raise(Errors.RecordNoProto, key2), !0) : (sawProto && (refExpressionErrors ? refExpressionErrors.doubleProtoLoc === null && (refExpressionErrors.doubleProtoLoc = key2.loc.start) : this.raise(Errors.DuplicateProto, key2)), !0) : sawProto;
|
44492
44490
|
}
|
44493
44491
|
shouldExitDescending(expr, potentialArrowAt) {
|
44494
44492
|
return expr.type === "ArrowFunctionExpression" && this.offsetToSourcePos(expr.start) === potentialArrowAt;
|
@@ -44517,9 +44515,8 @@ function requireLib$1() {
|
|
44517
44515
|
parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse) {
|
44518
44516
|
return this.allowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse));
|
44519
44517
|
}
|
44520
|
-
setOptionalParametersError(refExpressionErrors
|
44521
|
-
|
44522
|
-
refExpressionErrors.optionalParametersLoc = (_resultError$loc = resultError?.loc) != null ? _resultError$loc : this.state.startLoc;
|
44518
|
+
setOptionalParametersError(refExpressionErrors) {
|
44519
|
+
refExpressionErrors.optionalParametersLoc = this.state.startLoc;
|
44523
44520
|
}
|
44524
44521
|
parseMaybeAssign(refExpressionErrors, afterLeftParse) {
|
44525
44522
|
const startLoc = this.state.startLoc;
|
@@ -45091,8 +45088,7 @@ function requireLib$1() {
|
|
45091
45088
|
isRecord && this.expectPlugin("recordAndTuple");
|
45092
45089
|
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
|
45093
45090
|
this.state.inFSharpPipelineDirectBody = !1;
|
45094
|
-
|
45095
|
-
let first2 = !0;
|
45091
|
+
let sawProto = !1, first2 = !0;
|
45096
45092
|
const node = this.startNode();
|
45097
45093
|
for (node.properties = [], this.next(); !this.match(close); ) {
|
45098
45094
|
if (first2)
|
@@ -45102,7 +45098,7 @@ function requireLib$1() {
|
|
45102
45098
|
break;
|
45103
45099
|
}
|
45104
45100
|
let prop;
|
45105
|
-
isPattern ? prop = this.parseBindingProperty() : (prop = this.parsePropertyDefinition(refExpressionErrors), this.checkProto(prop, isRecord,
|
45101
|
+
isPattern ? prop = this.parseBindingProperty() : (prop = this.parsePropertyDefinition(refExpressionErrors), sawProto = this.checkProto(prop, isRecord, sawProto, refExpressionErrors)), isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement" && this.raise(Errors.InvalidRecordProperty, prop), prop.shorthand && this.addExtra(prop, "shorthand", !0), node.properties.push(prop);
|
45106
45102
|
}
|
45107
45103
|
this.next(), this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
|
45108
45104
|
let type2 = "ObjectExpression";
|
@@ -45765,7 +45761,7 @@ function requireLib$1() {
|
|
45765
45761
|
case 82: {
|
45766
45762
|
!(this.optionFlags & 8) && !topLevel && this.raise(Errors.UnexpectedImportExport, this.state.startLoc), this.next();
|
45767
45763
|
let result;
|
45768
|
-
return startType === 83 ?
|
45764
|
+
return startType === 83 ? result = this.parseImport(node) : result = this.parseExport(node, decorators), this.assertModuleNodeAllowed(result), result;
|
45769
45765
|
}
|
45770
45766
|
default:
|
45771
45767
|
if (this.isAsyncFunction())
|
@@ -46215,7 +46211,7 @@ function requireLib$1() {
|
|
46215
46211
|
if (hasStar && !hasNamespace) {
|
46216
46212
|
if (hasDefault && this.unexpected(), decorators)
|
46217
46213
|
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
46218
|
-
return this.parseExportFrom(node, !0), this.finishNode(node, "ExportAllDeclaration");
|
46214
|
+
return this.parseExportFrom(node, !0), this.sawUnambiguousESM = !0, this.finishNode(node, "ExportAllDeclaration");
|
46219
46215
|
}
|
46220
46216
|
const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node);
|
46221
46217
|
hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers && this.unexpected(null, 5), hasNamespace && parseAfterNamespace && this.unexpected(null, 98);
|
@@ -46233,7 +46229,7 @@ function requireLib$1() {
|
|
46233
46229
|
this.maybeTakeDecorators(decorators, node2.declaration, node2);
|
46234
46230
|
else if (decorators)
|
46235
46231
|
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
46236
|
-
return this.finishNode(node2, "ExportNamedDeclaration");
|
46232
|
+
return this.sawUnambiguousESM = !0, this.finishNode(node2, "ExportNamedDeclaration");
|
46237
46233
|
}
|
46238
46234
|
if (this.eat(65)) {
|
46239
46235
|
const node2 = node, decl = this.parseExportDefaultExpression();
|
@@ -46241,7 +46237,7 @@ function requireLib$1() {
|
|
46241
46237
|
this.maybeTakeDecorators(decorators, decl, node2);
|
46242
46238
|
else if (decorators)
|
46243
46239
|
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
46244
|
-
return this.checkExport(node2, !0, !0), this.finishNode(node2, "ExportDefaultDeclaration");
|
46240
|
+
return this.checkExport(node2, !0, !0), this.sawUnambiguousESM = !0, this.finishNode(node2, "ExportDefaultDeclaration");
|
46245
46241
|
}
|
46246
46242
|
this.unexpected(null, 5);
|
46247
46243
|
}
|
@@ -46270,12 +46266,12 @@ function requireLib$1() {
|
|
46270
46266
|
const node2 = node;
|
46271
46267
|
node2.specifiers || (node2.specifiers = []);
|
46272
46268
|
const isTypeExport = node2.exportKind === "type";
|
46273
|
-
return node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport)), node2.source = null,
|
46269
|
+
return node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport)), node2.source = null, this.hasPlugin("importAssertions") ? node2.assertions = [] : node2.attributes = [], node2.declaration = null, !0;
|
46274
46270
|
}
|
46275
46271
|
return !1;
|
46276
46272
|
}
|
46277
46273
|
maybeParseExportDeclaration(node) {
|
46278
|
-
return this.shouldParseExportDeclaration() ? (node.specifiers = [], node.source = null, this.hasPlugin("importAssertions")
|
46274
|
+
return this.shouldParseExportDeclaration() ? (node.specifiers = [], node.source = null, this.hasPlugin("importAssertions") ? node.assertions = [] : node.attributes = [], node.declaration = this.parseExportDeclaration(node), !0) : !1;
|
46279
46275
|
}
|
46280
46276
|
isAsyncFunction() {
|
46281
46277
|
if (!this.isContextual(95)) return !1;
|
@@ -46476,7 +46472,7 @@ function requireLib$1() {
|
|
46476
46472
|
}
|
46477
46473
|
parseImportSourceAndAttributes(node) {
|
46478
46474
|
var _node$specifiers2;
|
46479
|
-
return (_node$specifiers2 = node.specifiers) != null || (node.specifiers = []), node.source = this.parseImportSource(), this.maybeParseImportAttributes(node), this.checkImportReflection(node), this.checkJSONModuleImport(node), this.semicolon(), this.finishNode(node, "ImportDeclaration");
|
46475
|
+
return (_node$specifiers2 = node.specifiers) != null || (node.specifiers = []), node.source = this.parseImportSource(), this.maybeParseImportAttributes(node), this.checkImportReflection(node), this.checkJSONModuleImport(node), this.semicolon(), this.sawUnambiguousESM = !0, this.finishNode(node, "ImportDeclaration");
|
46480
46476
|
}
|
46481
46477
|
parseImportSource() {
|
46482
46478
|
return this.match(134) || this.unexpected(), this.parseExprAtom();
|
@@ -46728,6 +46724,22 @@ function processTemplate(options2) {
|
|
46728
46724
|
}
|
46729
46725
|
}), mainExports.print(ast, { quote: "single" }).code;
|
46730
46726
|
}
|
46727
|
+
const defaultAppTemplate = `
|
46728
|
+
import {defineCliConfig} from 'sanity/cli'
|
46729
|
+
|
46730
|
+
export default defineCliConfig({
|
46731
|
+
__experimental_appConfiguration: {
|
46732
|
+
organizationId: '%organizationId%',
|
46733
|
+
appLocation: '%appLocation%',
|
46734
|
+
},
|
46735
|
+
})
|
46736
|
+
`;
|
46737
|
+
function createAppCliConfig(options2) {
|
46738
|
+
return processTemplate({
|
46739
|
+
template: defaultAppTemplate,
|
46740
|
+
variables: options2
|
46741
|
+
});
|
46742
|
+
}
|
46731
46743
|
const defaultTemplate$1 = `
|
46732
46744
|
import {defineCliConfig} from 'sanity/cli'
|
46733
46745
|
|
@@ -46750,22 +46762,6 @@ function createCliConfig(options2) {
|
|
46750
46762
|
includeBooleanTransform: !0
|
46751
46763
|
});
|
46752
46764
|
}
|
46753
|
-
const defaultCoreAppTemplate = `
|
46754
|
-
import {defineCliConfig} from 'sanity/cli'
|
46755
|
-
|
46756
|
-
export default defineCliConfig({
|
46757
|
-
__experimental_coreAppConfiguration: {
|
46758
|
-
organizationId: '%organizationId%',
|
46759
|
-
appLocation: '%appLocation%',
|
46760
|
-
},
|
46761
|
-
})
|
46762
|
-
`;
|
46763
|
-
function createCoreAppCliConfig(options2) {
|
46764
|
-
return processTemplate({
|
46765
|
-
template: defaultCoreAppTemplate,
|
46766
|
-
variables: options2
|
46767
|
-
});
|
46768
|
-
}
|
46769
46765
|
/*!
|
46770
46766
|
* isobject <https://github.com/jonschlinkert/isobject>
|
46771
46767
|
*
|
@@ -46908,14 +46904,14 @@ function createStudioConfig(options2) {
|
|
46908
46904
|
variables
|
46909
46905
|
});
|
46910
46906
|
}
|
46911
|
-
const
|
46912
|
-
function
|
46913
|
-
return
|
46907
|
+
const appTemplates = ["app-quickstart"];
|
46908
|
+
function determineAppTemplate(templateName) {
|
46909
|
+
return appTemplates.includes(templateName);
|
46914
46910
|
}
|
46915
|
-
const
|
46911
|
+
const appTemplate = {
|
46916
46912
|
dependencies: {
|
46917
|
-
"@sanity/sdk": "^0.0.0-
|
46918
|
-
"@sanity/sdk-react": "^0.0.0-
|
46913
|
+
"@sanity/sdk": "^0.0.0-rc",
|
46914
|
+
"@sanity/sdk-react": "^0.0.0-rc",
|
46919
46915
|
react: "^19",
|
46920
46916
|
"react-dom": "^19"
|
46921
46917
|
},
|
@@ -46937,7 +46933,7 @@ const blogTemplate = {}, cleanTemplate = {}, coreAppTemplate = {
|
|
46937
46933
|
build: "sanity build",
|
46938
46934
|
start: "sanity start"
|
46939
46935
|
}
|
46940
|
-
}, configTemplate$3 = `
|
46936
|
+
}, blogTemplate = {}, cleanTemplate = {}, configTemplate$3 = `
|
46941
46937
|
import {defineConfig, isDev} from 'sanity'
|
46942
46938
|
import {visionTool} from '@sanity/vision'
|
46943
46939
|
import {structureTool} from 'sanity/structure'
|
@@ -47115,7 +47111,7 @@ export default defineConfig({
|
|
47115
47111
|
}, templates = {
|
47116
47112
|
blog: blogTemplate,
|
47117
47113
|
clean: cleanTemplate,
|
47118
|
-
"
|
47114
|
+
"app-quickstart": appTemplate,
|
47119
47115
|
"get-started": getStartedTemplate,
|
47120
47116
|
moviedb: movieTemplate,
|
47121
47117
|
shopify: shopifyTemplate$1,
|
@@ -47136,7 +47132,7 @@ async function updateInitialTemplateMetadata(apiClient, projectId, templateName)
|
|
47136
47132
|
}
|
47137
47133
|
}
|
47138
47134
|
async function bootstrapLocalTemplate(opts, context) {
|
47139
|
-
const { apiClient, cliRoot, output } = context, templatesDir = path__default.default.join(cliRoot, "templates"), { outputPath, templateName, useTypeScript, packageName, variables } = opts, sourceDir = path__default.default.join(templatesDir, templateName), sharedDir = path__default.default.join(templatesDir, "shared"),
|
47135
|
+
const { apiClient, cliRoot, output } = context, templatesDir = path__default.default.join(cliRoot, "templates"), { outputPath, templateName, useTypeScript, packageName, variables } = opts, sourceDir = path__default.default.join(templatesDir, templateName), sharedDir = path__default.default.join(templatesDir, "shared"), isAppTemplate = determineAppTemplate(templateName), template = templates[templateName];
|
47140
47136
|
if (!template)
|
47141
47137
|
throw new Error(`Template "${templateName}" not defined`);
|
47142
47138
|
loadEnv.debug('Copying files from template "%s" to "%s"', templateName, outputPath);
|
@@ -47151,20 +47147,20 @@ async function bootstrapLocalTemplate(opts, context) {
|
|
47151
47147
|
schemaUrl: opts.schemaUrl
|
47152
47148
|
})), spinner.succeed(), spinner = output.spinner("Resolving latest module versions").start();
|
47153
47149
|
const dependencyVersions = await resolveLatestVersions({
|
47154
|
-
...
|
47155
|
-
...
|
47150
|
+
...isAppTemplate ? {} : studioDependencies.dependencies,
|
47151
|
+
...isAppTemplate ? {} : studioDependencies.devDependencies,
|
47156
47152
|
...template.dependencies || {},
|
47157
47153
|
...template.devDependencies || {}
|
47158
47154
|
});
|
47159
47155
|
spinner.succeed();
|
47160
47156
|
const dependencies = Object.keys({
|
47161
|
-
...
|
47157
|
+
...isAppTemplate ? {} : studioDependencies.dependencies,
|
47162
47158
|
...template.dependencies
|
47163
47159
|
}).reduce(
|
47164
47160
|
(deps, dependency) => (deps[dependency] = dependencyVersions[dependency], deps),
|
47165
47161
|
{}
|
47166
47162
|
), devDependencies = Object.keys({
|
47167
|
-
...
|
47163
|
+
...isAppTemplate ? {} : studioDependencies.devDependencies,
|
47168
47164
|
...template.devDependencies
|
47169
47165
|
}).reduce(
|
47170
47166
|
(deps, dependency) => (deps[dependency] = dependencyVersions[dependency], deps),
|
@@ -47179,7 +47175,7 @@ async function bootstrapLocalTemplate(opts, context) {
|
|
47179
47175
|
}), studioConfig = createStudioConfig({
|
47180
47176
|
template: template.configTemplate,
|
47181
47177
|
variables
|
47182
|
-
}), cliConfig =
|
47178
|
+
}), cliConfig = isAppTemplate ? createAppCliConfig({
|
47183
47179
|
appLocation: template.appLocation,
|
47184
47180
|
organizationId: variables.organizationId
|
47185
47181
|
}) : createCliConfig({
|
@@ -47189,7 +47185,7 @@ async function bootstrapLocalTemplate(opts, context) {
|
|
47189
47185
|
}), codeExt = useTypeScript ? "ts" : "js";
|
47190
47186
|
return await Promise.all(
|
47191
47187
|
[
|
47192
|
-
|
47188
|
+
isAppTemplate ? Promise.resolve(null) : writeFileIfNotExists(`sanity.config.${codeExt}`, studioConfig),
|
47193
47189
|
writeFileIfNotExists(`sanity.cli.${codeExt}`, cliConfig),
|
47194
47190
|
writeFileIfNotExists("package.json", packageManifest),
|
47195
47191
|
writeFileIfNotExists(
|
@@ -52814,9 +52810,9 @@ ${err.message}`);
|
|
52814
52810
|
loadEnv.debug(hasToken ? "User already has a token" : "User has no token");
|
52815
52811
|
let user;
|
52816
52812
|
hasToken ? (trace.log({ step: "login", alreadyLoggedIn: !0 }), user = await getUserData(apiClient), success("You are logged in as %s using %s", user.email, getProviderName(user.provider))) : unattended || (trace.log({ step: "login" }), user = await getOrCreateUser());
|
52817
|
-
const
|
52813
|
+
const isAppTemplate = cliFlags.template ? determineAppTemplate(cliFlags.template) : !1;
|
52818
52814
|
let introMessage = "Fetching existing projects";
|
52819
|
-
cliFlags.quickstart && (introMessage = "Eject your existing project's Sanity configuration"),
|
52815
|
+
cliFlags.quickstart && (introMessage = "Eject your existing project's Sanity configuration"), isAppTemplate || (success(introMessage), print(""));
|
52820
52816
|
const flags = await prepareFlags(), { projectId, displayName, isFirstProject, datasetName, schemaUrl, organizationId } = await getProjectDetails(), sluggedName = lodashExports.deburr(displayName.toLowerCase()).replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
|
52821
52817
|
if (bareOutput) {
|
52822
52818
|
success("Below are your project details"), print(""), print(`Project ID: ${chalk2.cyan(projectId)}`), print(`Dataset: ${chalk2.cyan(datasetName)}`), print(
|
@@ -53008,12 +53004,12 @@ ${chalk2.green("Success!")} Your Sanity configuration files has been added to th
|
|
53008
53004
|
outputPath === process.cwd() ? (print(`
|
53009
53005
|
${chalk2.green("Success!")} Now, use this command to continue:
|
53010
53006
|
`), print(
|
53011
|
-
`${chalk2.cyan(devCommand)} - to run ${
|
53007
|
+
`${chalk2.cyan(devCommand)} - to run ${isAppTemplate ? "your Sanity application" : "Sanity Studio"}
|
53012
53008
|
`
|
53013
53009
|
)) : (print(`
|
53014
53010
|
${chalk2.green("Success!")} Now, use these commands to continue:
|
53015
53011
|
`), print(`First: ${chalk2.cyan(`cd ${outputPath}`)} - to enter project\u2019s directory`), print(
|
53016
|
-
`Then: ${chalk2.cyan(devCommand)} -to run ${
|
53012
|
+
`Then: ${chalk2.cyan(devCommand)} -to run ${isAppTemplate ? "your Sanity application" : "Sanity Studio"}
|
53017
53013
|
`
|
53018
53014
|
)), 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");
|
53019
53015
|
const sendInvite = isFirstProject && await prompt2.single({
|
@@ -53040,7 +53036,7 @@ ${chalk2.green("Success!")} Now, use these commands to continue:
|
|
53040
53036
|
isFirstProject: data.isFirstProject
|
53041
53037
|
}), data;
|
53042
53038
|
}
|
53043
|
-
if (
|
53039
|
+
if (isAppTemplate) {
|
53044
53040
|
const organizations = await apiClient({ requireUser: !0, requireProject: !1 }).request({ uri: "/organizations" });
|
53045
53041
|
return {
|
53046
53042
|
projectId: "",
|