create-bdpa-react-scaffold 1.8.2 → 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.
- package/create-ui-lib.js +200 -9
- package/package.json +6 -4
package/create-ui-lib.js
CHANGED
|
@@ -58,6 +58,61 @@ 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
|
+
|
|
78
|
+
function installVSCodeExtensions() {
|
|
79
|
+
const extensions = [
|
|
80
|
+
"dsznajder.es7-react-js-snippets",
|
|
81
|
+
"bradlc.vscode-tailwindcss",
|
|
82
|
+
"dbaeumer.vscode-eslint",
|
|
83
|
+
"esbenp.prettier-vscode",
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
const isWin = process.platform === "win32";
|
|
87
|
+
const codeCmd = isWin ? "code.cmd" : "code";
|
|
88
|
+
|
|
89
|
+
// Check if `code` CLI is available
|
|
90
|
+
const check = spawnSync(codeCmd, ["--version"], { stdio: "pipe" });
|
|
91
|
+
if (check.status !== 0 || check.error) {
|
|
92
|
+
console.warn(
|
|
93
|
+
"\n⚠️ VS Code CLI not found — skipping Intellisense extension installs."
|
|
94
|
+
);
|
|
95
|
+
console.warn(
|
|
96
|
+
" Install manually: code --install-extension <id>\n"
|
|
97
|
+
);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
console.log("\n🧩 Installing VS Code Intellisense extensions...");
|
|
102
|
+
for (const ext of extensions) {
|
|
103
|
+
console.log(` Installing ${ext}...`);
|
|
104
|
+
const result = spawnSync(codeCmd, ["--install-extension", ext], {
|
|
105
|
+
stdio: "inherit",
|
|
106
|
+
});
|
|
107
|
+
if (result.status !== 0) {
|
|
108
|
+
console.warn(` ⚠️ Failed to install ${ext} (exit ${result.status})`);
|
|
109
|
+
} else {
|
|
110
|
+
console.log(` ✔ ${ext}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
console.log("");
|
|
114
|
+
}
|
|
115
|
+
|
|
61
116
|
function installDependencies(pm, cwd) {
|
|
62
117
|
const isWin = process.platform === "win32";
|
|
63
118
|
const pmCmd = pm === "yarn" ? "yarn" : pm === "pnpm" ? "pnpm" : "npm";
|
|
@@ -104,7 +159,10 @@ write("package.json", `
|
|
|
104
159
|
"react-dom": "^18.2.0",
|
|
105
160
|
"react-router-dom": "^6.20.0",
|
|
106
161
|
"lucide-react": "^0.344.0",
|
|
107
|
-
"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"
|
|
108
166
|
},
|
|
109
167
|
"devDependencies": {
|
|
110
168
|
"@types/react": "^18.2.0",
|
|
@@ -113,6 +171,7 @@ write("package.json", `
|
|
|
113
171
|
"autoprefixer": "^10.4.20",
|
|
114
172
|
"postcss": "^8.4.47",
|
|
115
173
|
"tailwindcss": "^3.4.0",
|
|
174
|
+
"tailwindcss-animate": "^1.0.7",
|
|
116
175
|
"vite": "^5.0.0"
|
|
117
176
|
}
|
|
118
177
|
}
|
|
@@ -125,6 +184,7 @@ write("jsconfig.json", `
|
|
|
125
184
|
"module": "ESNext",
|
|
126
185
|
"moduleResolution": "bundler",
|
|
127
186
|
"jsx": "react-jsx",
|
|
187
|
+
"checkJs": true,
|
|
128
188
|
"strict": false,
|
|
129
189
|
"allowSyntheticDefaultImports": true,
|
|
130
190
|
"esModuleInterop": true,
|
|
@@ -139,6 +199,29 @@ write("jsconfig.json", `
|
|
|
139
199
|
}
|
|
140
200
|
`);
|
|
141
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
|
+
|
|
142
225
|
write(".vscode/extensions.json", `
|
|
143
226
|
{
|
|
144
227
|
"recommendations": [
|
|
@@ -203,6 +286,7 @@ module.exports = {
|
|
|
203
286
|
|
|
204
287
|
write("tailwind.config.cjs", `
|
|
205
288
|
module.exports = {
|
|
289
|
+
darkMode: ["class"],
|
|
206
290
|
content: [
|
|
207
291
|
"./index.html",
|
|
208
292
|
"./src/**/*.{js,jsx,ts,tsx}"
|
|
@@ -211,11 +295,49 @@ module.exports = {
|
|
|
211
295
|
extend: {
|
|
212
296
|
colors: {
|
|
213
297
|
milwaukeeBlue: "#2563eb",
|
|
214
|
-
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)"
|
|
215
337
|
}
|
|
216
338
|
}
|
|
217
339
|
},
|
|
218
|
-
plugins: []
|
|
340
|
+
plugins: [require("tailwindcss-animate")]
|
|
219
341
|
};
|
|
220
342
|
`);
|
|
221
343
|
|
|
@@ -425,12 +547,62 @@ write("src/index.css", `
|
|
|
425
547
|
@tailwind components;
|
|
426
548
|
@tailwind utilities;
|
|
427
549
|
|
|
428
|
-
|
|
429
|
-
|
|
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
|
+
}
|
|
430
594
|
}
|
|
431
595
|
|
|
432
|
-
|
|
433
|
-
|
|
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
|
+
}
|
|
434
606
|
}
|
|
435
607
|
`);
|
|
436
608
|
|
|
@@ -453,6 +625,20 @@ ReactDOM.createRoot(document.getElementById("root")).render(
|
|
|
453
625
|
);
|
|
454
626
|
`);
|
|
455
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
|
+
|
|
456
642
|
write("src/index.js", `
|
|
457
643
|
export { default as Button } from "./components/ui/Button.jsx";
|
|
458
644
|
export { default as Card } from "./components/ui/Card.jsx";
|
|
@@ -1243,8 +1429,13 @@ if (fs.existsSync(bdpaImagePath)) {
|
|
|
1243
1429
|
|
|
1244
1430
|
if (doInstall) {
|
|
1245
1431
|
installDependencies(packageManager, BASE_DIR);
|
|
1246
|
-
|
|
1247
|
-
|
|
1432
|
+
installShadcn(BASE_DIR);
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
installVSCodeExtensions();
|
|
1436
|
+
|
|
1437
|
+
if (!doInstall) {
|
|
1438
|
+
console.log("\nℹ️ Skipping npm install (flag --no-install). Run manually later.");
|
|
1248
1439
|
}
|
|
1249
1440
|
|
|
1250
1441
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-bdpa-react-scaffold",
|
|
3
|
-
"version": "1.8.
|
|
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": "
|
|
6
|
+
"create-bdpa-react-scaffold": "create-ui-lib.js"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
9
|
"create-ui-lib.js",
|
|
@@ -32,7 +32,9 @@
|
|
|
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('
|
|
36
|
-
"
|
|
35
|
+
"prepublishOnly": "node -e \"require('fs').accessSync('create-ui-lib.js');\"",
|
|
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
|
+
"test": "npm run install:extensions",
|
|
38
|
+
"publish:public": "npm run install:extensions && npm publish --access public"
|
|
37
39
|
}
|
|
38
40
|
}
|