create-nextblock 0.2.15 → 0.2.16

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,34 +190,20 @@ 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
- 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;
193
+ await execa('npx', ['supabase', 'link'], { cwd: projectPath, stdio: 'inherit' });
215
194
 
216
195
  // Ensure supabase assets exist (config + migrations) after link in case the CLI created/overrode files
217
196
  await ensureSupabaseAssets(projectPath);
218
197
 
219
198
  const configTomlPath = resolve(projectPath, 'supabase', 'config.toml');
220
- let projectId = linkOutput.match(/Selected project:\s*([a-z0-9-]+)/i)?.[1] || null;
199
+ let projectId = null;
200
+ if (await fs.pathExists(configTomlPath)) {
201
+ const configToml = await fs.readFile(configTomlPath, 'utf8');
202
+ const projectMatch = configToml.match(/project_id\s*=\s*"([^"]+)"/);
203
+ if (projectMatch?.[1] && !projectMatch[1].includes('env(')) {
204
+ projectId = projectMatch[1];
205
+ }
206
+ }
221
207
 
222
208
  if (!projectId) {
223
209
  const manual = await clack.text({
@@ -311,11 +297,18 @@ async function runSetupWizard(projectDir, projectName) {
311
297
  try {
312
298
  process.env.POSTGRES_URL = postgresUrl;
313
299
  const migrationsDir = resolve(projectPath, 'supabase', 'migrations');
314
- const hasMigrations =
300
+ const hasMigrations = async () =>
315
301
  (await fs.pathExists(migrationsDir)) &&
316
302
  (await fs.readdir(migrationsDir)).some((name) => name.endsWith('.sql'));
317
- if (!hasMigrations) {
318
- dbPushSpinner.stop('No migrations found in supabase/migrations; skipping db push.');
303
+
304
+ if (!(await hasMigrations())) {
305
+ await ensureSupabaseAssets(projectPath);
306
+ }
307
+
308
+ if (!(await hasMigrations())) {
309
+ dbPushSpinner.stop(
310
+ `No migrations found in ${migrationsDir}; skipping db push. Ensure @nextblock-cms/db includes supabase/migrations.`,
311
+ );
319
312
  } else {
320
313
  await execa('npx', ['supabase', 'db', 'push'], { stdio: 'inherit', cwd: projectPath });
321
314
  dbPushSpinner.stop('Database schema pushed successfully!');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nextblock",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {