create-bdpa-react-scaffold 1.8.3 → 1.8.6

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.
Files changed (2) hide show
  1. package/create-ui-lib.js +156 -7
  2. package/package.json +3 -3
package/create-ui-lib.js CHANGED
@@ -58,6 +58,23 @@ function write(filePath, content) {
58
58
  console.log("✔ Created:", filePath);
59
59
  }
60
60
 
61
+ function installShadcn(cwd) {
62
+ const isWin = process.platform === "win32";
63
+ const npxCmd = isWin ? "npx.cmd" : "npx";
64
+ console.log("\n🎨 Installing shadcn/ui components (all)...");
65
+ const result = spawnSync(
66
+ npxCmd,
67
+ ["shadcn@latest", "add", "--all", "--yes", "--overwrite"],
68
+ { stdio: "inherit", cwd }
69
+ );
70
+ if (result.status !== 0) {
71
+ console.warn(`\n⚠️ shadcn install exited with status ${result.status}.`);
72
+ console.warn(" Run manually: npx shadcn@latest add --all");
73
+ } else {
74
+ console.log("\n✅ shadcn/ui components installed.");
75
+ }
76
+ }
77
+
61
78
  function installVSCodeExtensions() {
62
79
  const extensions = [
63
80
  "dsznajder.es7-react-js-snippets",
@@ -142,7 +159,10 @@ write("package.json", `
142
159
  "react-dom": "^18.2.0",
143
160
  "react-router-dom": "^6.20.0",
144
161
  "lucide-react": "^0.344.0",
145
- "bcryptjs": "^2.4.3"
162
+ "bcryptjs": "^2.4.3",
163
+ "class-variance-authority": "^0.7.0",
164
+ "clsx": "^2.1.0",
165
+ "tailwind-merge": "^2.2.1"
146
166
  },
147
167
  "devDependencies": {
148
168
  "@types/react": "^18.2.0",
@@ -151,6 +171,7 @@ write("package.json", `
151
171
  "autoprefixer": "^10.4.20",
152
172
  "postcss": "^8.4.47",
153
173
  "tailwindcss": "^3.4.0",
174
+ "tailwindcss-animate": "^1.0.7",
154
175
  "vite": "^5.0.0"
155
176
  }
156
177
  }
@@ -163,6 +184,7 @@ write("jsconfig.json", `
163
184
  "module": "ESNext",
164
185
  "moduleResolution": "bundler",
165
186
  "jsx": "react-jsx",
187
+ "checkJs": true,
166
188
  "strict": false,
167
189
  "allowSyntheticDefaultImports": true,
168
190
  "esModuleInterop": true,
@@ -177,6 +199,29 @@ write("jsconfig.json", `
177
199
  }
178
200
  `);
179
201
 
202
+ write("components.json", `
203
+ {
204
+ "$schema": "https://ui.shadcn.com/schema.json",
205
+ "style": "default",
206
+ "rsc": false,
207
+ "tsx": false,
208
+ "tailwind": {
209
+ "config": "tailwind.config.cjs",
210
+ "css": "src/index.css",
211
+ "baseColor": "slate",
212
+ "cssVariables": true,
213
+ "prefix": ""
214
+ },
215
+ "aliases": {
216
+ "components": "@/components",
217
+ "utils": "@/lib/utils",
218
+ "ui": "@/components/ui",
219
+ "lib": "@/lib",
220
+ "hooks": "@/hooks"
221
+ }
222
+ }
223
+ `);
224
+
180
225
  write(".vscode/extensions.json", `
181
226
  {
182
227
  "recommendations": [
@@ -241,6 +286,7 @@ module.exports = {
241
286
 
242
287
  write("tailwind.config.cjs", `
243
288
  module.exports = {
289
+ darkMode: ["class"],
244
290
  content: [
245
291
  "./index.html",
246
292
  "./src/**/*.{js,jsx,ts,tsx}"
@@ -249,11 +295,49 @@ module.exports = {
249
295
  extend: {
250
296
  colors: {
251
297
  milwaukeeBlue: "#2563eb",
252
- milwaukeeGold: "#fbbf24"
298
+ milwaukeeGold: "#fbbf24",
299
+ border: "hsl(var(--border))",
300
+ input: "hsl(var(--input))",
301
+ ring: "hsl(var(--ring))",
302
+ background: "hsl(var(--background))",
303
+ foreground: "hsl(var(--foreground))",
304
+ primary: {
305
+ DEFAULT: "hsl(var(--primary))",
306
+ foreground: "hsl(var(--primary-foreground))"
307
+ },
308
+ secondary: {
309
+ DEFAULT: "hsl(var(--secondary))",
310
+ foreground: "hsl(var(--secondary-foreground))"
311
+ },
312
+ destructive: {
313
+ DEFAULT: "hsl(var(--destructive))",
314
+ foreground: "hsl(var(--destructive-foreground))"
315
+ },
316
+ muted: {
317
+ DEFAULT: "hsl(var(--muted))",
318
+ foreground: "hsl(var(--muted-foreground))"
319
+ },
320
+ accent: {
321
+ DEFAULT: "hsl(var(--accent))",
322
+ foreground: "hsl(var(--accent-foreground))"
323
+ },
324
+ popover: {
325
+ DEFAULT: "hsl(var(--popover))",
326
+ foreground: "hsl(var(--popover-foreground))"
327
+ },
328
+ card: {
329
+ DEFAULT: "hsl(var(--card))",
330
+ foreground: "hsl(var(--card-foreground))"
331
+ }
332
+ },
333
+ borderRadius: {
334
+ lg: "var(--radius)",
335
+ md: "calc(var(--radius) - 2px)",
336
+ sm: "calc(var(--radius) - 4px)"
253
337
  }
254
338
  }
255
339
  },
256
- plugins: []
340
+ plugins: [require("tailwindcss-animate")]
257
341
  };
258
342
  `);
259
343
 
@@ -463,12 +547,62 @@ write("src/index.css", `
463
547
  @tailwind components;
464
548
  @tailwind utilities;
465
549
 
466
- body {
467
- @apply bg-gray-100 text-gray-900;
550
+ @layer base {
551
+ :root {
552
+ --background: 0 0% 100%;
553
+ --foreground: 222.2 84% 4.9%;
554
+ --card: 0 0% 100%;
555
+ --card-foreground: 222.2 84% 4.9%;
556
+ --popover: 0 0% 100%;
557
+ --popover-foreground: 222.2 84% 4.9%;
558
+ --primary: 222.2 47.4% 11.2%;
559
+ --primary-foreground: 210 40% 98%;
560
+ --secondary: 210 40% 96.1%;
561
+ --secondary-foreground: 222.2 47.4% 11.2%;
562
+ --muted: 210 40% 96.1%;
563
+ --muted-foreground: 215.4 16.3% 46.9%;
564
+ --accent: 210 40% 96.1%;
565
+ --accent-foreground: 222.2 47.4% 11.2%;
566
+ --destructive: 0 84.2% 60.2%;
567
+ --destructive-foreground: 210 40% 98%;
568
+ --border: 214.3 31.8% 91.4%;
569
+ --input: 214.3 31.8% 91.4%;
570
+ --ring: 222.2 84% 4.9%;
571
+ --radius: 0.5rem;
572
+ }
573
+ .dark {
574
+ --background: 222.2 84% 4.9%;
575
+ --foreground: 210 40% 98%;
576
+ --card: 222.2 84% 4.9%;
577
+ --card-foreground: 210 40% 98%;
578
+ --popover: 222.2 84% 4.9%;
579
+ --popover-foreground: 210 40% 98%;
580
+ --primary: 210 40% 98%;
581
+ --primary-foreground: 222.2 47.4% 11.2%;
582
+ --secondary: 217.2 32.6% 17.5%;
583
+ --secondary-foreground: 210 40% 98%;
584
+ --muted: 217.2 32.6% 17.5%;
585
+ --muted-foreground: 215 20.2% 65.1%;
586
+ --accent: 217.2 32.6% 17.5%;
587
+ --accent-foreground: 210 40% 98%;
588
+ --destructive: 0 62.8% 30.6%;
589
+ --destructive-foreground: 210 40% 98%;
590
+ --border: 217.2 32.6% 17.5%;
591
+ --input: 217.2 32.6% 17.5%;
592
+ --ring: 212.7 26.8% 83.9%;
593
+ }
468
594
  }
469
595
 
470
- h1, h2, h3, h4 {
471
- @apply font-semibold;
596
+ @layer base {
597
+ * {
598
+ @apply border-border;
599
+ }
600
+ body {
601
+ @apply bg-background text-foreground;
602
+ }
603
+ h1, h2, h3, h4 {
604
+ @apply font-semibold;
605
+ }
472
606
  }
473
607
  `);
474
608
 
@@ -491,6 +625,20 @@ ReactDOM.createRoot(document.getElementById("root")).render(
491
625
  );
492
626
  `);
493
627
 
628
+ write("src/lib/utils.js", `
629
+ import { clsx } from "clsx";
630
+ import { twMerge } from "tailwind-merge";
631
+
632
+ /**
633
+ * Merges Tailwind CSS classes with clsx + tailwind-merge.
634
+ * @param {...import('clsx').ClassValue} inputs
635
+ * @returns {string}
636
+ */
637
+ export function cn(...inputs) {
638
+ return twMerge(clsx(inputs));
639
+ }
640
+ `);
641
+
494
642
  write("src/index.js", `
495
643
  export { default as Button } from "./components/ui/Button.jsx";
496
644
  export { default as Card } from "./components/ui/Card.jsx";
@@ -1281,6 +1429,7 @@ if (fs.existsSync(bdpaImagePath)) {
1281
1429
 
1282
1430
  if (doInstall) {
1283
1431
  installDependencies(packageManager, BASE_DIR);
1432
+ installShadcn(BASE_DIR);
1284
1433
  }
1285
1434
 
1286
1435
  installVSCodeExtensions();
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "create-bdpa-react-scaffold",
3
- "version": "1.8.3",
3
+ "version": "1.8.6",
4
4
  "description": "Scaffold a React + Tailwind UI library demo via Vite.",
5
5
  "bin": {
6
- "create-bdpa-react-scaffold": "./create-ui-lib.js"
6
+ "create-bdpa-react-scaffold": "create-ui-lib.js"
7
7
  },
8
8
  "files": [
9
9
  "create-ui-lib.js",
@@ -32,7 +32,7 @@
32
32
  "homepage": "https://github.com/lxdavis9lxd/create-bdpa-react-scaffold-#readme",
33
33
  "license": "UNLICENSED",
34
34
  "scripts": {
35
- "prepublishOnly": "node -e \"require('fs').accessSync('./create-ui-lib.js');\"",
35
+ "prepublishOnly": "node -e \"require('fs').accessSync('create-ui-lib.js');\"",
36
36
  "install:extensions": "code --install-extension dsznajder.es7-react-js-snippets && code --install-extension bradlc.vscode-tailwindcss && code --install-extension dbaeumer.vscode-eslint && code --install-extension esbenp.prettier-vscode",
37
37
  "test": "npm run install:extensions",
38
38
  "publish:public": "npm run install:extensions && npm publish --access public"