create-kofi-stack 2.0.8 → 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 +50 -45
- 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,35 +262,60 @@ 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) {
|
|
276
|
+
console.log();
|
|
277
|
+
p2.log.info("Starting Convex setup...");
|
|
278
|
+
p2.log.message(pc2.dim("This will open your browser to authenticate with Convex"));
|
|
283
279
|
console.log();
|
|
284
|
-
|
|
285
|
-
|
|
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`);
|
|
294
|
+
}
|
|
295
|
+
console.log();
|
|
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
|
+
}
|
|
288
307
|
}
|
|
289
308
|
} else {
|
|
290
309
|
console.log();
|
|
291
|
-
p2.log.info(`Run ${pc2.cyan("pnpm dev:setup")}
|
|
310
|
+
p2.log.info(`Run ${pc2.cyan("pnpm dev:setup")} to configure Convex`);
|
|
292
311
|
}
|
|
312
|
+
console.log();
|
|
313
|
+
p2.log.success(`Project ${pc2.cyan(config.projectName)} created successfully!`);
|
|
314
|
+
console.log();
|
|
315
|
+
p2.log.message(`${pc2.dim("To get started:")}`);
|
|
316
|
+
p2.log.message(` ${pc2.cyan(`cd ${config.projectName}`)}`);
|
|
317
|
+
p2.log.message(` ${pc2.cyan("pnpm dev")}`);
|
|
318
|
+
console.log();
|
|
293
319
|
} catch (error) {
|
|
294
320
|
spinner.fail("An error occurred during project generation");
|
|
295
321
|
throw error;
|
|
@@ -354,8 +380,7 @@ program.name("create-kofi-stack").description("Scaffold opinionated full-stack p
|
|
|
354
380
|
p3.intro(pc3.bgCyan(pc3.black(" create-kofi-stack ")));
|
|
355
381
|
try {
|
|
356
382
|
const config = await runPrompts(projectName, options);
|
|
357
|
-
await generateProject(config);
|
|
358
|
-
displaySuccessMessage(config.projectName);
|
|
383
|
+
await generateProject(config, { skipPrompts: options.yes });
|
|
359
384
|
} catch (error) {
|
|
360
385
|
if (error instanceof Error && error.message === "cancelled") {
|
|
361
386
|
p3.cancel("Operation cancelled");
|
|
@@ -365,24 +390,4 @@ program.name("create-kofi-stack").description("Scaffold opinionated full-stack p
|
|
|
365
390
|
process.exit(1);
|
|
366
391
|
}
|
|
367
392
|
});
|
|
368
|
-
function displaySuccessMessage(projectName) {
|
|
369
|
-
console.log();
|
|
370
|
-
p3.outro(pc3.green("Project created successfully!"));
|
|
371
|
-
console.log();
|
|
372
|
-
console.log(pc3.bold("Next steps:"));
|
|
373
|
-
console.log();
|
|
374
|
-
console.log(` ${pc3.cyan("cd")} ${projectName}`);
|
|
375
|
-
console.log(` ${pc3.cyan("pnpm")} dev`);
|
|
376
|
-
console.log();
|
|
377
|
-
console.log(pc3.dim("This will automatically:"));
|
|
378
|
-
console.log(pc3.dim(" - Install dependencies"));
|
|
379
|
-
console.log(pc3.dim(" - Guide you through Convex setup"));
|
|
380
|
-
console.log(pc3.dim(" - Start Next.js and Convex dev servers"));
|
|
381
|
-
console.log();
|
|
382
|
-
console.log(pc3.bold("Documentation:"));
|
|
383
|
-
console.log(` ${pc3.dim("-")} Convex: ${pc3.cyan("https://docs.convex.dev")}`);
|
|
384
|
-
console.log(` ${pc3.dim("-")} Better-Auth: ${pc3.cyan("https://www.better-auth.com")}`);
|
|
385
|
-
console.log(` ${pc3.dim("-")} shadcn/ui: ${pc3.cyan("https://ui.shadcn.com")}`);
|
|
386
|
-
console.log();
|
|
387
|
-
}
|
|
388
393
|
program.parse();
|