create-kofi-stack 2.1.32 → 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 +13 -23
- 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);
|
|
@@ -530,24 +519,25 @@ async function generateProject(config, options = {}) {
|
|
|
530
519
|
}
|
|
531
520
|
if (config.marketingSite === "nextjs" || config.marketingSite === "payload") {
|
|
532
521
|
const marketingDir = path2.join(config.targetDir, "apps/marketing");
|
|
533
|
-
spinner.start("Initializing shadcn/ui
|
|
522
|
+
spinner.start("Initializing shadcn/ui in apps/marketing...");
|
|
534
523
|
try {
|
|
535
|
-
await execa("pnpm", ["dlx", "shadcn@latest", "init", "--yes", "--force", "--
|
|
524
|
+
await execa("pnpm", ["dlx", "shadcn@latest", "init", "--yes", "--force", "--base-color", baseColor], {
|
|
536
525
|
cwd: marketingDir,
|
|
537
526
|
stdio: "pipe"
|
|
538
527
|
});
|
|
539
|
-
spinner.succeed("shadcn/ui
|
|
528
|
+
spinner.succeed("shadcn/ui initialized in marketing app");
|
|
540
529
|
const marketingTsconfigPath = path2.join(marketingDir, "tsconfig.json");
|
|
541
530
|
if (await fs.pathExists(marketingTsconfigPath)) {
|
|
542
531
|
const tsconfig = await fs.readJson(marketingTsconfigPath);
|
|
543
532
|
tsconfig.compilerOptions = tsconfig.compilerOptions || {};
|
|
544
533
|
tsconfig.compilerOptions.paths = {
|
|
534
|
+
"@payload-config": ["./src/payload.config.ts"],
|
|
545
535
|
"@/*": ["./src/*"]
|
|
546
536
|
};
|
|
547
537
|
await fs.writeJson(marketingTsconfigPath, tsconfig, { spaces: 2 });
|
|
548
538
|
}
|
|
549
539
|
} catch (error) {
|
|
550
|
-
spinner.warn("Failed to initialize shadcn
|
|
540
|
+
spinner.warn("Failed to initialize shadcn in marketing app. Run manually: pnpm dlx shadcn@latest init");
|
|
551
541
|
if (error.stderr) {
|
|
552
542
|
console.log(pc2.dim(` Error: ${error.stderr}`));
|
|
553
543
|
}
|