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 (Next.js). 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 (Next.js)',
336
+
value: false,
337
+
description: 'Use standard next dev / build / start',
338
+
},
339
+
{
340
+
name: 'Commerce-hosted',
341
+
value: true,
342
+
description: 'Use catalyst dev / build / deploy',
343
+
},
344
+
],
345
+
});
346
+
}
347
+
348
+
returnfalse;
349
+
}
350
+
351
+
asyncfunctionresolveHostingMode({
352
+
hostingFlag,
353
+
storeHash,
354
+
accessToken,
355
+
cliApiOrigin,
356
+
apiHostname,
357
+
defaultProjectName,
358
+
autoUseProjectName,
359
+
useExistingOnCollision,
360
+
}: {
361
+
hostingFlag?: HostingMode;
362
+
storeHash?: string;
363
+
accessToken?: string;
364
+
cliApiOrigin: string;
365
+
apiHostname: string;
366
+
defaultProjectName?: string;
367
+
autoUseProjectName?: boolean;
368
+
useExistingOnCollision?: boolean;
369
+
}): Promise<HostingResolution>{
370
+
if(hostingFlag==='self-hosted'){
371
+
return{mode: 'self-hosted'};
372
+
}
373
+
374
+
if(!storeHash||!accessToken){
375
+
if(hostingFlag==='commerce'){
376
+
console.error(
377
+
colorize(
378
+
'red',
379
+
'\n--hosting commerce requires store credentials (store hash and access token)\n',
@@ -316,6 +457,16 @@ export const create = new Command('create')
316
457
.option('--reset-main','Reset the main branch to the gh-ref')
317
458
.option('--repository <repository>','GitHub repository to clone from','bigcommerce/catalyst')
318
459
.option('--env <vars...>','Arbitrary environment variables to set in .env.local')
460
+
.addOption(
461
+
newOption(
462
+
'--hosting <mode>',
463
+
'Hosting mode: "self-hosted" or "commerce" for Commerce Hosting.',
464
+
).choices(['self-hosted','commerce']asconst),
465
+
)
466
+
.option(
467
+
'--use-existing',
468
+
'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