create-nextblock 0.2.7 → 0.2.9
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 +25 -48
- package/package.json +1 -1
package/bin/create-nextblock.js
CHANGED
|
@@ -133,15 +133,6 @@ async function handleCommand(projectDirectory, options) {
|
|
|
133
133
|
await ensureEnvExample(projectDir);
|
|
134
134
|
console.log(chalk.green('.env.example ready.'));
|
|
135
135
|
|
|
136
|
-
await ensureSupabaseAssets(projectDir);
|
|
137
|
-
console.log(chalk.green('Supabase migrations ready.'));
|
|
138
|
-
|
|
139
|
-
if (!yes) {
|
|
140
|
-
await runSetupWizard(projectDir, projectName);
|
|
141
|
-
} else {
|
|
142
|
-
console.log(chalk.yellow('Skipping interactive setup wizard because --yes was provided.'));
|
|
143
|
-
}
|
|
144
|
-
|
|
145
136
|
await sanitizeLayout(projectDir);
|
|
146
137
|
console.log(chalk.green('Global styles configured.'));
|
|
147
138
|
|
|
@@ -154,21 +145,28 @@ async function handleCommand(projectDirectory, options) {
|
|
|
154
145
|
await sanitizeNextConfig(projectDir, editorUtilNames);
|
|
155
146
|
console.log(chalk.green('next.config.js sanitized.'));
|
|
156
147
|
|
|
157
|
-
await transformPackageJson(projectDir);
|
|
158
|
-
console.log(chalk.green('Dependencies updated for public packages.'));
|
|
159
|
-
|
|
160
|
-
if (!skipInstall) {
|
|
161
|
-
await installDependencies(projectDir);
|
|
148
|
+
await transformPackageJson(projectDir);
|
|
149
|
+
console.log(chalk.green('Dependencies updated for public packages.'));
|
|
150
|
+
|
|
151
|
+
if (!skipInstall) {
|
|
152
|
+
await installDependencies(projectDir);
|
|
162
153
|
} else {
|
|
163
154
|
console.log(chalk.yellow('Skipping dependency installation.'));
|
|
164
155
|
}
|
|
165
156
|
|
|
157
|
+
// Run setup wizard after dependencies are installed so package assets are available
|
|
158
|
+
if (!yes) {
|
|
159
|
+
await runSetupWizard(projectDir, projectName);
|
|
160
|
+
} else {
|
|
161
|
+
console.log(chalk.yellow('Skipping interactive setup wizard because --yes was provided.'));
|
|
162
|
+
}
|
|
163
|
+
|
|
166
164
|
await initializeGit(projectDir);
|
|
167
165
|
console.log(chalk.green('Initialized a new Git repository.'));
|
|
168
166
|
|
|
169
167
|
console.log(chalk.green(`\nSuccess! Your NextBlock CMS project "${projectName}" is ready.\n`));
|
|
170
168
|
console.log(chalk.cyan('Next step:'));
|
|
171
|
-
console.log(chalk.cyan(
|
|
169
|
+
console.log(chalk.cyan(` cd ${projectName} && npm run dev`));
|
|
172
170
|
} catch (error) {
|
|
173
171
|
console.error(
|
|
174
172
|
chalk.red(error instanceof Error ? error.message : 'An unexpected error occurred'),
|
|
@@ -192,28 +190,10 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
192
190
|
await execa('npx', ['supabase', 'login'], { stdio: 'inherit', cwd: projectPath });
|
|
193
191
|
|
|
194
192
|
clack.note('Now, please select your NextBlock project in the browser.');
|
|
195
|
-
|
|
196
|
-
const linkProcess = execa('npx', ['supabase', 'link'], {
|
|
193
|
+
await execa('npx', ['supabase', 'link'], {
|
|
197
194
|
cwd: projectPath,
|
|
198
|
-
|
|
199
|
-
stdout: 'pipe',
|
|
200
|
-
stderr: 'pipe',
|
|
195
|
+
stdio: 'inherit',
|
|
201
196
|
});
|
|
202
|
-
if (linkProcess.stdout) {
|
|
203
|
-
linkProcess.stdout.on('data', (chunk) => {
|
|
204
|
-
const text = chunk.toString();
|
|
205
|
-
linkOutput += text;
|
|
206
|
-
process.stdout.write(text);
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
if (linkProcess.stderr) {
|
|
210
|
-
linkProcess.stderr.on('data', (chunk) => {
|
|
211
|
-
const text = chunk.toString();
|
|
212
|
-
linkOutput += text;
|
|
213
|
-
process.stderr.write(text);
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
await linkProcess;
|
|
217
197
|
if (process.stdin.isTTY) {
|
|
218
198
|
try {
|
|
219
199
|
process.stdin.setRawMode(false);
|
|
@@ -221,6 +201,8 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
221
201
|
// ignore if not supported
|
|
222
202
|
}
|
|
223
203
|
process.stdin.setEncoding('utf8');
|
|
204
|
+
process.stdin.pause();
|
|
205
|
+
process.stdin.resume();
|
|
224
206
|
}
|
|
225
207
|
process.stdin.resume();
|
|
226
208
|
|
|
@@ -230,20 +212,15 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
230
212
|
const configTomlPath = resolve(projectPath, 'supabase', 'config.toml');
|
|
231
213
|
let configToml = '';
|
|
232
214
|
if (!(await fs.pathExists(configTomlPath))) {
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
validate: (val) => (!val ? 'Project ref is required' : undefined),
|
|
241
|
-
});
|
|
242
|
-
if (clack.isCancel(manualProjectId)) {
|
|
243
|
-
handleWizardCancel('Setup cancelled.');
|
|
244
|
-
}
|
|
245
|
-
projectRef = manualProjectId.trim();
|
|
215
|
+
const manualProjectId = await clack.text({
|
|
216
|
+
message:
|
|
217
|
+
'supabase/config.toml was not created. Enter your Supabase project ref (from the link output, e.g., abcdefghijklmnopqrstu):',
|
|
218
|
+
validate: (val) => (!val ? 'Project ref is required' : undefined),
|
|
219
|
+
});
|
|
220
|
+
if (clack.isCancel(manualProjectId)) {
|
|
221
|
+
handleWizardCancel('Setup cancelled.');
|
|
246
222
|
}
|
|
223
|
+
const projectRef = manualProjectId.trim();
|
|
247
224
|
|
|
248
225
|
configToml = `project_id = "${projectRef}"\n`;
|
|
249
226
|
await fs.writeFile(configTomlPath, configToml);
|