create-nextblock 0.2.16 → 0.2.17

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.
@@ -190,14 +190,35 @@ async function runSetupWizard(projectDir, projectName) {
190
190
  await execa('npx', ['supabase', 'login'], { stdio: 'inherit', cwd: projectPath });
191
191
 
192
192
  clack.note('Now, please select your NextBlock project when prompted.');
193
- await execa('npx', ['supabase', 'link'], { cwd: projectPath, stdio: 'inherit' });
193
+ let linkOutput = '';
194
+ const linkProcess = execa('npx', ['supabase', 'link'], {
195
+ cwd: projectPath,
196
+ stdin: 'inherit',
197
+ stdout: 'pipe',
198
+ stderr: 'pipe',
199
+ });
200
+ if (linkProcess.stdout) {
201
+ linkProcess.stdout.on('data', (chunk) => {
202
+ const text = chunk.toString();
203
+ linkOutput += text;
204
+ process.stdout.write(text);
205
+ });
206
+ }
207
+ if (linkProcess.stderr) {
208
+ linkProcess.stderr.on('data', (chunk) => {
209
+ const text = chunk.toString();
210
+ linkOutput += text;
211
+ process.stderr.write(text);
212
+ });
213
+ }
214
+ await linkProcess;
194
215
 
195
216
  // Ensure supabase assets exist (config + migrations) after link in case the CLI created/overrode files
196
217
  await ensureSupabaseAssets(projectPath);
197
218
 
198
219
  const configTomlPath = resolve(projectPath, 'supabase', 'config.toml');
199
- let projectId = null;
200
- if (await fs.pathExists(configTomlPath)) {
220
+ let projectId = linkOutput.match(/Selected project:\s*([a-z0-9-]+)/i)?.[1] || null;
221
+ if (!projectId && (await fs.pathExists(configTomlPath))) {
201
222
  const configToml = await fs.readFile(configTomlPath, 'utf8');
202
223
  const projectMatch = configToml.match(/project_id\s*=\s*"([^"]+)"/);
203
224
  if (projectMatch?.[1] && !projectMatch[1].includes('env(')) {
@@ -205,18 +226,6 @@ async function runSetupWizard(projectDir, projectName) {
205
226
  }
206
227
  }
207
228
 
208
- if (!projectId) {
209
- const manual = await clack.text({
210
- message:
211
- 'Enter your Supabase project ref (from the Supabase dashboard URL or the link output, e.g., abcdefghijklmnopqrstu):',
212
- validate: (val) => (!val ? 'Project ref is required' : undefined),
213
- });
214
- if (clack.isCancel(manual)) {
215
- handleWizardCancel('Setup cancelled.');
216
- }
217
- projectId = manual.trim();
218
- }
219
-
220
229
  const configContent = `project_id = "env(SUPABASE_PROJECT_ID)"\n`;
221
230
  await fs.writeFile(configTomlPath, configContent);
222
231
  clack.note('Created supabase/config.toml with project_id env binding.');
@@ -676,6 +685,9 @@ async function ensureSupabaseAssets(projectDir) {
676
685
  const templateSupabaseDir = resolve(TEMPLATE_DIR, 'supabase');
677
686
 
678
687
  const sources = [packageSupabaseDir, templateSupabaseDir].filter(Boolean);
688
+ if (sources.length === 0) {
689
+ clack.note('Warning: No supabase assets found in installed packages or template.');
690
+ }
679
691
  for (const sourceSupabaseDir of sources) {
680
692
  const sourceConfig = resolve(sourceSupabaseDir, 'config.toml');
681
693
  const destConfig = resolve(destSupabaseDir, 'config.toml');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nextblock",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {