create-bdpa-react-scaffold 1.8.3 → 1.8.7

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 +166 -7
  2. package/package.json +3 -3
package/create-ui-lib.js CHANGED
@@ -58,6 +58,33 @@ 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
+ [
68
+ "shadcn@latest", "add",
69
+ "accordion", "alert", "alert-dialog", "aspect-ratio", "avatar", "badge",
70
+ "button", "calendar", "card", "carousel", "checkbox", "collapsible",
71
+ "command", "dialog", "drawer", "dropdown-menu", "form", "hover-card",
72
+ "input", "label", "menubar", "navigation-menu", "popover", "progress",
73
+ "radio-group", "scroll-area", "select", "separator", "sheet", "skeleton",
74
+ "slider", "sonner", "switch", "table", "tabs", "textarea", "toast",
75
+ "toggle", "tooltip",
76
+ "--yes", "--overwrite"
77
+ ],
78
+ { stdio: "inherit", cwd }
79
+ );
80
+ if (result.status !== 0) {
81
+ console.warn(`\n⚠️ shadcn install exited with status ${result.status}.`);
82
+ console.warn(" Run manually: npx shadcn@latest add accordion alert alert-dialog aspect-ratio avatar badge button calendar card carousel checkbox collapsible command dialog drawer dropdown-menu form hover-card input label menubar navigation-menu popover progress radio-group scroll-area select separator sheet skeleton slider sonner switch table tabs textarea toast toggle tooltip");
83
+ } else {
84
+ console.log("\n✅ shadcn/ui components installed.");
85
+ }
86
+ }
87
+
61
88
  function installVSCodeExtensions() {
62
89
  const extensions = [
63
90
  "dsznajder.es7-react-js-snippets",
@@ -142,7 +169,10 @@ write("package.json", `
142
169
  "react-dom": "^18.2.0",
143
170
  "react-router-dom": "^6.20.0",
144
171
  "lucide-react": "^0.344.0",
145
- "bcryptjs": "^2.4.3"
172
+ "bcryptjs": "^2.4.3",
173
+ "class-variance-authority": "^0.7.0",
174
+ "clsx": "^2.1.0",
175
+ "tailwind-merge": "^2.2.1"
146
176
  },
147
177
  "devDependencies": {
148
178
  "@types/react": "^18.2.0",
@@ -151,6 +181,7 @@ write("package.json", `
151
181
  "autoprefixer": "^10.4.20",
152
182
  "postcss": "^8.4.47",
153
183
  "tailwindcss": "^3.4.0",
184
+ "tailwindcss-animate": "^1.0.7",
154
185
  "vite": "^5.0.0"
155
186
  }
156
187
  }
@@ -163,6 +194,7 @@ write("jsconfig.json", `
163
194
  "module": "ESNext",
164
195
  "moduleResolution": "bundler",
165
196
  "jsx": "react-jsx",
197
+ "checkJs": true,
166
198
  "strict": false,
167
199
  "allowSyntheticDefaultImports": true,
168
200
  "esModuleInterop": true,
@@ -177,6 +209,29 @@ write("jsconfig.json", `
177
209
  }
178
210
  `);
179
211
 
212
+ write("components.json", `
213
+ {
214
+ "$schema": "https://ui.shadcn.com/schema.json",
215
+ "style": "default",
216
+ "rsc": false,
217
+ "tsx": false,
218
+ "tailwind": {
219
+ "config": "tailwind.config.cjs",
220
+ "css": "src/index.css",
221
+ "baseColor": "slate",
222
+ "cssVariables": true,
223
+ "prefix": ""
224
+ },
225
+ "aliases": {
226
+ "components": "@/components",
227
+ "utils": "@/lib/utils",
228
+ "ui": "@/components/ui",
229
+ "lib": "@/lib",
230
+ "hooks": "@/hooks"
231
+ }
232
+ }
233
+ `);
234
+
180
235
  write(".vscode/extensions.json", `
181
236
  {
182
237
  "recommendations": [
@@ -241,6 +296,7 @@ module.exports = {
241
296
 
242
297
  write("tailwind.config.cjs", `
243
298
  module.exports = {
299
+ darkMode: ["class"],
244
300
  content: [
245
301
  "./index.html",
246
302
  "./src/**/*.{js,jsx,ts,tsx}"
@@ -249,11 +305,49 @@ module.exports = {
249
305
  extend: {
250
306
  colors: {
251
307
  milwaukeeBlue: "#2563eb",
252
- milwaukeeGold: "#fbbf24"
308
+ milwaukeeGold: "#fbbf24",
309
+ border: "hsl(var(--border))",
310
+ input: "hsl(var(--input))",
311
+ ring: "hsl(var(--ring))",
312
+ background: "hsl(var(--background))",
313
+ foreground: "hsl(var(--foreground))",
314
+ primary: {
315
+ DEFAULT: "hsl(var(--primary))",
316
+ foreground: "hsl(var(--primary-foreground))"
317
+ },
318
+ secondary: {
319
+ DEFAULT: "hsl(var(--secondary))",
320
+ foreground: "hsl(var(--secondary-foreground))"
321
+ },
322
+ destructive: {
323
+ DEFAULT: "hsl(var(--destructive))",
324
+ foreground: "hsl(var(--destructive-foreground))"
325
+ },
326
+ muted: {
327
+ DEFAULT: "hsl(var(--muted))",
328
+ foreground: "hsl(var(--muted-foreground))"
329
+ },
330
+ accent: {
331
+ DEFAULT: "hsl(var(--accent))",
332
+ foreground: "hsl(var(--accent-foreground))"
333
+ },
334
+ popover: {
335
+ DEFAULT: "hsl(var(--popover))",
336
+ foreground: "hsl(var(--popover-foreground))"
337
+ },
338
+ card: {
339
+ DEFAULT: "hsl(var(--card))",
340
+ foreground: "hsl(var(--card-foreground))"
341
+ }
342
+ },
343
+ borderRadius: {
344
+ lg: "var(--radius)",
345
+ md: "calc(var(--radius) - 2px)",
346
+ sm: "calc(var(--radius) - 4px)"
253
347
  }
254
348
  }
255
349
  },
256
- plugins: []
350
+ plugins: [require("tailwindcss-animate")]
257
351
  };
258
352
  `);
259
353
 
@@ -463,12 +557,62 @@ write("src/index.css", `
463
557
  @tailwind components;
464
558
  @tailwind utilities;
465
559
 
466
- body {
467
- @apply bg-gray-100 text-gray-900;
560
+ @layer base {
561
+ :root {
562
+ --background: 0 0% 100%;
563
+ --foreground: 222.2 84% 4.9%;
564
+ --card: 0 0% 100%;
565
+ --card-foreground: 222.2 84% 4.9%;
566
+ --popover: 0 0% 100%;
567
+ --popover-foreground: 222.2 84% 4.9%;
568
+ --primary: 222.2 47.4% 11.2%;
569
+ --primary-foreground: 210 40% 98%;
570
+ --secondary: 210 40% 96.1%;
571
+ --secondary-foreground: 222.2 47.4% 11.2%;
572
+ --muted: 210 40% 96.1%;
573
+ --muted-foreground: 215.4 16.3% 46.9%;
574
+ --accent: 210 40% 96.1%;
575
+ --accent-foreground: 222.2 47.4% 11.2%;
576
+ --destructive: 0 84.2% 60.2%;
577
+ --destructive-foreground: 210 40% 98%;
578
+ --border: 214.3 31.8% 91.4%;
579
+ --input: 214.3 31.8% 91.4%;
580
+ --ring: 222.2 84% 4.9%;
581
+ --radius: 0.5rem;
582
+ }
583
+ .dark {
584
+ --background: 222.2 84% 4.9%;
585
+ --foreground: 210 40% 98%;
586
+ --card: 222.2 84% 4.9%;
587
+ --card-foreground: 210 40% 98%;
588
+ --popover: 222.2 84% 4.9%;
589
+ --popover-foreground: 210 40% 98%;
590
+ --primary: 210 40% 98%;
591
+ --primary-foreground: 222.2 47.4% 11.2%;
592
+ --secondary: 217.2 32.6% 17.5%;
593
+ --secondary-foreground: 210 40% 98%;
594
+ --muted: 217.2 32.6% 17.5%;
595
+ --muted-foreground: 215 20.2% 65.1%;
596
+ --accent: 217.2 32.6% 17.5%;
597
+ --accent-foreground: 210 40% 98%;
598
+ --destructive: 0 62.8% 30.6%;
599
+ --destructive-foreground: 210 40% 98%;
600
+ --border: 217.2 32.6% 17.5%;
601
+ --input: 217.2 32.6% 17.5%;
602
+ --ring: 212.7 26.8% 83.9%;
603
+ }
468
604
  }
469
605
 
470
- h1, h2, h3, h4 {
471
- @apply font-semibold;
606
+ @layer base {
607
+ * {
608
+ @apply border-border;
609
+ }
610
+ body {
611
+ @apply bg-background text-foreground;
612
+ }
613
+ h1, h2, h3, h4 {
614
+ @apply font-semibold;
615
+ }
472
616
  }
473
617
  `);
474
618
 
@@ -491,6 +635,20 @@ ReactDOM.createRoot(document.getElementById("root")).render(
491
635
  );
492
636
  `);
493
637
 
638
+ write("src/lib/utils.js", `
639
+ import { clsx } from "clsx";
640
+ import { twMerge } from "tailwind-merge";
641
+
642
+ /**
643
+ * Merges Tailwind CSS classes with clsx + tailwind-merge.
644
+ * @param {...import('clsx').ClassValue} inputs
645
+ * @returns {string}
646
+ */
647
+ export function cn(...inputs) {
648
+ return twMerge(clsx(inputs));
649
+ }
650
+ `);
651
+
494
652
  write("src/index.js", `
495
653
  export { default as Button } from "./components/ui/Button.jsx";
496
654
  export { default as Card } from "./components/ui/Card.jsx";
@@ -1281,6 +1439,7 @@ if (fs.existsSync(bdpaImagePath)) {
1281
1439
 
1282
1440
  if (doInstall) {
1283
1441
  installDependencies(packageManager, BASE_DIR);
1442
+ installShadcn(BASE_DIR);
1284
1443
  }
1285
1444
 
1286
1445
  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.7",
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"