You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`\nFailed to verify Infrastructure Projects API access: ${message}\nPlease try again.\n`,
308
+
),
309
+
);
310
+
process.exit(1);
311
+
}
312
+
313
+
console.warn(
314
+
colorize(
315
+
'yellow',
316
+
`\nCould not verify Infrastructure Projects API access: ${message}\nDefaulting to self-hosted. Re-run create-catalyst if you intended to use Commerce-hosted.\n`,
317
+
),
318
+
);
319
+
320
+
returnnull;
321
+
}
322
+
}
323
+
324
+
asyncfunctionshouldUseCommerceHosting(
325
+
hostingFlag: HostingMode|undefined,
326
+
hasAccess: boolean,
327
+
): Promise<boolean>{
328
+
if(hostingFlag==='commerce')returntrue;
329
+
330
+
if(hostingFlag===undefined&&hasAccess){
331
+
returnselect({
332
+
message: 'How would you like to host your Catalyst storefront?',
333
+
choices: [
334
+
{
335
+
name: 'Self-hosted',
336
+
value: false,
337
+
description:
338
+
'Use standard next dev / build / start. You will host the app yourself and deploy it to a provider of your choice.',
339
+
},
340
+
{
341
+
name: 'Commerce-hosted',
342
+
value: true,
343
+
description:
344
+
'Use catalyst dev / build / deploy. Commerce will host the app and handle deployment for you.',
345
+
},
346
+
],
347
+
});
348
+
}
349
+
350
+
returnfalse;
351
+
}
352
+
353
+
asyncfunctionresolveHostingMode({
354
+
hostingFlag,
355
+
storeHash,
356
+
accessToken,
357
+
cliApiOrigin,
358
+
apiHostname,
359
+
defaultProjectName,
360
+
autoUseProjectName,
361
+
useExistingOnCollision,
362
+
}: {
363
+
hostingFlag?: HostingMode;
364
+
storeHash?: string;
365
+
accessToken?: string;
366
+
cliApiOrigin: string;
367
+
apiHostname: string;
368
+
defaultProjectName: string;
369
+
autoUseProjectName?: boolean;
370
+
useExistingOnCollision?: boolean;
371
+
}): Promise<HostingResolution>{
372
+
if(hostingFlag==='self-hosted'){
373
+
return{mode: 'self-hosted'};
374
+
}
375
+
376
+
if(!storeHash||!accessToken){
377
+
if(hostingFlag==='commerce'){
378
+
console.error(
379
+
colorize(
380
+
'red',
381
+
'\n--hosting commerce requires store credentials (store hash and access token)\n',
@@ -316,6 +459,16 @@ export const create = new Command('create')
316
459
.option('--reset-main','Reset the main branch to the gh-ref')
317
460
.option('--repository <repository>','GitHub repository to clone from','bigcommerce/catalyst')
318
461
.option('--env <vars...>','Arbitrary environment variables to set in .env.local')
462
+
.addOption(
463
+
newOption(
464
+
'--hosting <mode>',
465
+
'Hosting mode: "self-hosted" or "commerce" for Commerce Hosting.',
466
+
).choices(['self-hosted','commerce']asconst),
467
+
)
468
+
.option(
469
+
'--use-existing',
470
+
'Only used with --hosting commerce and --project-name. When the named project already exists on the store, reuse it instead of prompting. Has no effect without --hosting commerce.',
0 commit comments