create-nextblock 0.2.0 → 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
CHANGED
|
@@ -185,7 +185,11 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
185
185
|
|
|
186
186
|
clack.intro('🚀 Welcome to the NextBlock setup wizard!');
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
// Ensure Supabase directory exists so the CLI can place config.toml
|
|
189
|
+
const supabaseDir = resolve(projectPath, 'supabase');
|
|
190
|
+
await fs.ensureDir(supabaseDir);
|
|
191
|
+
|
|
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 });
|
|
191
195
|
|
|
@@ -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.');
|
|
@@ -225,7 +242,7 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
225
242
|
{ onCancel: () => handleWizardCancel('Setup cancelled.') },
|
|
226
243
|
);
|
|
227
244
|
|
|
228
|
-
clack.
|
|
245
|
+
clack.note('Generating local secrets...');
|
|
229
246
|
const revalidationToken = crypto.randomBytes(32).toString('hex');
|
|
230
247
|
const supabaseUrl = `https://${projectId}.supabase.co`;
|
|
231
248
|
|
|
@@ -273,7 +290,7 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
273
290
|
clack.success('Supabase configuration saved to .env');
|
|
274
291
|
}
|
|
275
292
|
|
|
276
|
-
clack.
|
|
293
|
+
clack.note('Setting up your database...');
|
|
277
294
|
const dbPushSpinner = clack.spinner();
|
|
278
295
|
dbPushSpinner.start('Pushing database schema... (This may take a minute)');
|
|
279
296
|
try {
|
package/package.json
CHANGED