create-nextblock 0.2.25 → 0.2.26
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/bin/create-nextblock.js +66 -52
- package/package.json +1 -1
package/bin/create-nextblock.js
CHANGED
|
@@ -177,15 +177,19 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
177
177
|
const projectPath = resolve(projectDir);
|
|
178
178
|
process.chdir(projectPath);
|
|
179
179
|
|
|
180
|
-
clack.intro('🚀 Welcome to the NextBlock setup wizard!');
|
|
181
|
-
|
|
182
|
-
const supabaseDir = resolve(projectPath, 'supabase');
|
|
183
|
-
await fs.ensureDir(supabaseDir);
|
|
184
|
-
await resetSupabaseProjectRef(projectPath);
|
|
185
|
-
|
|
186
|
-
clack.note(
|
|
187
|
-
|
|
188
|
-
|
|
180
|
+
clack.intro('🚀 Welcome to the NextBlock setup wizard!');
|
|
181
|
+
|
|
182
|
+
const supabaseDir = resolve(projectPath, 'supabase');
|
|
183
|
+
await fs.ensureDir(supabaseDir);
|
|
184
|
+
await resetSupabaseProjectRef(projectPath);
|
|
185
|
+
|
|
186
|
+
clack.note(
|
|
187
|
+
'Supabase Prerequisites:\n\nBefore proceeding, ensure you have a Supabase project ready.\n\nSupabase Cloud: Create a project at https://supabase.com/dashboard\n\nVercel Storage: If created via Vercel > Storage > Create Database, check your .env.local snippet on Vercel for the required keys.',
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
clack.note('Connecting to Supabase...');
|
|
191
|
+
clack.note('I will now open your browser to log into Supabase.');
|
|
192
|
+
await runSupabaseCli(['login'], { cwd: projectPath });
|
|
189
193
|
|
|
190
194
|
clack.note('Now, please select your NextBlock project when prompted.');
|
|
191
195
|
await runSupabaseCli(['link'], { cwd: projectPath });
|
|
@@ -226,24 +230,27 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
226
230
|
const siteUrl = siteUrlPrompt.trim();
|
|
227
231
|
|
|
228
232
|
clack.note('Please go to your Supabase project dashboard to get the following secrets.');
|
|
229
|
-
const supabaseKeys = await clack.group(
|
|
230
|
-
{
|
|
231
|
-
dbPassword: () =>
|
|
232
|
-
clack.password({
|
|
233
|
-
message:
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
233
|
+
const supabaseKeys = await clack.group(
|
|
234
|
+
{
|
|
235
|
+
dbPassword: () =>
|
|
236
|
+
clack.password({
|
|
237
|
+
message:
|
|
238
|
+
'What is your Database Password? (Supabase: Database > Database Settings > Reset database password | Vercel: POSTGRES_PASSWORD)',
|
|
239
|
+
validate: (val) => (!val ? 'Password is required' : undefined),
|
|
240
|
+
}),
|
|
241
|
+
anonKey: () =>
|
|
242
|
+
clack.password({
|
|
243
|
+
message:
|
|
244
|
+
'What is your Project API Key (anon key)? (Supabase: Project Settings > API Keys > Project Legacy API Keys | Vercel: SUPABASE_ANON_KEY)',
|
|
245
|
+
validate: (val) => (!val ? 'Anon Key is required' : undefined),
|
|
246
|
+
}),
|
|
247
|
+
serviceKey: () =>
|
|
248
|
+
clack.password({
|
|
249
|
+
message:
|
|
250
|
+
'What is your Service Role Key (service_role key)? (Supabase: Project Settings > API Keys > Project Legacy API Keys | Vercel: SUPABASE_SERVICE_ROLE_KEY)',
|
|
251
|
+
validate: (val) => (!val ? 'Service Role Key is required' : undefined),
|
|
252
|
+
}),
|
|
253
|
+
},
|
|
247
254
|
{ onCancel: () => handleWizardCancel('Setup cancelled.') },
|
|
248
255
|
);
|
|
249
256
|
|
|
@@ -331,12 +338,15 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
331
338
|
}
|
|
332
339
|
}
|
|
333
340
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
341
|
+
clack.note(
|
|
342
|
+
'Optional Cloudflare R2 Setup:\nHave your Account ID, API token (Access + Secret), bucket name, and public bucket URL handy if you want media storage ready now.',
|
|
343
|
+
);
|
|
344
|
+
const setupR2 = await clack.confirm({
|
|
345
|
+
message: 'Do you want to set up Cloudflare R2 for media storage now? (Optional > populate .env keys)',
|
|
346
|
+
});
|
|
347
|
+
if (clack.isCancel(setupR2)) {
|
|
348
|
+
handleWizardCancel('Setup cancelled.');
|
|
349
|
+
}
|
|
340
350
|
|
|
341
351
|
let r2Values = {
|
|
342
352
|
publicBaseUrl: '',
|
|
@@ -350,33 +360,34 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
350
360
|
clack.note('I will open your browser to the R2 dashboard.\nYou need to create a bucket and an R2 API Token.');
|
|
351
361
|
await open('https://dash.cloudflare.com/?to=/:account/r2', { wait: false });
|
|
352
362
|
|
|
353
|
-
const r2Keys = await clack.group(
|
|
354
|
-
{
|
|
355
|
-
accountId: () =>
|
|
356
|
-
clack.text({
|
|
357
|
-
message: 'R2: Paste your Cloudflare Account ID:',
|
|
358
|
-
validate: (val) => (!val ? 'Account ID is required' : undefined),
|
|
359
|
-
}),
|
|
360
|
-
bucketName: () =>
|
|
363
|
+
const r2Keys = await clack.group(
|
|
364
|
+
{
|
|
365
|
+
accountId: () =>
|
|
366
|
+
clack.text({
|
|
367
|
+
message: 'R2: Paste your Cloudflare Account ID (Overview > Account Details - Bottom right):',
|
|
368
|
+
validate: (val) => (!val ? 'Account ID is required' : undefined),
|
|
369
|
+
}),
|
|
370
|
+
bucketName: () =>
|
|
361
371
|
clack.text({
|
|
362
372
|
message: 'R2: Paste your Bucket Name:',
|
|
363
373
|
validate: (val) => (!val ? 'Bucket name is required' : undefined),
|
|
364
374
|
}),
|
|
365
|
-
accessKey: () =>
|
|
366
|
-
clack.password({
|
|
367
|
-
message: 'R2: Paste your Access Key ID:',
|
|
368
|
-
validate: (val) => (!val ? 'Access Key ID is required' : undefined),
|
|
369
|
-
}),
|
|
375
|
+
accessKey: () =>
|
|
376
|
+
clack.password({
|
|
377
|
+
message: 'R2: Paste your Access Key ID (create API tokens):',
|
|
378
|
+
validate: (val) => (!val ? 'Access Key ID is required' : undefined),
|
|
379
|
+
}),
|
|
370
380
|
secretKey: () =>
|
|
371
381
|
clack.password({
|
|
372
382
|
message: 'R2: Paste your Secret Access Key:',
|
|
373
383
|
validate: (val) => (!val ? 'Secret Access Key is required' : undefined),
|
|
374
384
|
}),
|
|
375
|
-
publicBaseUrl: () =>
|
|
376
|
-
clack.text({
|
|
377
|
-
message:
|
|
378
|
-
|
|
379
|
-
|
|
385
|
+
publicBaseUrl: () =>
|
|
386
|
+
clack.text({
|
|
387
|
+
message:
|
|
388
|
+
'R2: Public Base URL (Bucket > Settings > Public Development URL-Enable: e.g., https://pub-xxx.r2.dev)',
|
|
389
|
+
validate: (val) => (!val ? 'Public base URL is required' : undefined),
|
|
390
|
+
}),
|
|
380
391
|
},
|
|
381
392
|
{ onCancel: () => handleWizardCancel('Setup cancelled.') },
|
|
382
393
|
);
|
|
@@ -406,7 +417,10 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
406
417
|
clack.note('Cloudflare R2 placeholders added to .env. Configure them later when ready.');
|
|
407
418
|
}
|
|
408
419
|
|
|
409
|
-
|
|
420
|
+
clack.note(
|
|
421
|
+
'Optional SMTP Setup:\nProvide the host, port, credentials, and from details for your email provider (e.g., Resend, Postmark) to send transactional emails immediately.',
|
|
422
|
+
);
|
|
423
|
+
const setupSMTP = await clack.confirm({
|
|
410
424
|
message: 'Do you want to set up an SMTP server for emails now? (Optional)',
|
|
411
425
|
});
|
|
412
426
|
if (clack.isCancel(setupSMTP)) {
|