create-nextblock 0.2.2 → 0.2.3

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.
@@ -194,21 +194,41 @@ async function runSetupWizard(projectDir, projectName) {
194
194
  await execa('npx', ['supabase', 'login'], { stdio: 'inherit', cwd: projectPath });
195
195
 
196
196
  clack.note('Now, please select your NextBlock project in the browser.');
197
- await execa('npx', ['supabase', 'link'], { stdio: 'inherit', cwd: projectPath });
197
+ let linkOutput = '';
198
+ const linkProcess = execa('npx', ['supabase', 'link'], {
199
+ cwd: projectPath,
200
+ stdin: 'inherit',
201
+ stdout: 'pipe',
202
+ stderr: 'inherit',
203
+ });
204
+ if (linkProcess.stdout) {
205
+ linkProcess.stdout.on('data', (chunk) => {
206
+ const text = chunk.toString();
207
+ linkOutput += text;
208
+ process.stdout.write(text);
209
+ });
210
+ }
211
+ await linkProcess;
198
212
 
199
213
  const configTomlPath = resolve(projectPath, 'supabase', 'config.toml');
200
214
  let configToml = '';
201
215
  if (!(await fs.pathExists(configTomlPath))) {
202
- const manualProjectId = await clack.text({
203
- message:
204
- 'supabase/config.toml was not created. Enter your Supabase project ref (from the link output, e.g., abcdefghijklmnopqrstu):',
205
- validate: (val) => (!val ? 'Project ref is required' : undefined),
206
- });
207
- if (clack.isCancel(manualProjectId)) {
208
- handleWizardCancel('Setup cancelled.');
216
+ const parsedRef = linkOutput.match(/Selected project:\s*([a-z0-9-]+)/i)?.[1];
217
+ let projectRef = parsedRef;
218
+
219
+ if (!projectRef) {
220
+ const manualProjectId = await clack.text({
221
+ message:
222
+ 'supabase/config.toml was not created. Enter your Supabase project ref (from the link output, e.g., abcdefghijklmnopqrstu):',
223
+ validate: (val) => (!val ? 'Project ref is required' : undefined),
224
+ });
225
+ if (clack.isCancel(manualProjectId)) {
226
+ handleWizardCancel('Setup cancelled.');
227
+ }
228
+ projectRef = manualProjectId.trim();
209
229
  }
210
- const trimmed = manualProjectId.trim();
211
- configToml = `project_id = "${trimmed}"\n`;
230
+
231
+ configToml = `project_id = "${projectRef}"\n`;
212
232
  await fs.writeFile(configTomlPath, configToml);
213
233
  clack.note('Created supabase/config.toml from the provided project ref.');
214
234
  } else {
@@ -287,7 +307,7 @@ async function runSetupWizard(projectDir, projectName) {
287
307
 
288
308
  if (canWriteEnv) {
289
309
  await fs.writeFile(envPath, envLines.join('\n'));
290
- clack.success('Supabase configuration saved to .env');
310
+ clack.note('Supabase configuration saved to .env');
291
311
  }
292
312
 
293
313
  clack.note('Setting up your database...');
@@ -357,7 +377,7 @@ async function runSetupWizard(projectDir, projectName) {
357
377
 
358
378
  if (canWriteEnv) {
359
379
  await fs.appendFile(envPath, r2Env);
360
- clack.success('Cloudflare R2 configuration saved!');
380
+ clack.note('Cloudflare R2 configuration saved!');
361
381
  } else {
362
382
  clack.note('Add the following R2 values to your existing .env:\n' + r2Env);
363
383
  }
@@ -419,7 +439,7 @@ async function runSetupWizard(projectDir, projectName) {
419
439
 
420
440
  if (canWriteEnv) {
421
441
  await fs.appendFile(envPath, smtpEnv);
422
- clack.success('SMTP configuration saved!');
442
+ clack.note('SMTP configuration saved!');
423
443
  } else {
424
444
  clack.note('Add the following SMTP values to your existing .env:\n' + smtpEnv);
425
445
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nextblock",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {