boardui 0.1.0 → 0.2.1
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 +22 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -253,14 +253,29 @@ async function add(components, options) {
|
|
|
253
253
|
`Resolved ${items.length} item${items.length === 1 ? "" : "s"}: ${items.map((i) => i.name).join(", ")}`
|
|
254
254
|
);
|
|
255
255
|
const targetRoot = options.path ? path2.resolve(process.cwd(), options.path) : options.dir ? path2.resolve(process.cwd(), options.dir) : sourceRoot(project);
|
|
256
|
-
const
|
|
256
|
+
const writesByPath = /* @__PURE__ */ new Map();
|
|
257
257
|
for (const item of items) {
|
|
258
258
|
for (const file of item.files) {
|
|
259
259
|
const relPath = file.target ?? file.path;
|
|
260
260
|
const absPath = path2.join(targetRoot, relPath);
|
|
261
|
-
|
|
261
|
+
const pending = writesByPath.get(absPath);
|
|
262
|
+
if (pending) {
|
|
263
|
+
if (pending.content !== file.content) {
|
|
264
|
+
throw new Error(
|
|
265
|
+
`Registry items resolve to conflicting content for ${relPath}.`
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
writesByPath.set(absPath, {
|
|
271
|
+
absPath,
|
|
272
|
+
relPath,
|
|
273
|
+
content: file.content,
|
|
274
|
+
exists: existsSync2(absPath)
|
|
275
|
+
});
|
|
262
276
|
}
|
|
263
277
|
}
|
|
278
|
+
const writes = [...writesByPath.values()];
|
|
264
279
|
const conflicts = writes.filter((w) => w.exists);
|
|
265
280
|
let skipExisting = false;
|
|
266
281
|
if (conflicts.length > 0 && !options.overwrite) {
|
|
@@ -353,6 +368,7 @@ import pc2 from "picocolors";
|
|
|
353
368
|
import prompts2 from "prompts";
|
|
354
369
|
var RUNTIME_DEPS = ["react-aria-components", "tailwind-merge", "@remixicon/react"];
|
|
355
370
|
var DEV_DEPS = ["tailwindcss", "@tailwindcss/postcss"];
|
|
371
|
+
var PRO_DEPS = ["recharts", "motion", "prism-react-renderer", "@internationalized/date"];
|
|
356
372
|
var INIT_ITEMS = ["globals", "cx", "use-dismiss-on-outside-press"];
|
|
357
373
|
async function init(options) {
|
|
358
374
|
const project = readProject(process.cwd());
|
|
@@ -384,7 +400,8 @@ async function init(options) {
|
|
|
384
400
|
return;
|
|
385
401
|
}
|
|
386
402
|
}
|
|
387
|
-
const
|
|
403
|
+
const runtimeDeps = options.pro ? [...RUNTIME_DEPS, ...PRO_DEPS] : RUNTIME_DEPS;
|
|
404
|
+
const missingRuntime = runtimeDeps.filter((pkg) => !project.installedDependencies.has(pkg));
|
|
388
405
|
const missingDev = DEV_DEPS.filter((pkg) => !project.installedDependencies.has(pkg));
|
|
389
406
|
const missing = [...missingRuntime, ...missingDev];
|
|
390
407
|
if (missing.length > 0) {
|
|
@@ -470,8 +487,8 @@ Add a component with ${pc3.cyan("npx boardui add <name>")}
|
|
|
470
487
|
|
|
471
488
|
// src/index.ts
|
|
472
489
|
var program = new Command();
|
|
473
|
-
program.name("boardui").description("Add BoardUI components to your project.").version("0.1
|
|
474
|
-
program.command("init").description("Set up BoardUI in an existing Next.js project (deps, theme, utils).").option("-y, --yes", "skip confirmation prompts").option("-o, --overwrite", "overwrite existing files").option("-d, --dir <dir>", "target directory (defaults to the project source root)").action(async (options) => {
|
|
490
|
+
program.name("boardui").description("Add BoardUI components to your project.").version("0.2.1", "-v, --version");
|
|
491
|
+
program.command("init").description("Set up BoardUI in an existing Next.js project (deps, theme, utils).").option("-y, --yes", "skip confirmation prompts").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, ...)").action(async (options) => {
|
|
475
492
|
await init(options);
|
|
476
493
|
});
|
|
477
494
|
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 (skips existing files, installs deps)").action(async (components, options) => {
|