create-nextblock 0.2.1 → 0.2.2
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.
- package/bin/create-nextblock.js +19 -2
- package/package.json +1 -1
package/bin/create-nextblock.js
CHANGED
|
@@ -185,6 +185,10 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
185
185
|
|
|
186
186
|
clack.intro('🚀 Welcome to the NextBlock setup wizard!');
|
|
187
187
|
|
|
188
|
+
// Ensure Supabase directory exists so the CLI can place config.toml
|
|
189
|
+
const supabaseDir = resolve(projectPath, 'supabase');
|
|
190
|
+
await fs.ensureDir(supabaseDir);
|
|
191
|
+
|
|
188
192
|
clack.note('Connecting to Supabase...');
|
|
189
193
|
clack.note('I will now open your browser to log into Supabase.');
|
|
190
194
|
await execa('npx', ['supabase', 'login'], { stdio: 'inherit', cwd: projectPath });
|
|
@@ -193,10 +197,23 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
193
197
|
await execa('npx', ['supabase', 'link'], { stdio: 'inherit', cwd: projectPath });
|
|
194
198
|
|
|
195
199
|
const configTomlPath = resolve(projectPath, 'supabase', 'config.toml');
|
|
200
|
+
let configToml = '';
|
|
196
201
|
if (!(await fs.pathExists(configTomlPath))) {
|
|
197
|
-
|
|
202
|
+
const manualProjectId = await clack.text({
|
|
203
|
+
message:
|
|
204
|
+
'supabase/config.toml was not created. Enter your Supabase project ref (from the link output, e.g., abcdefghijklmnopqrstu):',
|
|
205
|
+
validate: (val) => (!val ? 'Project ref is required' : undefined),
|
|
206
|
+
});
|
|
207
|
+
if (clack.isCancel(manualProjectId)) {
|
|
208
|
+
handleWizardCancel('Setup cancelled.');
|
|
209
|
+
}
|
|
210
|
+
const trimmed = manualProjectId.trim();
|
|
211
|
+
configToml = `project_id = "${trimmed}"\n`;
|
|
212
|
+
await fs.writeFile(configTomlPath, configToml);
|
|
213
|
+
clack.note('Created supabase/config.toml from the provided project ref.');
|
|
214
|
+
} else {
|
|
215
|
+
configToml = await fs.readFile(configTomlPath, 'utf8');
|
|
198
216
|
}
|
|
199
|
-
const configToml = await fs.readFile(configTomlPath, 'utf8');
|
|
200
217
|
const projectIdMatch = configToml.match(/project_id\s*=\s*"([^"]+)"/);
|
|
201
218
|
if (!projectIdMatch?.[1]) {
|
|
202
219
|
throw new Error('Could not parse project_id from supabase/config.toml. Please ensure Supabase is linked.');
|