@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 +11 -0
- package/bin/brxndxndiaz-ui.js +12 -6
- package/package.json +1 -1
package/README.md
ADDED
package/bin/brxndxndiaz-ui.js
CHANGED
|
@@ -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
|
-
|
|
56
|
-
|
|
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
|
}
|