create-nextblock 0.2.14 → 0.2.15
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 +26 -14
- package/package.json +1 -1
package/bin/create-nextblock.js
CHANGED
|
@@ -190,39 +190,51 @@ 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
|
-
|
|
193
|
+
let linkOutput = '';
|
|
194
|
+
const linkProcess = execa('npx', ['supabase', 'link'], {
|
|
194
195
|
cwd: projectPath,
|
|
195
|
-
|
|
196
|
+
stdin: 'inherit',
|
|
197
|
+
stdout: 'pipe',
|
|
198
|
+
stderr: 'pipe',
|
|
196
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;
|
|
197
215
|
|
|
198
216
|
// Ensure supabase assets exist (config + migrations) after link in case the CLI created/overrode files
|
|
199
217
|
await ensureSupabaseAssets(projectPath);
|
|
200
218
|
|
|
201
219
|
const configTomlPath = resolve(projectPath, 'supabase', 'config.toml');
|
|
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
|
-
}
|
|
220
|
+
let projectId = linkOutput.match(/Selected project:\s*([a-z0-9-]+)/i)?.[1] || null;
|
|
210
221
|
|
|
211
222
|
if (!projectId) {
|
|
212
223
|
const manual = await clack.text({
|
|
213
224
|
message:
|
|
214
|
-
'Enter your Supabase project ref (
|
|
225
|
+
'Enter your Supabase project ref (from the Supabase dashboard URL or the link output, e.g., abcdefghijklmnopqrstu):',
|
|
215
226
|
validate: (val) => (!val ? 'Project ref is required' : undefined),
|
|
216
227
|
});
|
|
217
228
|
if (clack.isCancel(manual)) {
|
|
218
229
|
handleWizardCancel('Setup cancelled.');
|
|
219
230
|
}
|
|
220
231
|
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
232
|
}
|
|
225
233
|
|
|
234
|
+
const configContent = `project_id = "env(SUPABASE_PROJECT_ID)"\n`;
|
|
235
|
+
await fs.writeFile(configTomlPath, configContent);
|
|
236
|
+
clack.note('Created supabase/config.toml with project_id env binding.');
|
|
237
|
+
|
|
226
238
|
clack.note('Please go to your Supabase project dashboard to get the following secrets.');
|
|
227
239
|
const supabaseKeys = await clack.group(
|
|
228
240
|
{
|