boardui 0.2.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 +18 -3
- 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) {
|
|
@@ -472,7 +487,7 @@ Add a component with ${pc3.cyan("npx boardui add <name>")}
|
|
|
472
487
|
|
|
473
488
|
// src/index.ts
|
|
474
489
|
var program = new Command();
|
|
475
|
-
program.name("boardui").description("Add BoardUI components to your project.").version("0.2.
|
|
490
|
+
program.name("boardui").description("Add BoardUI components to your project.").version("0.2.1", "-v, --version");
|
|
476
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) => {
|
|
477
492
|
await init(options);
|
|
478
493
|
});
|