create-nextblock 0.2.15 → 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.
@@ -218,17 +218,12 @@ async function runSetupWizard(projectDir, projectName) {
218
218
 
219
219
  const configTomlPath = resolve(projectPath, 'supabase', 'config.toml');
220
220
  let projectId = linkOutput.match(/Selected project:\s*([a-z0-9-]+)/i)?.[1] || null;
221
-
222
- if (!projectId) {
223
- const manual = await clack.text({
224
- message:
225
- 'Enter your Supabase project ref (from the Supabase dashboard URL or the link output, e.g., abcdefghijklmnopqrstu):',
226
- validate: (val) => (!val ? 'Project ref is required' : undefined),
227
- });
228
- if (clack.isCancel(manual)) {
229
- handleWizardCancel('Setup cancelled.');
221
+ if (!projectId && (await fs.pathExists(configTomlPath))) {
222
+ const configToml = await fs.readFile(configTomlPath, 'utf8');
223
+ const projectMatch = configToml.match(/project_id\s*=\s*"([^"]+)"/);
224
+ if (projectMatch?.[1] && !projectMatch[1].includes('env(')) {
225
+ projectId = projectMatch[1];
230
226
  }
231
- projectId = manual.trim();
232
227
  }
233
228
 
234
229
  const configContent = `project_id = "env(SUPABASE_PROJECT_ID)"\n`;
@@ -311,11 +306,18 @@ async function runSetupWizard(projectDir, projectName) {
311
306
  try {
312
307
  process.env.POSTGRES_URL = postgresUrl;
313
308
  const migrationsDir = resolve(projectPath, 'supabase', 'migrations');
314
- const hasMigrations =
309
+ const hasMigrations = async () =>
315
310
  (await fs.pathExists(migrationsDir)) &&
316
311
  (await fs.readdir(migrationsDir)).some((name) => name.endsWith('.sql'));
317
- if (!hasMigrations) {
318
- dbPushSpinner.stop('No migrations found in supabase/migrations; skipping db push.');
312
+
313
+ if (!(await hasMigrations())) {
314
+ await ensureSupabaseAssets(projectPath);
315
+ }
316
+
317
+ if (!(await hasMigrations())) {
318
+ dbPushSpinner.stop(
319
+ `No migrations found in ${migrationsDir}; skipping db push. Ensure @nextblock-cms/db includes supabase/migrations.`,
320
+ );
319
321
  } else {
320
322
  await execa('npx', ['supabase', 'db', 'push'], { stdio: 'inherit', cwd: projectPath });
321
323
  dbPushSpinner.stop('Database schema pushed successfully!');
@@ -683,6 +685,9 @@ async function ensureSupabaseAssets(projectDir) {
683
685
  const templateSupabaseDir = resolve(TEMPLATE_DIR, 'supabase');
684
686
 
685
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
+ }
686
691
  for (const sourceSupabaseDir of sources) {
687
692
  const sourceConfig = resolve(sourceSupabaseDir, 'config.toml');
688
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.15",
3
+ "version": "0.2.17",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {