create-nextblock 0.2.2 → 0.2.3
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 +33 -13
- package/package.json +1 -1
package/bin/create-nextblock.js
CHANGED
|
@@ -194,21 +194,41 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
194
194
|
await execa('npx', ['supabase', 'login'], { stdio: 'inherit', cwd: projectPath });
|
|
195
195
|
|
|
196
196
|
clack.note('Now, please select your NextBlock project in the browser.');
|
|
197
|
-
|
|
197
|
+
let linkOutput = '';
|
|
198
|
+
const linkProcess = execa('npx', ['supabase', 'link'], {
|
|
199
|
+
cwd: projectPath,
|
|
200
|
+
stdin: 'inherit',
|
|
201
|
+
stdout: 'pipe',
|
|
202
|
+
stderr: 'inherit',
|
|
203
|
+
});
|
|
204
|
+
if (linkProcess.stdout) {
|
|
205
|
+
linkProcess.stdout.on('data', (chunk) => {
|
|
206
|
+
const text = chunk.toString();
|
|
207
|
+
linkOutput += text;
|
|
208
|
+
process.stdout.write(text);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
await linkProcess;
|
|
198
212
|
|
|
199
213
|
const configTomlPath = resolve(projectPath, 'supabase', 'config.toml');
|
|
200
214
|
let configToml = '';
|
|
201
215
|
if (!(await fs.pathExists(configTomlPath))) {
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
216
|
+
const parsedRef = linkOutput.match(/Selected project:\s*([a-z0-9-]+)/i)?.[1];
|
|
217
|
+
let projectRef = parsedRef;
|
|
218
|
+
|
|
219
|
+
if (!projectRef) {
|
|
220
|
+
const manualProjectId = await clack.text({
|
|
221
|
+
message:
|
|
222
|
+
'supabase/config.toml was not created. Enter your Supabase project ref (from the link output, e.g., abcdefghijklmnopqrstu):',
|
|
223
|
+
validate: (val) => (!val ? 'Project ref is required' : undefined),
|
|
224
|
+
});
|
|
225
|
+
if (clack.isCancel(manualProjectId)) {
|
|
226
|
+
handleWizardCancel('Setup cancelled.');
|
|
227
|
+
}
|
|
228
|
+
projectRef = manualProjectId.trim();
|
|
209
229
|
}
|
|
210
|
-
|
|
211
|
-
configToml = `project_id = "${
|
|
230
|
+
|
|
231
|
+
configToml = `project_id = "${projectRef}"\n`;
|
|
212
232
|
await fs.writeFile(configTomlPath, configToml);
|
|
213
233
|
clack.note('Created supabase/config.toml from the provided project ref.');
|
|
214
234
|
} else {
|
|
@@ -287,7 +307,7 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
287
307
|
|
|
288
308
|
if (canWriteEnv) {
|
|
289
309
|
await fs.writeFile(envPath, envLines.join('\n'));
|
|
290
|
-
clack.
|
|
310
|
+
clack.note('Supabase configuration saved to .env');
|
|
291
311
|
}
|
|
292
312
|
|
|
293
313
|
clack.note('Setting up your database...');
|
|
@@ -357,7 +377,7 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
357
377
|
|
|
358
378
|
if (canWriteEnv) {
|
|
359
379
|
await fs.appendFile(envPath, r2Env);
|
|
360
|
-
clack.
|
|
380
|
+
clack.note('Cloudflare R2 configuration saved!');
|
|
361
381
|
} else {
|
|
362
382
|
clack.note('Add the following R2 values to your existing .env:\n' + r2Env);
|
|
363
383
|
}
|
|
@@ -419,7 +439,7 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
419
439
|
|
|
420
440
|
if (canWriteEnv) {
|
|
421
441
|
await fs.appendFile(envPath, smtpEnv);
|
|
422
|
-
clack.
|
|
442
|
+
clack.note('SMTP configuration saved!');
|
|
423
443
|
} else {
|
|
424
444
|
clack.note('Add the following SMTP values to your existing .env:\n' + smtpEnv);
|
|
425
445
|
}
|