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