create-kofi-stack 2.1.32 → 2.1.35
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 +24 -17
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -389,18 +389,23 @@ function generateSecret() {
|
|
|
389
389
|
return crypto.randomBytes(32).toString("base64");
|
|
390
390
|
}
|
|
391
391
|
}
|
|
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";
|
|
396
|
+
}
|
|
392
397
|
function buildShadcnPresetUrl(config) {
|
|
393
|
-
const
|
|
398
|
+
const shadcn = config.shadcn || {};
|
|
394
399
|
const params = new URLSearchParams({
|
|
395
|
-
base: shadcn.componentLibrary,
|
|
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,
|
|
400
|
+
base: shadcn.componentLibrary || "base",
|
|
401
|
+
style: shadcn.style || "nova",
|
|
402
|
+
baseColor: shadcn.baseColor || "neutral",
|
|
403
|
+
theme: shadcn.themeColor || "neutral",
|
|
404
|
+
iconLibrary: shadcn.iconLibrary || "hugeicons",
|
|
405
|
+
font: shadcn.font || "inter",
|
|
406
|
+
menuAccent: shadcn.menuAccent || "subtle",
|
|
407
|
+
menuColor: shadcn.menuColor || "default",
|
|
408
|
+
radius: shadcn.radius || "default",
|
|
404
409
|
template: "next"
|
|
405
410
|
});
|
|
406
411
|
return `https://ui.shadcn.com/init?${params.toString()}`;
|
|
@@ -427,11 +432,12 @@ async function generateProject(config, options = {}) {
|
|
|
427
432
|
p2.log.info(`Creating project in ${pc2.cyan(config.targetDir)}`);
|
|
428
433
|
console.log();
|
|
429
434
|
try {
|
|
435
|
+
const baseColor = getShadcnBaseColor(config);
|
|
430
436
|
const presetUrl = buildShadcnPresetUrl(config);
|
|
431
437
|
if (config.structure === "standalone") {
|
|
432
438
|
spinner.start("Creating project with shadcn/ui...");
|
|
433
439
|
try {
|
|
434
|
-
await execa("pnpm", ["dlx", "shadcn@latest", "create", config.projectName, "--
|
|
440
|
+
await execa("pnpm", ["dlx", "shadcn@latest", "create", config.projectName, "--preset", presetUrl], {
|
|
435
441
|
cwd: path2.dirname(config.targetDir),
|
|
436
442
|
stdio: "pipe"
|
|
437
443
|
});
|
|
@@ -508,11 +514,11 @@ async function generateProject(config, options = {}) {
|
|
|
508
514
|
if (config.structure === "monorepo") {
|
|
509
515
|
spinner.start("Initializing shadcn/ui in apps/web...");
|
|
510
516
|
try {
|
|
511
|
-
await execa("pnpm", ["dlx", "shadcn@latest", "init", "--yes", "--force", "--
|
|
517
|
+
await execa("pnpm", ["dlx", "shadcn@latest", "init", "--yes", "--force", "--base-color", baseColor], {
|
|
512
518
|
cwd: shadcnDir,
|
|
513
519
|
stdio: "pipe"
|
|
514
520
|
});
|
|
515
|
-
spinner.succeed("shadcn/ui initialized
|
|
521
|
+
spinner.succeed("shadcn/ui initialized");
|
|
516
522
|
const tsconfigPath = path2.join(shadcnDir, "tsconfig.json");
|
|
517
523
|
if (await fs.pathExists(tsconfigPath)) {
|
|
518
524
|
const tsconfig = await fs.readJson(tsconfigPath);
|
|
@@ -530,24 +536,25 @@ async function generateProject(config, options = {}) {
|
|
|
530
536
|
}
|
|
531
537
|
if (config.marketingSite === "nextjs" || config.marketingSite === "payload") {
|
|
532
538
|
const marketingDir = path2.join(config.targetDir, "apps/marketing");
|
|
533
|
-
spinner.start("Initializing shadcn/ui
|
|
539
|
+
spinner.start("Initializing shadcn/ui in apps/marketing...");
|
|
534
540
|
try {
|
|
535
|
-
await execa("pnpm", ["dlx", "shadcn@latest", "init", "--yes", "--force", "--
|
|
541
|
+
await execa("pnpm", ["dlx", "shadcn@latest", "init", "--yes", "--force", "--base-color", baseColor], {
|
|
536
542
|
cwd: marketingDir,
|
|
537
543
|
stdio: "pipe"
|
|
538
544
|
});
|
|
539
|
-
spinner.succeed("shadcn/ui
|
|
545
|
+
spinner.succeed("shadcn/ui initialized in marketing app");
|
|
540
546
|
const marketingTsconfigPath = path2.join(marketingDir, "tsconfig.json");
|
|
541
547
|
if (await fs.pathExists(marketingTsconfigPath)) {
|
|
542
548
|
const tsconfig = await fs.readJson(marketingTsconfigPath);
|
|
543
549
|
tsconfig.compilerOptions = tsconfig.compilerOptions || {};
|
|
544
550
|
tsconfig.compilerOptions.paths = {
|
|
551
|
+
"@payload-config": ["./src/payload.config.ts"],
|
|
545
552
|
"@/*": ["./src/*"]
|
|
546
553
|
};
|
|
547
554
|
await fs.writeJson(marketingTsconfigPath, tsconfig, { spaces: 2 });
|
|
548
555
|
}
|
|
549
556
|
} catch (error) {
|
|
550
|
-
spinner.warn("Failed to initialize shadcn
|
|
557
|
+
spinner.warn("Failed to initialize shadcn in marketing app. Run manually: pnpm dlx shadcn@latest init");
|
|
551
558
|
if (error.stderr) {
|
|
552
559
|
console.log(pc2.dim(` Error: ${error.stderr}`));
|
|
553
560
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-kofi-stack",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.35",
|
|
4
4
|
"description": "Scaffold opinionated full-stack projects with Next.js, Convex, Better-Auth, and more",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,8 +9,14 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsup src/index.ts --format esm --dts",
|
|
14
|
+
"dev": "tsup src/index.ts --format esm --watch",
|
|
15
|
+
"start": "node dist/index.js",
|
|
16
|
+
"typecheck": "tsc --noEmit"
|
|
17
|
+
},
|
|
12
18
|
"dependencies": {
|
|
13
|
-
"kofi-stack-template-generator": "^2.1.
|
|
19
|
+
"kofi-stack-template-generator": "^2.1.28",
|
|
14
20
|
"kofi-stack-types": "^2.2.0",
|
|
15
21
|
"@clack/prompts": "^0.7.0",
|
|
16
22
|
"commander": "^12.0.0",
|
|
@@ -50,11 +56,5 @@
|
|
|
50
56
|
"bugs": {
|
|
51
57
|
"url": "https://github.com/theodenanyoh11/create-kofi-stack/issues"
|
|
52
58
|
},
|
|
53
|
-
"homepage": "https://github.com/theodenanyoh11/create-kofi-stack#readme"
|
|
54
|
-
|
|
55
|
-
"build": "tsup src/index.ts --format esm --dts",
|
|
56
|
-
"dev": "tsup src/index.ts --format esm --watch",
|
|
57
|
-
"start": "node dist/index.js",
|
|
58
|
-
"typecheck": "tsc --noEmit"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
59
|
+
"homepage": "https://github.com/theodenanyoh11/create-kofi-stack#readme"
|
|
60
|
+
}
|