boardui 0.5.7 → 0.5.9
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/README.md +35 -3
- package/dist/index.js +142 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,12 +32,19 @@ always-on design rules for AI agents (semantic tokens, type scale,
|
|
|
32
32
|
conventions) as a fenced section in `AGENTS.md` plus a Cursor rule at
|
|
33
33
|
`.cursor/rules/boardui.mdc` — MCP context is on-demand, these are not.
|
|
34
34
|
|
|
35
|
+
Tailwind v4 needs something to compile it. When the project already has an
|
|
36
|
+
integration (create-next-app 16.4+ ships `@tailwindcss/turbopack`, Vite
|
|
37
|
+
templates `@tailwindcss/vite`, or a PostCSS config loads `@tailwindcss/postcss`),
|
|
38
|
+
`init` leaves PostCSS alone. Otherwise it installs `@tailwindcss/postcss` and
|
|
39
|
+
prints the `postcss.config.mjs` line. `--postcss` sets PostCSS up regardless.
|
|
40
|
+
|
|
35
41
|
| Option | Description |
|
|
36
42
|
| --- | --- |
|
|
37
|
-
| `-y, --yes` | Skip confirmation
|
|
43
|
+
| `-y, --yes` | Skip the confirmation prompt (use it in CI, scripts and coding agents) |
|
|
38
44
|
| `-o, --overwrite` | Overwrite existing files |
|
|
39
45
|
| `-d, --dir <dir>` | Target directory (defaults to the project source root) |
|
|
40
46
|
| `--pro` | Also install dependencies used by BoardUI Pro components |
|
|
47
|
+
| `--postcss` | Set up `@tailwindcss/postcss` even when Tailwind already compiles another way |
|
|
41
48
|
|
|
42
49
|
### `add [components...]`
|
|
43
50
|
|
|
@@ -52,7 +59,23 @@ an interactive picker.
|
|
|
52
59
|
| `-p, --path <path>` | Custom directory to write files into |
|
|
53
60
|
| `-d, --dir <dir>` | Target directory (defaults to the project source root) |
|
|
54
61
|
| `-o, --overwrite` | Overwrite existing files |
|
|
55
|
-
| `-y, --yes` | Skip prompts
|
|
62
|
+
| `-y, --yes` | Skip prompts: keep existing files, install deps (use it in CI, scripts and coding agents) |
|
|
63
|
+
|
|
64
|
+
### CI, scripts, and coding agents
|
|
65
|
+
|
|
66
|
+
`init` and `add` ask before they install packages or touch files that already
|
|
67
|
+
exist. Without a terminal to answer (CI, a script, a coding agent's shell),
|
|
68
|
+
they stop with exit code 1 and name the flag to use instead of guessing:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npx boardui@latest init --yes
|
|
72
|
+
npx boardui@latest add button select --yes
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`--yes` accepts the defaults: install the dependencies and keep existing
|
|
76
|
+
files. Add `--overwrite` to replace existing files, and name the components or
|
|
77
|
+
pass `--all` instead of using the interactive picker. A run that has nothing
|
|
78
|
+
to ask (no existing files, every dependency installed) needs no flag.
|
|
56
79
|
|
|
57
80
|
### `list`
|
|
58
81
|
|
|
@@ -80,7 +103,9 @@ tagged with `source: "mcp"`.
|
|
|
80
103
|
|
|
81
104
|
Activates a BoardUI Pro license for this machine and stores the license and
|
|
82
105
|
Lemon Squeezy instance ID in the operating system's user config directory. If
|
|
83
|
-
the key is omitted, the CLI prompts for it.
|
|
106
|
+
the key is omitted, the CLI prompts for it. Without a terminal to type it into,
|
|
107
|
+
`login` stops with exit code 1 instead: pass the key as an argument, or in CI
|
|
108
|
+
skip `login` and set `BOARDUI_LICENSE_KEY`.
|
|
84
109
|
|
|
85
110
|
Use the literal key from the Lemon Squeezy receipt without angle brackets:
|
|
86
111
|
|
|
@@ -222,6 +247,13 @@ The daily buckets do not expire automatically.
|
|
|
222
247
|
`package.json` and `package-lock.json` stay in sync. The CLI reads its
|
|
223
248
|
displayed and telemetry version from `package.json` at runtime.
|
|
224
249
|
2. `cd cli && npm install && npm run build`
|
|
250
|
+
The build embeds the public PostHog project token for MCP analytics. It
|
|
251
|
+
reads the repo's `.env` / `.env.local`, then `cli/.env` / `cli/.env.local`,
|
|
252
|
+
then the build environment (highest priority). Set `POSTHOG_PROJECT_TOKEN`
|
|
253
|
+
and optionally `POSTHOG_HOST`, or use the site's
|
|
254
|
+
`NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN` / `NEXT_PUBLIC_POSTHOG_HOST`. A missing
|
|
255
|
+
or invalid project token fails the build instead of silently disabling
|
|
256
|
+
analytics in every customer's MCP server. Never use a personal API key.
|
|
225
257
|
3. Smoke test: `node dist/index.js list`
|
|
226
258
|
4. `npm publish`
|
|
227
259
|
|
package/dist/index.js
CHANGED
|
@@ -161,6 +161,36 @@ function installCommand(pm, packages) {
|
|
|
161
161
|
return ["npm", "install", ...packages];
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
+
var BUNDLER_TAILWIND = ["@tailwindcss/turbopack", "@tailwindcss/vite", "@tailwindcss/webpack"];
|
|
165
|
+
var POSTCSS_CONFIGS = [
|
|
166
|
+
"postcss.config.mjs",
|
|
167
|
+
"postcss.config.js",
|
|
168
|
+
"postcss.config.cjs",
|
|
169
|
+
"postcss.config.ts",
|
|
170
|
+
"postcss.config.mts",
|
|
171
|
+
"postcss.config.cts",
|
|
172
|
+
".postcssrc",
|
|
173
|
+
".postcssrc.json",
|
|
174
|
+
".postcssrc.js",
|
|
175
|
+
".postcssrc.cjs",
|
|
176
|
+
".postcssrc.mjs",
|
|
177
|
+
".postcssrc.yml",
|
|
178
|
+
".postcssrc.yaml"
|
|
179
|
+
];
|
|
180
|
+
function detectTailwindCompiler(cwd, installed) {
|
|
181
|
+
const bundler = BUNDLER_TAILWIND.find((pkg) => installed.has(pkg));
|
|
182
|
+
if (bundler) return bundler;
|
|
183
|
+
for (const name of POSTCSS_CONFIGS) {
|
|
184
|
+
const file = path3.join(cwd, name);
|
|
185
|
+
try {
|
|
186
|
+
if (existsSync2(file) && readFileSync2(file, "utf8").includes("@tailwindcss/postcss")) {
|
|
187
|
+
return "@tailwindcss/postcss";
|
|
188
|
+
}
|
|
189
|
+
} catch {
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return void 0;
|
|
193
|
+
}
|
|
164
194
|
function parseJsonc(raw) {
|
|
165
195
|
let out = "";
|
|
166
196
|
let i = 0;
|
|
@@ -239,6 +269,7 @@ function readProject(cwd) {
|
|
|
239
269
|
config,
|
|
240
270
|
packageManager: detectPackageManager(cwd, Boolean(config)),
|
|
241
271
|
isNextJs: installedDependencies.has("next"),
|
|
272
|
+
tailwindCompiler: detectTailwindCompiler(cwd, installedDependencies),
|
|
242
273
|
hasAtAlias,
|
|
243
274
|
usesSrcDir,
|
|
244
275
|
installedDependencies,
|
|
@@ -504,6 +535,14 @@ async function resolveItems(names) {
|
|
|
504
535
|
// src/lib/installer.ts
|
|
505
536
|
var RUNTIME_DEPS = ["react-aria-components", "tailwind-merge", "@remixicon/react"];
|
|
506
537
|
var DEV_DEPS = ["tailwindcss", "@tailwindcss/postcss"];
|
|
538
|
+
var POSTCSS_PLUGIN = "@tailwindcss/postcss";
|
|
539
|
+
function tailwindDevDeps(project, postcss = false) {
|
|
540
|
+
const withPlugin = postcss || !project.tailwindCompiler;
|
|
541
|
+
return DEV_DEPS.filter((pkg) => withPlugin || pkg !== POSTCSS_PLUGIN);
|
|
542
|
+
}
|
|
543
|
+
function needsPostcssStep(project, postcss = false) {
|
|
544
|
+
return project.tailwindCompiler !== POSTCSS_PLUGIN && (postcss || !project.tailwindCompiler);
|
|
545
|
+
}
|
|
507
546
|
var PRO_DEPS = ["recharts", "motion", "prism-react-renderer", "@internationalized/date"];
|
|
508
547
|
var INIT_ITEMS = ["globals", "cx", "use-dismiss-on-outside-press", "rules"];
|
|
509
548
|
var RULES_ITEM_NAME = "rules";
|
|
@@ -741,6 +780,14 @@ async function trackAddSuccess({
|
|
|
741
780
|
});
|
|
742
781
|
}
|
|
743
782
|
|
|
783
|
+
// src/lib/terminal.ts
|
|
784
|
+
function canPrompt() {
|
|
785
|
+
return Boolean(process.stdin.isTTY);
|
|
786
|
+
}
|
|
787
|
+
function requireTerminal(message) {
|
|
788
|
+
if (!canPrompt()) throw new Error(message);
|
|
789
|
+
}
|
|
790
|
+
|
|
744
791
|
// src/commands/add.ts
|
|
745
792
|
var TYPE_LABEL = {
|
|
746
793
|
base: "Base components",
|
|
@@ -788,6 +835,9 @@ async function add(components, options) {
|
|
|
788
835
|
const index = await fetchRegistryIndex();
|
|
789
836
|
names = index.items.map((item) => item.name);
|
|
790
837
|
} else if (names.length === 0) {
|
|
838
|
+
requireTerminal(
|
|
839
|
+
"boardui add was given no component names, and the interactive picker needs a terminal.\nName the components (for example `npx boardui add button select`) or pass --all."
|
|
840
|
+
);
|
|
791
841
|
names = await pickComponents();
|
|
792
842
|
}
|
|
793
843
|
if (names.length === 0) {
|
|
@@ -810,8 +860,23 @@ async function add(components, options) {
|
|
|
810
860
|
const targetRoot = options.path ? path7.resolve(process.cwd(), options.path) : options.dir ? path7.resolve(process.cwd(), options.dir) : sourceRoot(project);
|
|
811
861
|
const writes = collectWrites(items, targetRoot, project.cwd, project.config);
|
|
812
862
|
const conflicts = writes.filter((w) => w.exists);
|
|
863
|
+
const wanted = missingDependencies(items, project);
|
|
864
|
+
const missingDev = tailwindDevDeps(project).filter((pkg) => !project.installedDependencies.has(pkg));
|
|
865
|
+
for (const pkg of missingDev) wanted.set(pkg, pkg);
|
|
866
|
+
const asksAboutFiles = conflicts.length > 0 && !options.overwrite && !options.yes;
|
|
867
|
+
const asksToInstall = wanted.size > 0 && !options.yes;
|
|
868
|
+
if (asksAboutFiles || asksToInstall) {
|
|
869
|
+
requireTerminal(
|
|
870
|
+
[
|
|
871
|
+
"boardui add needs answers, and no terminal is attached to give them:",
|
|
872
|
+
...asksAboutFiles ? [` - ${conflicts.length} file${conflicts.length === 1 ? " already exists" : "s already exist"}: keep or overwrite?`] : [],
|
|
873
|
+
...asksToInstall ? [` - install ${[...wanted.keys()].join(", ")}?`] : [],
|
|
874
|
+
"Re-run with --yes to keep existing files and install the dependencies. Add --overwrite to replace existing files instead."
|
|
875
|
+
].join("\n")
|
|
876
|
+
);
|
|
877
|
+
}
|
|
813
878
|
let overwrite = Boolean(options.overwrite);
|
|
814
|
-
if (
|
|
879
|
+
if (asksAboutFiles) {
|
|
815
880
|
console.log(pc.yellow(`
|
|
816
881
|
The following files already exist:`));
|
|
817
882
|
for (const c of conflicts) console.log(` ${c.relPath}`);
|
|
@@ -852,13 +917,10 @@ The following files already exist:`));
|
|
|
852
917
|
);
|
|
853
918
|
}
|
|
854
919
|
}
|
|
855
|
-
const wanted = missingDependencies(items, project);
|
|
856
|
-
const missingDev = DEV_DEPS.filter((pkg) => !project.installedDependencies.has(pkg));
|
|
857
|
-
for (const pkg of missingDev) wanted.set(pkg, pkg);
|
|
858
920
|
if (wanted.size > 0) {
|
|
859
921
|
const packages = [...wanted.values()];
|
|
860
922
|
let install = true;
|
|
861
|
-
if (
|
|
923
|
+
if (asksToInstall) {
|
|
862
924
|
const { confirmed } = await prompts({
|
|
863
925
|
type: "confirm",
|
|
864
926
|
name: "confirmed",
|
|
@@ -890,7 +952,7 @@ The following files already exist:`));
|
|
|
890
952
|
)
|
|
891
953
|
);
|
|
892
954
|
}
|
|
893
|
-
if (missingDev.
|
|
955
|
+
if (missingDev.includes(POSTCSS_PLUGIN)) {
|
|
894
956
|
console.log(
|
|
895
957
|
`
|
|
896
958
|
${pc.bold("Note:")} Tailwind was installed. Make sure a ${pc.cyan("postcss.config.mjs")} loads ${pc.cyan("@tailwindcss/postcss")}, or run ${pc.cyan("npx boardui init")} to set the project up.`
|
|
@@ -940,6 +1002,9 @@ async function init(options) {
|
|
|
940
1002
|
);
|
|
941
1003
|
}
|
|
942
1004
|
if (!options.yes) {
|
|
1005
|
+
requireTerminal(
|
|
1006
|
+
"boardui init asks for confirmation, and no terminal is attached to answer it.\nRe-run with --yes to install the dependencies and write styles/ and utils/ (existing files are kept)."
|
|
1007
|
+
);
|
|
943
1008
|
const { confirmed } = await prompts2({
|
|
944
1009
|
type: "confirm",
|
|
945
1010
|
name: "confirmed",
|
|
@@ -953,7 +1018,9 @@ async function init(options) {
|
|
|
953
1018
|
}
|
|
954
1019
|
const runtimeDeps = options.pro ? [...RUNTIME_DEPS, ...PRO_DEPS] : RUNTIME_DEPS;
|
|
955
1020
|
const missingRuntime = runtimeDeps.filter((pkg) => !project.installedDependencies.has(pkg));
|
|
956
|
-
const missingDev =
|
|
1021
|
+
const missingDev = tailwindDevDeps(project, options.postcss).filter(
|
|
1022
|
+
(pkg) => !project.installedDependencies.has(pkg)
|
|
1023
|
+
);
|
|
957
1024
|
const missing = [...missingRuntime, ...missingDev];
|
|
958
1025
|
let dependenciesReady = true;
|
|
959
1026
|
if (missing.length > 0) {
|
|
@@ -969,6 +1036,13 @@ async function init(options) {
|
|
|
969
1036
|
} else {
|
|
970
1037
|
console.log(pc2.dim("All required dependencies already installed."));
|
|
971
1038
|
}
|
|
1039
|
+
if (project.tailwindCompiler && project.tailwindCompiler !== POSTCSS_PLUGIN && !options.postcss) {
|
|
1040
|
+
console.log(
|
|
1041
|
+
pc2.dim(
|
|
1042
|
+
`Tailwind v4 already compiles through ${project.tailwindCompiler}, so PostCSS is left alone (add --postcss to set it up anyway).`
|
|
1043
|
+
)
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
972
1046
|
const spinner = ora2("Fetching BoardUI foundations...").start();
|
|
973
1047
|
let items;
|
|
974
1048
|
try {
|
|
@@ -995,24 +1069,38 @@ async function init(options) {
|
|
|
995
1069
|
packageManager: project.packageManager,
|
|
996
1070
|
pro: Boolean(options.pro)
|
|
997
1071
|
}) : Promise.resolve();
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
1. Import the BoardUI stylesheet in your root layout (app/layout.tsx):
|
|
1072
|
+
const steps = [
|
|
1073
|
+
`Import the BoardUI stylesheet in your root layout (app/layout.tsx):
|
|
1002
1074
|
|
|
1003
1075
|
${pc2.cyan(`import "${mappedImport("@/styles/globals.css", project.config)}";`)}
|
|
1004
1076
|
|
|
1005
1077
|
${pc2.dim(`(replaces the default create-next-app "./globals.css" import;`)}
|
|
1006
|
-
${pc2.dim(`in a shared UI package, import the exported stylesheet in each consuming app)`)}
|
|
1078
|
+
${pc2.dim(`in a shared UI package, import the exported stylesheet in each consuming app)`)}`,
|
|
1079
|
+
// theme.css builds --font-sans from --font-inter on :root, so the
|
|
1080
|
+
// variable belongs on <html>. Without it the page renders in the system font.
|
|
1081
|
+
project.isNextJs ? `Load Inter in the same layout. The theme reads its typeface from --font-inter:
|
|
1007
1082
|
|
|
1008
|
-
|
|
1083
|
+
${pc2.cyan('import { Inter } from "next/font/google";')}
|
|
1084
|
+
${pc2.cyan('const inter = Inter({ variable: "--font-inter", subsets: ["latin"], axes: ["opsz"] });')}
|
|
1085
|
+
${pc2.cyan('<html lang="en" className={`${inter.variable} h-full antialiased`}>')}
|
|
1009
1086
|
|
|
1010
|
-
|
|
1087
|
+
${pc2.dim("(on <html>, in place of create-next-app's Geist fonts; without it, text falls back to the system font)")}` : `Load Inter and set ${pc2.cyan("--font-inter")} to its font family on :root.
|
|
1088
|
+
${pc2.dim("(the theme reads its typeface from it; without it, text falls back to the system font)")}`,
|
|
1089
|
+
...needsPostcssStep(project, options.postcss) ? [
|
|
1090
|
+
`Make sure PostCSS uses Tailwind v4 (postcss.config.mjs):
|
|
1011
1091
|
|
|
1012
|
-
|
|
1092
|
+
${pc2.cyan(`export default { plugins: { "@tailwindcss/postcss": {} } };`)}`
|
|
1093
|
+
] : [],
|
|
1094
|
+
`Add components:
|
|
1013
1095
|
|
|
1014
|
-
${pc2.cyan("npx boardui add button select date-picker")}
|
|
1015
|
-
|
|
1096
|
+
${pc2.cyan("npx boardui add button select date-picker")}`
|
|
1097
|
+
];
|
|
1098
|
+
console.log(
|
|
1099
|
+
`
|
|
1100
|
+
${pc2.bold("Almost done \u2014 wire up the styles:")}
|
|
1101
|
+
|
|
1102
|
+
` + steps.map((step, index) => ` ${index + 1}. ${step}`).join("\n\n") + "\n"
|
|
1103
|
+
);
|
|
1016
1104
|
await telemetry;
|
|
1017
1105
|
if (dependenciesReady && isTelemetryEnabled()) {
|
|
1018
1106
|
console.log(
|
|
@@ -1053,6 +1141,9 @@ import prompts3 from "prompts";
|
|
|
1053
1141
|
async function login(key) {
|
|
1054
1142
|
let licenseKey = key?.trim();
|
|
1055
1143
|
if (!licenseKey) {
|
|
1144
|
+
requireTerminal(
|
|
1145
|
+
"boardui login asks for your license key, and no terminal is attached to type it.\nPass the key as an argument (npx boardui login YOUR_LICENSE_KEY), or in CI skip login and set BOARDUI_LICENSE_KEY."
|
|
1146
|
+
);
|
|
1056
1147
|
const answer = await prompts3({
|
|
1057
1148
|
type: "password",
|
|
1058
1149
|
name: "key",
|
|
@@ -1142,9 +1233,6 @@ Monorepos/custom aliases: put boardui.json next to the destination package's pac
|
|
|
1142
1233
|
Agent skill: BoardUI also ships an agent skill (SKILL.md open standard) carrying deeper always-loaded knowledge \u2014 the full component catalog, theming, page patterns, and the motion language. get_skill answers questions about it (returns SKILL.md and the file list); install_skill writes it into the project's .claude/skills/boardui. For other destinations, relay the CLI: npx boardui@latest skill (project), --global (~/.claude/skills), --client codex (~/.agents/skills, read by Codex and Gemini), --path <dir> (anywhere), --force (update). Docs: https://www.boardui.com/skill
|
|
1143
1234
|
|
|
1144
1235
|
Pro: items marked PRO require a one-time BoardUI Pro license (${PRICING_URL}, lifetime updates). If the user wants a pro item and no license is active, relay the pricing link \u2014 and if they already purchased, ask them for the license key from their purchase email, then call activate_license with it. After that, pro installs work like free ones.`;
|
|
1145
|
-
var posthog = new PostHog("", {
|
|
1146
|
-
host: "https://eu.i.posthog.com"
|
|
1147
|
-
});
|
|
1148
1236
|
var freeIndexPromise = null;
|
|
1149
1237
|
var proIndexPromise = null;
|
|
1150
1238
|
function freeIndex() {
|
|
@@ -1362,7 +1450,25 @@ async function mcp() {
|
|
|
1362
1450
|
{ name: "boardui", version: CLI_VERSION },
|
|
1363
1451
|
{ instructions: INSTRUCTIONS }
|
|
1364
1452
|
);
|
|
1365
|
-
|
|
1453
|
+
const token = "phc_Cp49ooHFujriAf92MgJgj2spJZ2kyBrJC2uUN8wDRqSV"?.trim();
|
|
1454
|
+
const posthog = isTelemetryEnabled() && token ? new PostHog(token, {
|
|
1455
|
+
host: "https://eu.i.posthog.com",
|
|
1456
|
+
// Tool calls are infrequent; do not leave a short session's only call
|
|
1457
|
+
// waiting for the default batch threshold / five-second timer.
|
|
1458
|
+
flushAt: 1,
|
|
1459
|
+
flushInterval: 1e3
|
|
1460
|
+
}) : null;
|
|
1461
|
+
if (posthog) {
|
|
1462
|
+
posthog.on("error", () => console.error("[mcp-analytics] PostHog delivery failed."));
|
|
1463
|
+
instrument(server, posthog, {
|
|
1464
|
+
eventProperties: () => ({ $mcp_transport: "stdio" }),
|
|
1465
|
+
logger: (message) => {
|
|
1466
|
+
if (/warning|failed/i.test(message)) console.error(`[mcp-analytics] ${message}`);
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1469
|
+
} else if (isTelemetryEnabled()) {
|
|
1470
|
+
console.error("[mcp-analytics] PostHog project token is missing; MCP analytics is disabled.");
|
|
1471
|
+
}
|
|
1366
1472
|
server.registerTool(
|
|
1367
1473
|
"get_started",
|
|
1368
1474
|
{
|
|
@@ -1633,6 +1739,7 @@ NOT installed \u2014 pro fetch failed for ${proFailure.names.join(", ")}: ${proF
|
|
|
1633
1739
|
inputSchema: {
|
|
1634
1740
|
pro: z.boolean().optional().describe("Also install the deps BoardUI Pro components use \u2014 recharts, motion, ... (default false)."),
|
|
1635
1741
|
overwrite: z.boolean().optional().describe("Overwrite existing style/util files (default false: skip them)."),
|
|
1742
|
+
postcss: z.boolean().optional().describe("Set up @tailwindcss/postcss even when Tailwind v4 already compiles another way, e.g. create-next-app 16.4+'s @tailwindcss/turbopack (default false: only when nothing compiles Tailwind yet)."),
|
|
1636
1743
|
projectDir: z.string().optional().describe("Absolute path of the project root; defaults to the server's working directory.")
|
|
1637
1744
|
},
|
|
1638
1745
|
annotations: { destructiveHint: false }
|
|
@@ -1641,12 +1748,13 @@ NOT installed \u2014 pro fetch failed for ${proFailure.names.join(", ")}: ${proF
|
|
|
1641
1748
|
async ({
|
|
1642
1749
|
pro = false,
|
|
1643
1750
|
overwrite = false,
|
|
1751
|
+
postcss = false,
|
|
1644
1752
|
projectDir
|
|
1645
1753
|
}) => {
|
|
1646
1754
|
const project = loadProject(projectDir);
|
|
1647
1755
|
const runtimeDeps = pro ? [...RUNTIME_DEPS, ...PRO_DEPS] : RUNTIME_DEPS;
|
|
1648
1756
|
const missing = new Map(
|
|
1649
|
-
[...runtimeDeps, ...
|
|
1757
|
+
[...runtimeDeps, ...tailwindDevDeps(project, postcss)].filter((pkg) => !project.installedDependencies.has(pkg)).map((pkg) => [pkg, pkg])
|
|
1650
1758
|
);
|
|
1651
1759
|
const deps = await installMissingDependencies(project, missing);
|
|
1652
1760
|
const items = await resolveItems(INIT_ITEMS);
|
|
@@ -1671,6 +1779,7 @@ NOT installed \u2014 pro fetch failed for ${proFailure.names.join(", ")}: ${proF
|
|
|
1671
1779
|
],
|
|
1672
1780
|
"",
|
|
1673
1781
|
formatDependencyOutcome(project, missing, true, deps),
|
|
1782
|
+
...project.tailwindCompiler && project.tailwindCompiler !== POSTCSS_PLUGIN && !postcss ? [`Tailwind v4 already compiles through ${project.tailwindCompiler}, so PostCSS is left alone (pass postcss: true to set it up anyway).`] : [],
|
|
1674
1783
|
"",
|
|
1675
1784
|
...report.created.map((relPath) => ` created ${relPath}`),
|
|
1676
1785
|
...report.overwritten.map((relPath) => ` overwrote ${relPath}`),
|
|
@@ -1678,9 +1787,14 @@ NOT installed \u2014 pro fetch failed for ${proFailure.names.join(", ")}: ${proF
|
|
|
1678
1787
|
...rulesLines.length ? ["", ...rulesLines] : [],
|
|
1679
1788
|
"",
|
|
1680
1789
|
"Finish the wiring:",
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1790
|
+
...[
|
|
1791
|
+
`Import the BoardUI stylesheet in the consuming app's root layout: import "${mappedImport("@/styles/globals.css", project.config)}"; \u2014 replacing the default create-next-app "./globals.css" import.`,
|
|
1792
|
+
// theme.css builds --font-sans from --font-inter on :root, so the
|
|
1793
|
+
// variable belongs on <html>; without it the page renders in the system font.
|
|
1794
|
+
project.isNextJs ? 'Load Inter in the same layout, because the theme reads its typeface from --font-inter: import { Inter } from "next/font/google"; const inter = Inter({ variable: "--font-inter", subsets: ["latin"], axes: ["opsz"] }); then put inter.variable on <html> (className={`${inter.variable} h-full antialiased`}) in place of create-next-app\'s Geist fonts. Without it, text falls back to the system font.' : "Load Inter and set --font-inter to its font family on :root. The theme reads its typeface from it; without it, text falls back to the system font.",
|
|
1795
|
+
...needsPostcssStep(project, postcss) ? ['Make sure PostCSS uses Tailwind v4 (postcss.config.mjs): export default { plugins: { "@tailwindcss/postcss": {} } };'] : [],
|
|
1796
|
+
'Install components with install_components, e.g. ["button", "select", "date-picker"].'
|
|
1797
|
+
].map((step, index) => `${index + 1}. ${step}`),
|
|
1684
1798
|
"",
|
|
1685
1799
|
mappedDocumentation(RTL_SETUP_GUIDE, project.config),
|
|
1686
1800
|
...staleStylesheet ? [
|
|
@@ -1881,7 +1995,7 @@ ${skillMd}`
|
|
|
1881
1995
|
})
|
|
1882
1996
|
);
|
|
1883
1997
|
process.on("SIGTERM", async () => {
|
|
1884
|
-
await posthog
|
|
1998
|
+
await posthog?.shutdown();
|
|
1885
1999
|
process.exit(0);
|
|
1886
2000
|
});
|
|
1887
2001
|
await server.connect(new StdioServerTransport());
|
|
@@ -1952,10 +2066,10 @@ ${pc5.dim("Update any time: npx boardui@latest skill --force")}`
|
|
|
1952
2066
|
// src/index.ts
|
|
1953
2067
|
var program = new Command();
|
|
1954
2068
|
program.name("boardui").description("Add BoardUI components to your project.").version(CLI_VERSION, "-v, --version");
|
|
1955
|
-
program.command("init").description("Set up BoardUI in an existing Next.js project (deps, theme, utils).").option("-y, --yes", "skip confirmation
|
|
2069
|
+
program.command("init").description("Set up BoardUI in an existing Next.js project (deps, theme, utils).").option("-y, --yes", "skip the confirmation prompt (use it in CI, scripts and coding agents)").option("-o, --overwrite", "overwrite existing files").option("-d, --dir <dir>", "target directory (defaults to the project source root)").option("--pro", "also install the deps BoardUI Pro components use (recharts, motion, ...)").option("--postcss", "set up @tailwindcss/postcss even when Tailwind already compiles another way (e.g. @tailwindcss/turbopack)").action(async (options) => {
|
|
1956
2070
|
await init(options);
|
|
1957
2071
|
});
|
|
1958
|
-
program.command("add").description("Add components to your project.").argument("[components...]", "component names (run `boardui list` to see them)").option("-a, --all", "add every component in the registry").option("-p, --path <path>", "custom directory to write component files into").option("-d, --dir <dir>", "target directory (defaults to the project source root)").option("-o, --overwrite", "overwrite existing files").option("-y, --yes", "skip prompts
|
|
2072
|
+
program.command("add").description("Add components to your project.").argument("[components...]", "component names (run `boardui list` to see them)").option("-a, --all", "add every component in the registry").option("-p, --path <path>", "custom directory to write component files into").option("-d, --dir <dir>", "target directory (defaults to the project source root)").option("-o, --overwrite", "overwrite existing files").option("-y, --yes", "skip prompts: keep existing files, install deps (use it in CI, scripts and coding agents)").action(async (components, options) => {
|
|
1959
2073
|
await add(components, options);
|
|
1960
2074
|
});
|
|
1961
2075
|
program.command("list").description("List all available components.").action(async () => {
|