create-nextblock 0.2.9 → 0.2.10
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 +23 -5
- package/package.json +1 -1
package/bin/create-nextblock.js
CHANGED
|
@@ -190,10 +190,28 @@ 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 in the browser.');
|
|
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
|
if (process.stdin.isTTY) {
|
|
198
216
|
try {
|
|
199
217
|
process.stdin.setRawMode(false);
|
|
@@ -201,8 +219,6 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
201
219
|
// ignore if not supported
|
|
202
220
|
}
|
|
203
221
|
process.stdin.setEncoding('utf8');
|
|
204
|
-
process.stdin.pause();
|
|
205
|
-
process.stdin.resume();
|
|
206
222
|
}
|
|
207
223
|
process.stdin.resume();
|
|
208
224
|
|
|
@@ -212,15 +228,17 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
212
228
|
const configTomlPath = resolve(projectPath, 'supabase', 'config.toml');
|
|
213
229
|
let configToml = '';
|
|
214
230
|
if (!(await fs.pathExists(configTomlPath))) {
|
|
231
|
+
let projectRef = linkOutput.match(/Selected project:\s*([a-z0-9-]+)/i)?.[1] || '';
|
|
215
232
|
const manualProjectId = await clack.text({
|
|
216
233
|
message:
|
|
217
234
|
'supabase/config.toml was not created. Enter your Supabase project ref (from the link output, e.g., abcdefghijklmnopqrstu):',
|
|
235
|
+
initialValue: projectRef,
|
|
218
236
|
validate: (val) => (!val ? 'Project ref is required' : undefined),
|
|
219
237
|
});
|
|
220
238
|
if (clack.isCancel(manualProjectId)) {
|
|
221
239
|
handleWizardCancel('Setup cancelled.');
|
|
222
240
|
}
|
|
223
|
-
|
|
241
|
+
projectRef = manualProjectId.trim();
|
|
224
242
|
|
|
225
243
|
configToml = `project_id = "${projectRef}"\n`;
|
|
226
244
|
await fs.writeFile(configTomlPath, configToml);
|