create-nextblock 0.2.13 → 0.2.14

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.
@@ -199,20 +199,28 @@ async function runSetupWizard(projectDir, projectName) {
199
199
  await ensureSupabaseAssets(projectPath);
200
200
 
201
201
  const configTomlPath = resolve(projectPath, 'supabase', 'config.toml');
202
- if (!(await fs.pathExists(configTomlPath))) {
203
- throw new Error('supabase/config.toml not found. Please rerun `npx supabase link`.');
204
- }
205
- const configToml = await fs.readFile(configTomlPath, 'utf8');
206
- const projectMatch = configToml.match(/project_id\s*=\s*"([^"]+)"/);
207
- if (!projectMatch?.[1] || projectMatch[1].includes('env(')) {
208
- throw new Error('Could not read a concrete project_id from supabase/config.toml. Please rerun `npx supabase link`.');
202
+ let projectId = null;
203
+ if (await fs.pathExists(configTomlPath)) {
204
+ const configToml = await fs.readFile(configTomlPath, 'utf8');
205
+ const projectMatch = configToml.match(/project_id\s*=\s*"([^"]+)"/);
206
+ if (projectMatch?.[1] && !projectMatch[1].includes('env(')) {
207
+ projectId = projectMatch[1];
208
+ }
209
209
  }
210
- const projectId = projectMatch[1];
211
210
 
212
- if (!(await fs.pathExists(configTomlPath))) {
213
- const configToml = `project_id = "env(SUPABASE_PROJECT_ID)"\n`;
214
- await fs.writeFile(configTomlPath, configToml);
215
- clack.note(`Created supabase/config.toml with project_id env binding for ${projectId}.`);
211
+ if (!projectId) {
212
+ const manual = await clack.text({
213
+ message:
214
+ 'Enter your Supabase project ref (found in the Supabase dashboard URL or the link output, e.g., abcdefghijklmnopqrstu):',
215
+ validate: (val) => (!val ? 'Project ref is required' : undefined),
216
+ });
217
+ if (clack.isCancel(manual)) {
218
+ handleWizardCancel('Setup cancelled.');
219
+ }
220
+ 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.');
216
224
  }
217
225
 
218
226
  clack.note('Please go to your Supabase project dashboard to get the following secrets.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nextblock",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {