create-nextblock 0.2.11 → 0.2.13
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 +11 -42
- package/package.json +1 -1
package/bin/create-nextblock.js
CHANGED
|
@@ -189,48 +189,25 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
189
189
|
clack.note('I will now open your browser to log into Supabase.');
|
|
190
190
|
await execa('npx', ['supabase', 'login'], { stdio: 'inherit', cwd: projectPath });
|
|
191
191
|
|
|
192
|
-
clack.note('Now, please select your NextBlock project
|
|
193
|
-
|
|
194
|
-
const linkProcess = execa('npx', ['supabase', 'link'], {
|
|
192
|
+
clack.note('Now, please select your NextBlock project when prompted.');
|
|
193
|
+
await execa('npx', ['supabase', 'link'], {
|
|
195
194
|
cwd: projectPath,
|
|
196
|
-
|
|
197
|
-
stdout: 'pipe',
|
|
198
|
-
stderr: 'pipe',
|
|
195
|
+
stdio: 'inherit',
|
|
199
196
|
});
|
|
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;
|
|
215
|
-
if (process.stdin.isTTY) {
|
|
216
|
-
try {
|
|
217
|
-
process.stdin.setRawMode(false);
|
|
218
|
-
} catch (_) {
|
|
219
|
-
// ignore if not supported
|
|
220
|
-
}
|
|
221
|
-
process.stdin.setEncoding('utf8');
|
|
222
|
-
}
|
|
223
|
-
process.stdin.resume();
|
|
224
197
|
|
|
225
198
|
// Ensure supabase assets exist (config + migrations) after link in case the CLI created/overrode files
|
|
226
199
|
await ensureSupabaseAssets(projectPath);
|
|
227
200
|
|
|
228
201
|
const configTomlPath = resolve(projectPath, 'supabase', 'config.toml');
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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`.');
|
|
232
209
|
}
|
|
233
|
-
const projectId =
|
|
210
|
+
const projectId = projectMatch[1];
|
|
234
211
|
|
|
235
212
|
if (!(await fs.pathExists(configTomlPath))) {
|
|
236
213
|
const configToml = `project_id = "env(SUPABASE_PROJECT_ID)"\n`;
|
|
@@ -239,13 +216,6 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
239
216
|
}
|
|
240
217
|
|
|
241
218
|
clack.note('Please go to your Supabase project dashboard to get the following secrets.');
|
|
242
|
-
if (process.stdin.isTTY) {
|
|
243
|
-
try {
|
|
244
|
-
process.stdin.setRawMode(false);
|
|
245
|
-
} catch (_) {}
|
|
246
|
-
process.stdin.setEncoding('utf8');
|
|
247
|
-
process.stdin.resume();
|
|
248
|
-
}
|
|
249
219
|
const supabaseKeys = await clack.group(
|
|
250
220
|
{
|
|
251
221
|
dbPassword: () =>
|
|
@@ -285,7 +255,6 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
285
255
|
'',
|
|
286
256
|
'# Supabase',
|
|
287
257
|
`SUPABASE_PROJECT_ID=${projectId}`,
|
|
288
|
-
`SUPABASE_PROJECT_ID=${projectId}`,
|
|
289
258
|
`NEXT_PUBLIC_SUPABASE_URL=${supabaseUrl}`,
|
|
290
259
|
`NEXT_PUBLIC_SUPABASE_ANON_KEY=${supabaseKeys.anonKey}`,
|
|
291
260
|
`SUPABASE_SERVICE_ROLE_KEY=${supabaseKeys.serviceKey}`,
|