create-kofi-stack 2.1.31 → 2.1.33
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 +21 -25
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -389,21 +389,10 @@ function generateSecret() {
|
|
|
389
389
|
return crypto.randomBytes(32).toString("base64");
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
function
|
|
393
|
-
const
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
style: shadcn.style,
|
|
397
|
-
baseColor: shadcn.baseColor,
|
|
398
|
-
theme: shadcn.themeColor,
|
|
399
|
-
iconLibrary: shadcn.iconLibrary,
|
|
400
|
-
font: shadcn.font,
|
|
401
|
-
menuAccent: shadcn.menuAccent,
|
|
402
|
-
menuColor: shadcn.menuColor,
|
|
403
|
-
radius: shadcn.radius,
|
|
404
|
-
template: "next"
|
|
405
|
-
});
|
|
406
|
-
return `https://ui.shadcn.com/init?${params.toString()}`;
|
|
392
|
+
function getShadcnBaseColor(config) {
|
|
393
|
+
const baseColor = config.shadcn?.baseColor || "neutral";
|
|
394
|
+
const validColors = ["neutral", "gray", "zinc", "stone", "slate"];
|
|
395
|
+
return validColors.includes(baseColor) ? baseColor : "neutral";
|
|
407
396
|
}
|
|
408
397
|
async function updateEnvWithSecrets(envPath, secrets) {
|
|
409
398
|
if (!await fs.pathExists(envPath)) {
|
|
@@ -427,11 +416,11 @@ async function generateProject(config, options = {}) {
|
|
|
427
416
|
p2.log.info(`Creating project in ${pc2.cyan(config.targetDir)}`);
|
|
428
417
|
console.log();
|
|
429
418
|
try {
|
|
430
|
-
const
|
|
419
|
+
const baseColor = getShadcnBaseColor(config);
|
|
431
420
|
if (config.structure === "standalone") {
|
|
432
421
|
spinner.start("Creating project with shadcn/ui...");
|
|
433
422
|
try {
|
|
434
|
-
await execa("pnpm", ["dlx", "shadcn@latest", "create", config.projectName, "--template", "next", "--
|
|
423
|
+
await execa("pnpm", ["dlx", "shadcn@latest", "create", config.projectName, "--template", "next", "--base-color", baseColor, "--src-dir"], {
|
|
435
424
|
cwd: path2.dirname(config.targetDir),
|
|
436
425
|
stdio: "pipe"
|
|
437
426
|
});
|
|
@@ -508,11 +497,11 @@ async function generateProject(config, options = {}) {
|
|
|
508
497
|
if (config.structure === "monorepo") {
|
|
509
498
|
spinner.start("Initializing shadcn/ui in apps/web...");
|
|
510
499
|
try {
|
|
511
|
-
await execa("pnpm", ["dlx", "shadcn@latest", "init", "--yes", "--force", "--
|
|
500
|
+
await execa("pnpm", ["dlx", "shadcn@latest", "init", "--yes", "--force", "--base-color", baseColor], {
|
|
512
501
|
cwd: shadcnDir,
|
|
513
502
|
stdio: "pipe"
|
|
514
503
|
});
|
|
515
|
-
spinner.succeed("shadcn/ui initialized
|
|
504
|
+
spinner.succeed("shadcn/ui initialized");
|
|
516
505
|
const tsconfigPath = path2.join(shadcnDir, "tsconfig.json");
|
|
517
506
|
if (await fs.pathExists(tsconfigPath)) {
|
|
518
507
|
const tsconfig = await fs.readJson(tsconfigPath);
|
|
@@ -522,29 +511,36 @@ async function generateProject(config, options = {}) {
|
|
|
522
511
|
};
|
|
523
512
|
await fs.writeJson(tsconfigPath, tsconfig, { spaces: 2 });
|
|
524
513
|
}
|
|
525
|
-
} catch {
|
|
514
|
+
} catch (error) {
|
|
526
515
|
spinner.warn("Failed to initialize shadcn. Run manually in apps/web: pnpm dlx shadcn@latest init");
|
|
516
|
+
if (error.stderr) {
|
|
517
|
+
console.log(pc2.dim(` Error: ${error.stderr}`));
|
|
518
|
+
}
|
|
527
519
|
}
|
|
528
520
|
if (config.marketingSite === "nextjs" || config.marketingSite === "payload") {
|
|
529
521
|
const marketingDir = path2.join(config.targetDir, "apps/marketing");
|
|
530
|
-
spinner.start("Initializing shadcn/ui
|
|
522
|
+
spinner.start("Initializing shadcn/ui in apps/marketing...");
|
|
531
523
|
try {
|
|
532
|
-
await execa("pnpm", ["dlx", "shadcn@latest", "init", "--yes", "--force", "--
|
|
524
|
+
await execa("pnpm", ["dlx", "shadcn@latest", "init", "--yes", "--force", "--base-color", baseColor], {
|
|
533
525
|
cwd: marketingDir,
|
|
534
526
|
stdio: "pipe"
|
|
535
527
|
});
|
|
536
|
-
spinner.succeed("shadcn/ui
|
|
528
|
+
spinner.succeed("shadcn/ui initialized in marketing app");
|
|
537
529
|
const marketingTsconfigPath = path2.join(marketingDir, "tsconfig.json");
|
|
538
530
|
if (await fs.pathExists(marketingTsconfigPath)) {
|
|
539
531
|
const tsconfig = await fs.readJson(marketingTsconfigPath);
|
|
540
532
|
tsconfig.compilerOptions = tsconfig.compilerOptions || {};
|
|
541
533
|
tsconfig.compilerOptions.paths = {
|
|
534
|
+
"@payload-config": ["./src/payload.config.ts"],
|
|
542
535
|
"@/*": ["./src/*"]
|
|
543
536
|
};
|
|
544
537
|
await fs.writeJson(marketingTsconfigPath, tsconfig, { spaces: 2 });
|
|
545
538
|
}
|
|
546
|
-
} catch {
|
|
547
|
-
spinner.warn("Failed to initialize shadcn
|
|
539
|
+
} catch (error) {
|
|
540
|
+
spinner.warn("Failed to initialize shadcn in marketing app. Run manually: pnpm dlx shadcn@latest init");
|
|
541
|
+
if (error.stderr) {
|
|
542
|
+
console.log(pc2.dim(` Error: ${error.stderr}`));
|
|
543
|
+
}
|
|
548
544
|
}
|
|
549
545
|
}
|
|
550
546
|
}
|