create-nextblock 0.2.14 → 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,10 +190,7 @@ 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'], {
194
- cwd: projectPath,
195
- stdio: 'inherit',
196
- });
193
+ await execa('npx', ['supabase', 'link'], { cwd: projectPath, stdio: 'inherit' });
197
194
 
198
195
  // Ensure supabase assets exist (config + migrations) after link in case the CLI created/overrode files
199
196
  await ensureSupabaseAssets(projectPath);
@@ -211,18 +208,19 @@ async function runSetupWizard(projectDir, projectName) {
211
208
  if (!projectId) {
212
209
  const manual = await clack.text({
213
210
  message:
214
- 'Enter your Supabase project ref (found in the Supabase dashboard URL or the link output, e.g., abcdefghijklmnopqrstu):',
211
+ 'Enter your Supabase project ref (from the Supabase dashboard URL or the link output, e.g., abcdefghijklmnopqrstu):',
215
212
  validate: (val) => (!val ? 'Project ref is required' : undefined),
216
213
  });
217
214
  if (clack.isCancel(manual)) {
218
215
  handleWizardCancel('Setup cancelled.');
219
216
  }
220
217
  projectId = manual.trim();
221
- const configContent = `project_id = "env(SUPABASE_PROJECT_ID)"\n`;
222
- await fs.writeFile(configTomlPath, configContent);
223
- clack.note('Created supabase/config.toml with project_id env binding.');
224
218
  }
225
219
 
220
+ const configContent = `project_id = "env(SUPABASE_PROJECT_ID)"\n`;
221
+ await fs.writeFile(configTomlPath, configContent);
222
+ clack.note('Created supabase/config.toml with project_id env binding.');
223
+
226
224
  clack.note('Please go to your Supabase project dashboard to get the following secrets.');
227
225
  const supabaseKeys = await clack.group(
228
226
  {
@@ -299,11 +297,18 @@ async function runSetupWizard(projectDir, projectName) {
299
297
  try {
300
298
  process.env.POSTGRES_URL = postgresUrl;
301
299
  const migrationsDir = resolve(projectPath, 'supabase', 'migrations');
302
- const hasMigrations =
300
+ const hasMigrations = async () =>
303
301
  (await fs.pathExists(migrationsDir)) &&
304
302
  (await fs.readdir(migrationsDir)).some((name) => name.endsWith('.sql'));
305
- if (!hasMigrations) {
306
- 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
+ );
307
312
  } else {
308
313
  await execa('npx', ['supabase', 'db', 'push'], { stdio: 'inherit', cwd: projectPath });
309
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.14",
3
+ "version": "0.2.16",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {