@brxndxndiaz/ui 0.1.3 → 0.1.4
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/bin/brxndxndiaz-ui.js +36 -28
- package/package.json +5 -2
package/bin/brxndxndiaz-ui.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const { spawnSync } = require("child_process");
|
|
7
|
-
const
|
|
7
|
+
const inquirer = require("inquirer");
|
|
8
8
|
|
|
9
9
|
const REGISTRY_BASE = "https://ui.brndndiaz.dev/r";
|
|
10
10
|
const SOURCE_BASE = process.env.BRXN_SOURCE_BASE;
|
|
@@ -63,16 +63,13 @@ function readJson(filePath) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
function prompt(question) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
resolve(answer.trim());
|
|
74
|
-
});
|
|
75
|
-
});
|
|
66
|
+
return inquirer.prompt([
|
|
67
|
+
{
|
|
68
|
+
type: "input",
|
|
69
|
+
name: "answer",
|
|
70
|
+
message: question,
|
|
71
|
+
},
|
|
72
|
+
]).then((answers) => answers.answer);
|
|
76
73
|
}
|
|
77
74
|
|
|
78
75
|
function parseSelection(input, max) {
|
|
@@ -207,14 +204,17 @@ async function promptForComponentsRoot(projectRoot) {
|
|
|
207
204
|
const defaults = ["components", "src/components", "app/components", "src/app/components"];
|
|
208
205
|
const options = detection && Array.isArray(detection) ? detection : defaults;
|
|
209
206
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
207
|
+
const answers = await inquirer.prompt([
|
|
208
|
+
{
|
|
209
|
+
type: "list",
|
|
210
|
+
name: "root",
|
|
211
|
+
message: "Select a components directory:",
|
|
212
|
+
choices: options,
|
|
213
|
+
default: options[0],
|
|
214
|
+
},
|
|
215
|
+
]);
|
|
216
|
+
|
|
217
|
+
return answers.root;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
function resolveComponentTarget(targetPath, componentsRoot) {
|
|
@@ -324,18 +324,26 @@ async function promptForRegistryComponents(componentsRoot) {
|
|
|
324
324
|
process.exit(0);
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
327
|
+
const answers = await inquirer.prompt([
|
|
328
|
+
{
|
|
329
|
+
type: "checkbox",
|
|
330
|
+
name: "components",
|
|
331
|
+
message: "Which components would you like to add?",
|
|
332
|
+
choices: available.map((item) => ({
|
|
333
|
+
name: item.name,
|
|
334
|
+
value: item.name,
|
|
335
|
+
checked: false,
|
|
336
|
+
})),
|
|
337
|
+
pageSize: 10,
|
|
338
|
+
},
|
|
339
|
+
]);
|
|
340
|
+
|
|
341
|
+
if (!answers.components.length) {
|
|
335
342
|
console.log("No components selected. Exiting.");
|
|
336
343
|
process.exit(1);
|
|
337
344
|
}
|
|
338
|
-
|
|
345
|
+
|
|
346
|
+
return answers.components;
|
|
339
347
|
}
|
|
340
348
|
|
|
341
349
|
function resolveTailwindCssPath(projectRoot) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brxndxndiaz/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "CLI for the brxndxndiaz UI registry.",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
"bin": {
|
|
10
10
|
"brxndxndiaz-ui": "bin/brxndxndiaz-ui.js"
|
|
11
11
|
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"inquirer": "^8.2.5"
|
|
14
|
+
},
|
|
12
15
|
"engines": {
|
|
13
16
|
"node": ">=18"
|
|
14
17
|
}
|
|
15
|
-
}
|
|
18
|
+
}
|