@brxndxndiaz/ui 0.1.0 → 0.1.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/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # @brxndxndiaz/ui
2
+
3
+ CLI for the brxndxndiaz UI registry.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ npx @brxndxndiaz/ui add animated-timeline
9
+ ```
10
+
11
+ This pulls registry items from the public registry and writes the component files into your project.
@@ -5,9 +5,7 @@ const fs = require("fs");
5
5
  const path = require("path");
6
6
 
7
7
  const REGISTRY_BASE = "https://ui.brndndiaz.dev/r";
8
- const SOURCE_BASE =
9
- process.env.BRXN_SOURCE_BASE ||
10
- "https://raw.githubusercontent.com/brxndxndiaz/brxndxndiaz-ui/main";
8
+ const SOURCE_BASE = process.env.BRXN_SOURCE_BASE;
11
9
 
12
10
  function printHelp() {
13
11
  console.log(`brxndxndiaz-ui
@@ -50,10 +48,18 @@ async function addComponent(name) {
50
48
  }
51
49
 
52
50
  for (const file of item.files) {
53
- const sourcePath = file.path;
54
51
  const targetPath = file.target || file.path;
55
- const sourceUrl = `${SOURCE_BASE}/${sourcePath}`;
56
- const content = await fetchText(sourceUrl);
52
+ let content = file.content;
53
+ if (!content) {
54
+ if (!SOURCE_BASE) {
55
+ throw new Error(
56
+ `Missing file content for ${targetPath}. Set BRXN_SOURCE_BASE to a public raw source URL.`
57
+ );
58
+ }
59
+ const sourcePath = file.path;
60
+ const sourceUrl = `${SOURCE_BASE}/${sourcePath}`;
61
+ content = await fetchText(sourceUrl);
62
+ }
57
63
  await writeFile(targetPath, content);
58
64
  console.log(`Added ${targetPath}`);
59
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brxndxndiaz/ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "private": false,
5
5
  "description": "CLI for the brxndxndiaz UI registry.",
6
6
  "scripts": {