@aristobyte-ui/cli 1.0.113 → 2.0.0
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/aristobyte-ui.js +3 -0
- package/dist/es/main/commands/add.js +106 -0
- package/dist/es/main/commands/doctor.js +166 -0
- package/dist/es/main/commands/env.js +175 -0
- package/dist/es/main/commands/init.js +180 -0
- package/dist/es/main/commands/list.js +195 -0
- package/dist/es/main/commands/remove.js +100 -0
- package/dist/es/main/commands/upgrade.js +122 -0
- package/dist/es/main/index.js +212 -0
- package/dist/es/main/utils/checkVersion.js +8 -0
- package/dist/es/main/utils/colors.js +77 -0
- package/dist/es/main/utils/compareVersions.js +11 -0
- package/dist/es/main/utils/getBanner.js +30 -0
- package/dist/es/main/utils/getCurrentPackageManager.js +55 -0
- package/dist/es/main/utils/getDescription.js +21 -0
- package/dist/es/main/utils/getTip.js +21 -0
- package/dist/es/main/utils/installPackage.js +75 -0
- package/dist/es/main/utils/parseHelp.js +22 -0
- package/dist/es/main/utils/typography.js +9 -0
- package/dist/lib/main/commands/add.js +112 -0
- package/dist/lib/main/commands/doctor.js +172 -0
- package/dist/lib/main/commands/env.js +181 -0
- package/dist/lib/main/commands/init.js +186 -0
- package/dist/lib/main/commands/list.js +202 -0
- package/dist/lib/main/commands/remove.js +106 -0
- package/dist/lib/main/commands/upgrade.js +128 -0
- package/dist/lib/main/index.js +217 -0
- package/dist/lib/main/utils/checkVersion.js +14 -0
- package/dist/lib/main/utils/colors.js +96 -0
- package/dist/lib/main/utils/compareVersions.js +14 -0
- package/dist/lib/main/utils/getBanner.js +33 -0
- package/dist/lib/main/utils/getCurrentPackageManager.js +61 -0
- package/dist/lib/main/utils/getDescription.js +24 -0
- package/dist/lib/main/utils/getTip.js +24 -0
- package/dist/lib/main/utils/installPackage.js +78 -0
- package/dist/lib/main/utils/parseHelp.js +25 -0
- package/dist/lib/main/utils/typography.js +13 -0
- package/package.json +12 -38
- package/dist/index.js +0 -1227
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -1226
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
+
if (!m) return o;
|
|
4
|
+
var i = m.call(o), r, ar = [], e;
|
|
5
|
+
try {
|
|
6
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
+
}
|
|
8
|
+
catch (error) { e = { error: error }; }
|
|
9
|
+
finally {
|
|
10
|
+
try {
|
|
11
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
+
}
|
|
13
|
+
finally { if (e) throw e.error; }
|
|
14
|
+
}
|
|
15
|
+
return ar;
|
|
16
|
+
};
|
|
17
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
+
if (ar || !(i in from)) {
|
|
20
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
+
ar[i] = from[i];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
+
};
|
|
26
|
+
import chalk from "chalk";
|
|
27
|
+
import gradient from "gradient-string";
|
|
28
|
+
var LOGO_COLORS = ["#ffee27", "#fec800", "#f18e35", "#e95f32", "#e2312d"];
|
|
29
|
+
export function logo1(text) {
|
|
30
|
+
return chalk.hex(LOGO_COLORS[0])(text);
|
|
31
|
+
}
|
|
32
|
+
export function logo2(text) {
|
|
33
|
+
return chalk.hex(LOGO_COLORS[1])(text);
|
|
34
|
+
}
|
|
35
|
+
export function logo3(text) {
|
|
36
|
+
return chalk.hex(LOGO_COLORS[2])(text);
|
|
37
|
+
}
|
|
38
|
+
export function logo4(text) {
|
|
39
|
+
return chalk.hex(LOGO_COLORS[3])(text);
|
|
40
|
+
}
|
|
41
|
+
export function logo5(text) {
|
|
42
|
+
return chalk.hex(LOGO_COLORS[4])(text);
|
|
43
|
+
}
|
|
44
|
+
export function reset(text) {
|
|
45
|
+
return chalk.reset(text);
|
|
46
|
+
}
|
|
47
|
+
export function red(text) {
|
|
48
|
+
return chalk.redBright(text);
|
|
49
|
+
}
|
|
50
|
+
export function lightGrey(text) {
|
|
51
|
+
return chalk.hex("#afbfff")(text);
|
|
52
|
+
}
|
|
53
|
+
export function darkGrey(text) {
|
|
54
|
+
return chalk.hex("#7580aa")(text);
|
|
55
|
+
}
|
|
56
|
+
export function white(text) {
|
|
57
|
+
return chalk.hex("#cfd5edff")(text);
|
|
58
|
+
}
|
|
59
|
+
export function yellow(text) {
|
|
60
|
+
return chalk.yellow(text);
|
|
61
|
+
}
|
|
62
|
+
export function redBright(text) {
|
|
63
|
+
return chalk.redBright(text);
|
|
64
|
+
}
|
|
65
|
+
export function logoGradient(text) {
|
|
66
|
+
return gradient(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(LOGO_COLORS), false), __read(LOGO_COLORS.reverse()), false), __read(LOGO_COLORS), false), __read(LOGO_COLORS.reverse()), false), __read(LOGO_COLORS), false)).multiline(text);
|
|
67
|
+
}
|
|
68
|
+
export function logoSmallGradient(text) {
|
|
69
|
+
return gradient([
|
|
70
|
+
LOGO_COLORS[0],
|
|
71
|
+
LOGO_COLORS[1],
|
|
72
|
+
LOGO_COLORS[1],
|
|
73
|
+
LOGO_COLORS[0],
|
|
74
|
+
LOGO_COLORS[0],
|
|
75
|
+
LOGO_COLORS[1],
|
|
76
|
+
]).multiline(text);
|
|
77
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function compareVersions(v1, v2) {
|
|
2
|
+
var a = v1.replace(/^v/, "").split(".").map(Number);
|
|
3
|
+
var b = v2.replace(/^v/, "").split(".").map(Number);
|
|
4
|
+
for (var i = 0; i < 3; i++) {
|
|
5
|
+
if (a[i] > b[i])
|
|
6
|
+
return 1;
|
|
7
|
+
if (a[i] < b[i])
|
|
8
|
+
return -1;
|
|
9
|
+
}
|
|
10
|
+
return 0;
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { logoGradient } from "./colors";
|
|
2
|
+
var mainBanner = " \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \n \u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2591 \u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591 \u2591\u2591\u2591\u2588\u2588\u2588\u2591 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2591\u2591\u2588\u2588\u2588\u2591 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\n \u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2591\u2591 \u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2588\u2588\u2588\u2591\u2591\u2591 \n \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588 \n\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591 \n \u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \n \u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588 \n \u2591\u2591\u2591\u2591\u2591\u2591 ";
|
|
3
|
+
var initBanner = " \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \n\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2591 \u2591\u2591\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2591\u2588\u2588\u2588\u2591 \n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\n \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588 \n\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 ";
|
|
4
|
+
var addBanner = " \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\n \u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \n \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\n\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 ";
|
|
5
|
+
var removeBanner = " \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \n\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\n \u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2591\u2591\u2591 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2591\u2591\u2591 \n \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588 \n\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591 ";
|
|
6
|
+
var doctorBanner = " \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \n\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2588\u2588\u2588\u2591 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2591\u2588\u2588\u2588 \u2591\u2591\u2591 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2591\u2591 \n \u2591\u2588\u2588\u2588 \u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2591\u2588\u2588\u2588 \u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \n \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \n\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 ";
|
|
7
|
+
var envBanner = " \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \n\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2588 \n \u2591\u2588\u2588\u2588 \u2588 \u2591 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\n \u2591\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588\u2591\u2591\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591 \u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588 \n \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588 \n\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 ";
|
|
8
|
+
var listBanner = " \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \n\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2591 \u2591\u2591\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591 \u2591\u2591\u2591\u2588\u2588\u2588\u2591 \n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2588 \u2591\u2588\u2588\u2588 \u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\n \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588 \n\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 ";
|
|
9
|
+
var upgradeBanner = " \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \n\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2591\u2591 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \n \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2591\u2591\u2591 \n \u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588 \n \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2588\u2588\u2588\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591 \n \u2591\u2588\u2588\u2588 \u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \n \u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588 \n \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591 ";
|
|
10
|
+
export function getBanner(id) {
|
|
11
|
+
switch (id) {
|
|
12
|
+
case "add":
|
|
13
|
+
return logoGradient(addBanner);
|
|
14
|
+
case "doctor":
|
|
15
|
+
return logoGradient(doctorBanner);
|
|
16
|
+
case "env":
|
|
17
|
+
return logoGradient(envBanner);
|
|
18
|
+
case "init":
|
|
19
|
+
return logoGradient(initBanner);
|
|
20
|
+
case "list":
|
|
21
|
+
return logoGradient(listBanner);
|
|
22
|
+
case "remove":
|
|
23
|
+
return logoGradient(removeBanner);
|
|
24
|
+
case "upgrade":
|
|
25
|
+
return logoGradient(upgradeBanner);
|
|
26
|
+
case "aristobyte-ui":
|
|
27
|
+
default:
|
|
28
|
+
return logoGradient(mainBanner);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __values = (this && this.__values) || function(o) {
|
|
2
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
3
|
+
if (m) return m.call(o);
|
|
4
|
+
if (o && typeof o.length === "number") return {
|
|
5
|
+
next: function () {
|
|
6
|
+
if (o && i >= o.length) o = void 0;
|
|
7
|
+
return { value: o && o[i++], done: !o };
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
|
+
};
|
|
12
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
import fs from "fs";
|
|
29
|
+
import path from "path";
|
|
30
|
+
export function getCurrentPackageManager(cwd) {
|
|
31
|
+
var e_1, _a;
|
|
32
|
+
if (cwd === void 0) { cwd = process.cwd(); }
|
|
33
|
+
var lockFiles = {
|
|
34
|
+
bun: "bun.lockb",
|
|
35
|
+
pnpm: "pnpm-lock.yaml",
|
|
36
|
+
yarn: "yarn.lock",
|
|
37
|
+
npm: "package-lock.json",
|
|
38
|
+
};
|
|
39
|
+
try {
|
|
40
|
+
for (var _b = __values(Object.entries(lockFiles)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
41
|
+
var _d = __read(_c.value, 2), manager = _d[0], lockFile = _d[1];
|
|
42
|
+
if (fs.existsSync(path.join(cwd, lockFile))) {
|
|
43
|
+
return manager;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
48
|
+
finally {
|
|
49
|
+
try {
|
|
50
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
51
|
+
}
|
|
52
|
+
finally { if (e_1) throw e_1.error; }
|
|
53
|
+
}
|
|
54
|
+
return "npm";
|
|
55
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function getDescription(id) {
|
|
2
|
+
switch (id) {
|
|
3
|
+
case "init":
|
|
4
|
+
return "Initialize a new AristoByteUI project from pre-configured templates.\n Supports automatic project setup, template selection, and package manager configuration.";
|
|
5
|
+
case "add":
|
|
6
|
+
return "Add new UI components to your existing AristoByteUI project.\n Handles component installation, configuration, and dependency management.";
|
|
7
|
+
case "remove":
|
|
8
|
+
return "Remove installed AristoByteUI components cleanly from your project.\n Ensures proper cleanup of related files and dependencies.";
|
|
9
|
+
case "upgrade":
|
|
10
|
+
return "Upgrade AristoByteUI components or core packages to their latest versions.\n Supports selective or full project upgrades.";
|
|
11
|
+
case "list":
|
|
12
|
+
return "List all installed AristoByteUI components in your project.\n Displays version, status, and available updates for each component.";
|
|
13
|
+
case "doctor":
|
|
14
|
+
return "Run a system and project health check.\n Detects configuration issues, missing dependencies, and environment mismatches.";
|
|
15
|
+
case "env":
|
|
16
|
+
return "Display detailed environment information.\n Includes Node.js version, package manager details, and AristoByteUI configuration paths.";
|
|
17
|
+
case "aristobyte-ui":
|
|
18
|
+
default:
|
|
19
|
+
return "Create new AristoByteUI projects or manage existing projects with full control\n over components, dependencies, and UI stack configuration. Supports initialization,\n addition, removal, upgrading of components, and project diagnostics.";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function getTip(id) {
|
|
2
|
+
switch (id) {
|
|
3
|
+
case "init":
|
|
4
|
+
return "Run 'aristobyte-ui init' or 'aristobyte-ui init [ myProject ] --template <templateName> --package-manager <packageManagerName>' to bootstrap a new project quickly.\n Use interactive prompts to customize or provide flags for automation.";
|
|
5
|
+
case "add":
|
|
6
|
+
return "Use 'aristobyte-ui add [ component ]' to install a specific UI component.\n Combine multiple components for faster setup.";
|
|
7
|
+
case "remove":
|
|
8
|
+
return "Run 'aristobyte-ui remove [ component ]' to cleanly uninstall components.\n Useful for maintaining a lightweight project.";
|
|
9
|
+
case "upgrade":
|
|
10
|
+
return "Use 'aristobyte-ui upgrade [ component ]' to update components or core packages.\n Add '--all' to upgrade everything at once.";
|
|
11
|
+
case "list":
|
|
12
|
+
return "Run 'aristobyte-ui list' to view installed components and versions.\n Add '--outdated' to check for available updates.";
|
|
13
|
+
case "doctor":
|
|
14
|
+
return "Execute 'aristobyte-ui doctor' to analyze your setup.\n Fixes and recommendations will be displayed for common issues.";
|
|
15
|
+
case "env":
|
|
16
|
+
return "Run 'aristobyte-ui env' to inspect your development environment.\n Helpful for debugging version or configuration conflicts.";
|
|
17
|
+
case "aristobyte-ui":
|
|
18
|
+
default:
|
|
19
|
+
return "Use 'aristobyte-ui [ command ] --help' for detailed info on a command.";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { execa } from 'execa';
|
|
38
|
+
export function installPackage(pkgManager_1, pkg_1) {
|
|
39
|
+
return __awaiter(this, arguments, void 0, function (pkgManager, pkg, dev) {
|
|
40
|
+
var args;
|
|
41
|
+
if (dev === void 0) { dev = false; }
|
|
42
|
+
return __generator(this, function (_a) {
|
|
43
|
+
switch (_a.label) {
|
|
44
|
+
case 0:
|
|
45
|
+
args = [];
|
|
46
|
+
switch (pkgManager) {
|
|
47
|
+
case "npm":
|
|
48
|
+
args = ["install", pkg, dev ? "--save-dev" : "--save"];
|
|
49
|
+
break;
|
|
50
|
+
case "yarn":
|
|
51
|
+
args = ["add", pkg];
|
|
52
|
+
if (dev)
|
|
53
|
+
args.push("-D");
|
|
54
|
+
break;
|
|
55
|
+
case "pnpm":
|
|
56
|
+
args = ["add", pkg];
|
|
57
|
+
if (dev)
|
|
58
|
+
args.push("-D");
|
|
59
|
+
break;
|
|
60
|
+
case "bun":
|
|
61
|
+
args = ["add", pkg];
|
|
62
|
+
if (dev)
|
|
63
|
+
args.push("-d");
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
throw new Error("Unsupported package manager: ".concat(pkgManager));
|
|
67
|
+
}
|
|
68
|
+
return [4, execa(pkgManager, args, { stdio: "inherit" })];
|
|
69
|
+
case 1:
|
|
70
|
+
_a.sent();
|
|
71
|
+
return [2];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { logoSmallGradient, logo3, logo4, darkGrey, lightGrey } from "./colors";
|
|
2
|
+
import { description } from "./typography";
|
|
3
|
+
import { getBanner } from "./getBanner";
|
|
4
|
+
import { getTip } from "./getTip";
|
|
5
|
+
import { getDescription } from "./getDescription";
|
|
6
|
+
export function parseHelp(cmd, helper) {
|
|
7
|
+
return "\n".concat(getBanner(cmd.name()), "\n\n").concat(logoSmallGradient("Usage:"), " \n").concat(logo3(helper.commandUsage(cmd)), "\n\n").concat(logoSmallGradient("Description:"), "\n ").concat(darkGrey(getDescription(cmd.name())), "\n\n").concat(helper.visibleCommands(cmd).length > 0
|
|
8
|
+
? "".concat(logoSmallGradient("Commands:"), "\n").concat(helper
|
|
9
|
+
.visibleCommands(cmd)
|
|
10
|
+
.map(function (c) {
|
|
11
|
+
return " ".concat("".concat(logo3(c.name()).padEnd(31), " ").concat(c.usage() || "".padEnd(30)).padEnd(129), " ").concat(description(c.description()));
|
|
12
|
+
})
|
|
13
|
+
.join("\n"), "\n\n")
|
|
14
|
+
: "").concat(helper.visibleOptions(cmd).length > 0
|
|
15
|
+
? "".concat(logoSmallGradient("Options:"), "\n").concat(helper
|
|
16
|
+
.visibleOptions(cmd)
|
|
17
|
+
.map(function (option) {
|
|
18
|
+
return " ".concat("".concat(logo3(option.flags.split(/,\s*/)[0])).concat(darkGrey(", ")).concat(logo4(option.flags.split(/,\s*/)[1])).padEnd(93), " ").concat(description(option.description));
|
|
19
|
+
})
|
|
20
|
+
.join("\n"), "\n\n")
|
|
21
|
+
: "").concat(logoSmallGradient("Tip:"), "\n ").concat(lightGrey(getTip(cmd.name())), "\n");
|
|
22
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { logo4, darkGrey, lightGrey } from "./colors";
|
|
2
|
+
export function usage(params) {
|
|
3
|
+
return params
|
|
4
|
+
.map(function (param) { return "".concat(logo4("["), " ").concat(lightGrey(param), " ").concat(logo4("]")); })
|
|
5
|
+
.join(" ");
|
|
6
|
+
}
|
|
7
|
+
export function description(text) {
|
|
8
|
+
return darkGrey("- ".concat(text));
|
|
9
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.add = add;
|
|
43
|
+
var prompts_1 = require("@clack/prompts");
|
|
44
|
+
var getCurrentPackageManager_1 = require("../utils/getCurrentPackageManager");
|
|
45
|
+
var picocolors_1 = __importDefault(require("picocolors"));
|
|
46
|
+
var installPackage_1 = require("../utils/installPackage");
|
|
47
|
+
var list_1 = require("./list");
|
|
48
|
+
var DEFAULT_PACKAGE = 'all';
|
|
49
|
+
function add(component, options) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
+
var pkgManager, s, packageName, pkgManager_1, pkgName, err_1;
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
switch (_a.label) {
|
|
54
|
+
case 0:
|
|
55
|
+
if (!options.list) return [3, 2];
|
|
56
|
+
return [4, (0, list_1.list)({ all: true }, true)];
|
|
57
|
+
case 1:
|
|
58
|
+
_a.sent();
|
|
59
|
+
_a.label = 2;
|
|
60
|
+
case 2:
|
|
61
|
+
pkgManager = (0, getCurrentPackageManager_1.getCurrentPackageManager)();
|
|
62
|
+
if (options.packageManager) {
|
|
63
|
+
console.log("".concat(picocolors_1.default.cyan('Current package manager:'), "\n").concat(picocolors_1.default.green('◇'), " ").concat(pkgManager));
|
|
64
|
+
process.exit(0);
|
|
65
|
+
}
|
|
66
|
+
s = (0, prompts_1.spinner)();
|
|
67
|
+
packageName = DEFAULT_PACKAGE;
|
|
68
|
+
if (!!component) return [3, 5];
|
|
69
|
+
console.log("".concat(picocolors_1.default.green('◇'), " ").concat(picocolors_1.default.white('You did not specify, which package should be added'), "\n").concat(picocolors_1.default.gray('|'), " ").concat(picocolors_1.default.gray('Please select one of the packages below listed to proceed.'), "\n").concat(picocolors_1.default.gray('|')));
|
|
70
|
+
return [4, (0, list_1.list)({ all: true })];
|
|
71
|
+
case 3:
|
|
72
|
+
_a.sent();
|
|
73
|
+
return [4, (0, prompts_1.text)({
|
|
74
|
+
message: 'Component name to add (Enter to install all components)',
|
|
75
|
+
placeholder: DEFAULT_PACKAGE,
|
|
76
|
+
defaultValue: DEFAULT_PACKAGE,
|
|
77
|
+
})];
|
|
78
|
+
case 4:
|
|
79
|
+
packageName = (_a.sent());
|
|
80
|
+
return [3, 6];
|
|
81
|
+
case 5:
|
|
82
|
+
packageName = component;
|
|
83
|
+
_a.label = 6;
|
|
84
|
+
case 6:
|
|
85
|
+
_a.trys.push([6, 10, , 11]);
|
|
86
|
+
s.start("Installing ".concat(packageName, "..."));
|
|
87
|
+
pkgManager_1 = (0, getCurrentPackageManager_1.getCurrentPackageManager)();
|
|
88
|
+
if (!(packageName === 'all')) return [3, 8];
|
|
89
|
+
return [4, (0, installPackage_1.installPackage)(pkgManager_1, '@aristobyte-ui/react')];
|
|
90
|
+
case 7:
|
|
91
|
+
_a.sent();
|
|
92
|
+
s.stop();
|
|
93
|
+
console.log(picocolors_1.default.green('✔ All components installed!'));
|
|
94
|
+
return [2];
|
|
95
|
+
case 8:
|
|
96
|
+
pkgName = "@aristobyte-ui/".concat(packageName);
|
|
97
|
+
return [4, (0, installPackage_1.installPackage)(pkgManager_1, pkgName)];
|
|
98
|
+
case 9:
|
|
99
|
+
_a.sent();
|
|
100
|
+
s.stop();
|
|
101
|
+
console.log(picocolors_1.default.green("\u2714 Component ".concat(packageName, " installed!")));
|
|
102
|
+
return [3, 11];
|
|
103
|
+
case 10:
|
|
104
|
+
err_1 = _a.sent();
|
|
105
|
+
s.stop();
|
|
106
|
+
console.error(picocolors_1.default.red("\u00D7 Failed to install package ".concat(packageName)), err_1);
|
|
107
|
+
return [3, 11];
|
|
108
|
+
case 11: return [2];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|