create-kofi-stack 2.0.9 → 2.0.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/dist/index.js +43 -37
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -214,7 +214,8 @@ import fs from "fs-extra";
|
|
|
214
214
|
import path2 from "path";
|
|
215
215
|
import { execa } from "execa";
|
|
216
216
|
import { generateVirtualProject } from "kofi-stack-template-generator";
|
|
217
|
-
async function generateProject(config) {
|
|
217
|
+
async function generateProject(config, options = {}) {
|
|
218
|
+
const { skipPrompts = false } = options;
|
|
218
219
|
const spinner = ora();
|
|
219
220
|
if (await fs.pathExists(config.targetDir)) {
|
|
220
221
|
p2.cancel(`Directory ${config.projectName} already exists`);
|
|
@@ -261,47 +262,52 @@ async function generateProject(config) {
|
|
|
261
262
|
} catch {
|
|
262
263
|
spinner.warn("Failed to install shadcn/ui components. Run pnpm dlx shadcn@latest add --all manually.");
|
|
263
264
|
}
|
|
264
|
-
|
|
265
|
-
const setupConvex = await p2.confirm({
|
|
266
|
-
message: "Would you like to set up Convex now?",
|
|
267
|
-
initialValue: true
|
|
268
|
-
});
|
|
269
|
-
if (p2.isCancel(setupConvex)) {
|
|
270
|
-
p2.cancel("Setup cancelled");
|
|
271
|
-
process.exit(0);
|
|
272
|
-
}
|
|
273
|
-
if (setupConvex) {
|
|
274
|
-
console.log();
|
|
275
|
-
p2.log.info("Starting Convex setup...");
|
|
276
|
-
p2.log.message(pc2.dim("This will open your browser to authenticate with Convex"));
|
|
265
|
+
if (!skipPrompts) {
|
|
277
266
|
console.log();
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
267
|
+
const setupConvex = await p2.confirm({
|
|
268
|
+
message: "Would you like to set up Convex now?",
|
|
269
|
+
initialValue: true
|
|
270
|
+
});
|
|
271
|
+
if (p2.isCancel(setupConvex)) {
|
|
272
|
+
p2.cancel("Setup cancelled");
|
|
273
|
+
process.exit(0);
|
|
274
|
+
}
|
|
275
|
+
if (setupConvex) {
|
|
283
276
|
console.log();
|
|
284
|
-
p2.log.
|
|
285
|
-
|
|
277
|
+
p2.log.info("Starting Convex setup...");
|
|
278
|
+
p2.log.message(pc2.dim("This will open your browser to authenticate with Convex"));
|
|
279
|
+
console.log();
|
|
280
|
+
try {
|
|
281
|
+
await execa("pnpm", ["dev:setup"], {
|
|
282
|
+
cwd: config.targetDir,
|
|
283
|
+
stdio: "inherit"
|
|
284
|
+
});
|
|
285
|
+
console.log();
|
|
286
|
+
p2.log.success("Convex configured successfully!");
|
|
287
|
+
} catch {
|
|
288
|
+
console.log();
|
|
289
|
+
p2.log.warn("Convex setup was interrupted. Run pnpm dev:setup to try again.");
|
|
290
|
+
}
|
|
291
|
+
} else {
|
|
286
292
|
console.log();
|
|
287
|
-
p2.log.
|
|
293
|
+
p2.log.info(`Run ${pc2.cyan("pnpm dev:setup")} when you're ready to configure Convex`);
|
|
288
294
|
}
|
|
289
|
-
} else {
|
|
290
295
|
console.log();
|
|
291
|
-
p2.
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
} catch {
|
|
303
|
-
p2.log.warn('Could not open VS Code. Make sure "code" command is in your PATH.');
|
|
296
|
+
const openInIDE = await p2.confirm({
|
|
297
|
+
message: "Would you like to open the project in VS Code?",
|
|
298
|
+
initialValue: true
|
|
299
|
+
});
|
|
300
|
+
if (!p2.isCancel(openInIDE) && openInIDE) {
|
|
301
|
+
try {
|
|
302
|
+
await execa("code", [config.targetDir], { stdio: "pipe" });
|
|
303
|
+
p2.log.success("Opened in VS Code");
|
|
304
|
+
} catch {
|
|
305
|
+
p2.log.warn('Could not open VS Code. Make sure "code" command is in your PATH.');
|
|
306
|
+
}
|
|
304
307
|
}
|
|
308
|
+
} else {
|
|
309
|
+
console.log();
|
|
310
|
+
p2.log.info(`Run ${pc2.cyan("pnpm dev:setup")} to configure Convex`);
|
|
305
311
|
}
|
|
306
312
|
console.log();
|
|
307
313
|
p2.log.success(`Project ${pc2.cyan(config.projectName)} created successfully!`);
|
|
@@ -374,7 +380,7 @@ program.name("create-kofi-stack").description("Scaffold opinionated full-stack p
|
|
|
374
380
|
p3.intro(pc3.bgCyan(pc3.black(" create-kofi-stack ")));
|
|
375
381
|
try {
|
|
376
382
|
const config = await runPrompts(projectName, options);
|
|
377
|
-
await generateProject(config);
|
|
383
|
+
await generateProject(config, { skipPrompts: options.yes });
|
|
378
384
|
} catch (error) {
|
|
379
385
|
if (error instanceof Error && error.message === "cancelled") {
|
|
380
386
|
p3.cancel("Operation cancelled");
|