@aristobyte-ui/cli 1.0.113 → 2.1.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.
Files changed (42) hide show
  1. package/bin/aristobyte-ui.js +3 -0
  2. package/dist/es/main/commands/add.js +106 -0
  3. package/dist/es/main/commands/doctor.js +166 -0
  4. package/dist/es/main/commands/env.js +175 -0
  5. package/dist/es/main/commands/init.js +180 -0
  6. package/dist/es/main/commands/list.js +195 -0
  7. package/dist/es/main/commands/remove.js +100 -0
  8. package/dist/es/main/commands/upgrade.js +122 -0
  9. package/dist/es/main/index.js +212 -0
  10. package/dist/es/main/utils/checkVersion.js +8 -0
  11. package/dist/es/main/utils/colors.js +77 -0
  12. package/dist/es/main/utils/compareVersions.js +11 -0
  13. package/dist/es/main/utils/getBanner.js +30 -0
  14. package/dist/es/main/utils/getCurrentPackageManager.js +55 -0
  15. package/dist/es/main/utils/getDescription.js +21 -0
  16. package/dist/es/main/utils/getTip.js +21 -0
  17. package/dist/es/main/utils/installPackage.js +75 -0
  18. package/dist/es/main/utils/parseHelp.js +22 -0
  19. package/dist/es/main/utils/typography.js +9 -0
  20. package/dist/lib/main/commands/add.js +112 -0
  21. package/dist/lib/main/commands/doctor.js +172 -0
  22. package/dist/lib/main/commands/env.js +181 -0
  23. package/dist/lib/main/commands/init.js +186 -0
  24. package/dist/lib/main/commands/list.js +202 -0
  25. package/dist/lib/main/commands/remove.js +106 -0
  26. package/dist/lib/main/commands/upgrade.js +128 -0
  27. package/dist/lib/main/index.js +217 -0
  28. package/dist/lib/main/utils/checkVersion.js +14 -0
  29. package/dist/lib/main/utils/colors.js +96 -0
  30. package/dist/lib/main/utils/compareVersions.js +14 -0
  31. package/dist/lib/main/utils/getBanner.js +33 -0
  32. package/dist/lib/main/utils/getCurrentPackageManager.js +61 -0
  33. package/dist/lib/main/utils/getDescription.js +24 -0
  34. package/dist/lib/main/utils/getTip.js +24 -0
  35. package/dist/lib/main/utils/installPackage.js +78 -0
  36. package/dist/lib/main/utils/parseHelp.js +25 -0
  37. package/dist/lib/main/utils/typography.js +13 -0
  38. package/package.json +12 -38
  39. package/dist/index.js +0 -1227
  40. package/dist/index.js.map +0 -1
  41. package/dist/index.mjs +0 -1226
  42. package/dist/index.mjs.map +0 -1
@@ -0,0 +1,195 @@
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
+ var __values = (this && this.__values) || function(o) {
38
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
39
+ if (m) return m.call(o);
40
+ if (o && typeof o.length === "number") return {
41
+ next: function () {
42
+ if (o && i >= o.length) o = void 0;
43
+ return { value: o && o[i++], done: !o };
44
+ }
45
+ };
46
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
47
+ };
48
+ import fs from 'fs';
49
+ import color from 'picocolors';
50
+ import { getCurrentPackageManager } from '../utils/getCurrentPackageManager';
51
+ export function remoteList() {
52
+ return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
53
+ return [2];
54
+ }); });
55
+ }
56
+ export function list(options, endBlock) {
57
+ return __awaiter(this, void 0, void 0, function () {
58
+ var handled, url, omit_1, res, data, packages, err_1, pkgJson, deps, aristobyteDeps, packagesToUpdate, pkgJson, deps, installed, installed_1, installed_1_1, pkg, localVersion, registryUrl, res, data, latest, p, err_2, e_1_1, err_3, pkgManager;
59
+ var e_1, _a;
60
+ var _b;
61
+ return __generator(this, function (_c) {
62
+ switch (_c.label) {
63
+ case 0:
64
+ handled = false;
65
+ if (!options.all) return [3, 6];
66
+ handled = true;
67
+ url = 'https://registry.npmjs.org/-/org/aristobyte-ui/package';
68
+ omit_1 = ['cli', 'react'];
69
+ _c.label = 1;
70
+ case 1:
71
+ _c.trys.push([1, 4, , 5]);
72
+ return [4, fetch(url)];
73
+ case 2:
74
+ res = _c.sent();
75
+ if (!res.ok)
76
+ throw new Error("Registry request failed: ".concat(res.status));
77
+ return [4, res.json()];
78
+ case 3:
79
+ data = _c.sent();
80
+ packages = Object.keys(data)
81
+ .map(function (dep) { return dep.split('/')[1]; })
82
+ .filter(function (dep) { return !omit_1.includes(dep); })
83
+ .sort();
84
+ console.log("".concat(color.green('◇'), " ").concat(color.white('Listing AristoByteUI packages:'), "\n").concat(packages.map(function (dep) { return "".concat(color.gray('|'), " ").concat(color.cyan(dep)); }).join('\n')));
85
+ return [3, 5];
86
+ case 4:
87
+ err_1 = _c.sent();
88
+ console.error(color.red('× Failed to fetch package list from npm registry'));
89
+ console.error(color.dim(String(err_1)));
90
+ return [3, 5];
91
+ case 5:
92
+ if (endBlock)
93
+ console.log(color.green('◇'));
94
+ process.exit(0);
95
+ _c.label = 6;
96
+ case 6:
97
+ if (options.installed) {
98
+ handled = true;
99
+ try {
100
+ pkgJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
101
+ deps = pkgJson.dependencies || {};
102
+ aristobyteDeps = Object.keys(deps)
103
+ .filter(function (d) { return d.startsWith('@aristobyte-ui/'); })
104
+ .map(function (dep) { return (dep.includes('react') ? 'all' : dep.split('/')[1]); });
105
+ console.log("".concat(color.green('◇'), " ").concat(color.white('Listing installed AristoByteUI packages:'), "\n").concat(aristobyteDeps.map(function (dep) { return "".concat(color.gray('|'), " ").concat(color.cyan(dep)); }).join('\n')));
106
+ }
107
+ catch (err) {
108
+ console.error(color.red('× Failed to list packages'), err);
109
+ }
110
+ if (endBlock)
111
+ console.log(color.green('◇'));
112
+ process.exit(0);
113
+ }
114
+ if (!options.outdated) return [3, 21];
115
+ handled = true;
116
+ packagesToUpdate = [];
117
+ _c.label = 7;
118
+ case 7:
119
+ _c.trys.push([7, 19, , 20]);
120
+ pkgJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
121
+ deps = pkgJson.dependencies || {};
122
+ installed = Object.keys(deps).filter(function (d) { return d.startsWith('@aristobyte-ui/'); });
123
+ if (installed.length === 0) {
124
+ console.log(color.yellow('No AristoByteUI packages installed.'));
125
+ process.exit(0);
126
+ }
127
+ console.log("".concat(color.green('◇'), " ").concat(color.white('Checking for outdated AristoByteUI packages...')));
128
+ _c.label = 8;
129
+ case 8:
130
+ _c.trys.push([8, 16, 17, 18]);
131
+ installed_1 = __values(installed), installed_1_1 = installed_1.next();
132
+ _c.label = 9;
133
+ case 9:
134
+ if (!!installed_1_1.done) return [3, 15];
135
+ pkg = installed_1_1.value;
136
+ localVersion = deps[pkg].replace(/^[^\d]*/, '');
137
+ registryUrl = "https://registry.npmjs.org/".concat(pkg);
138
+ _c.label = 10;
139
+ case 10:
140
+ _c.trys.push([10, 13, , 14]);
141
+ return [4, fetch(registryUrl)];
142
+ case 11:
143
+ res = _c.sent();
144
+ if (!res.ok)
145
+ throw new Error("Registry request failed: ".concat(res.status));
146
+ return [4, res.json()];
147
+ case 12:
148
+ data = _c.sent();
149
+ latest = (_b = data['dist-tags']) === null || _b === void 0 ? void 0 : _b.latest;
150
+ if (!latest)
151
+ return [3, 14];
152
+ if (latest !== localVersion) {
153
+ p = pkg.replace('@aristobyte-ui/', '');
154
+ packagesToUpdate.push([p, latest]);
155
+ console.log("".concat(color.gray('|'), " ").concat(color.cyan(p), " ") + "".concat(color.red(localVersion), " \u2192 ").concat(color.green(latest)));
156
+ }
157
+ return [3, 14];
158
+ case 13:
159
+ err_2 = _c.sent();
160
+ console.error(color.red("\u00D7 Failed to check ".concat(pkg, " on npm registry")), err_2);
161
+ return [3, 14];
162
+ case 14:
163
+ installed_1_1 = installed_1.next();
164
+ return [3, 9];
165
+ case 15: return [3, 18];
166
+ case 16:
167
+ e_1_1 = _c.sent();
168
+ e_1 = { error: e_1_1 };
169
+ return [3, 18];
170
+ case 17:
171
+ try {
172
+ if (installed_1_1 && !installed_1_1.done && (_a = installed_1.return)) _a.call(installed_1);
173
+ }
174
+ finally { if (e_1) throw e_1.error; }
175
+ return [7];
176
+ case 18: return [3, 20];
177
+ case 19:
178
+ err_3 = _c.sent();
179
+ console.error(color.red('× Failed to check outdated packages'), err_3);
180
+ return [3, 20];
181
+ case 20:
182
+ pkgManager = getCurrentPackageManager();
183
+ if (endBlock)
184
+ console.log("".concat(color.gray('|'), "\n").concat(color.green('◇'), " ").concat(packagesToUpdate.length > 0 ? color.gray("Tip: run '".concat(pkgManager, " upgrade ").concat(packagesToUpdate.map(function (p) { return "".concat(p[0], "@").concat(p[1]); }).join(' '), "'")) : color.green('✔ Everything is up to date!')));
185
+ process.exit(0);
186
+ _c.label = 21;
187
+ case 21:
188
+ if (!handled) {
189
+ console.log(color.gray("No option provided. Use 'aristobyte-ui list --help' for usage."));
190
+ }
191
+ return [2];
192
+ }
193
+ });
194
+ });
195
+ }
@@ -0,0 +1,100 @@
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 { getCurrentPackageManager } from '../utils/getCurrentPackageManager';
38
+ import { spinner, text } from '@clack/prompts';
39
+ import { execa } from 'execa';
40
+ import color from 'picocolors';
41
+ import { list } from './list';
42
+ export function remove(component, options) {
43
+ return __awaiter(this, void 0, void 0, function () {
44
+ var pkgManager, s, packageName, pkgName, err_1;
45
+ return __generator(this, function (_a) {
46
+ switch (_a.label) {
47
+ case 0:
48
+ if (!options.list) return [3, 2];
49
+ return [4, list({ installed: true }, true)];
50
+ case 1:
51
+ _a.sent();
52
+ _a.label = 2;
53
+ case 2:
54
+ pkgManager = getCurrentPackageManager();
55
+ if (options.packageManager) {
56
+ console.log("".concat(color.cyan('Current package manager:'), "\n").concat(color.green('◇'), " ").concat(pkgManager));
57
+ process.exit(0);
58
+ }
59
+ s = spinner();
60
+ if (!!component) return [3, 5];
61
+ console.log("".concat(color.green('◇'), " ").concat(color.white('You did not specify, which package should be removed'), "\n").concat(color.gray('|'), " ").concat(color.gray('Please select one of the installed packages below to proceed.'), "\n").concat(color.gray('|')));
62
+ return [4, list({ installed: true })];
63
+ case 3:
64
+ _a.sent();
65
+ return [4, text({
66
+ message: "Component name to remove (Required filled)",
67
+ placeholder: '<package-name>',
68
+ })];
69
+ case 4:
70
+ packageName = (_a.sent());
71
+ return [3, 6];
72
+ case 5:
73
+ packageName = component;
74
+ _a.label = 6;
75
+ case 6:
76
+ if (!packageName) {
77
+ console.log(color.red("Invalid Package name. <package-name> should be specified:\naristobyte-ui remove <package-name>"));
78
+ return [2];
79
+ }
80
+ _a.label = 7;
81
+ case 7:
82
+ _a.trys.push([7, 9, , 10]);
83
+ pkgName = packageName === 'all' ? '@aristobyte-ui/react' : "@aristobyte-ui/".concat(packageName);
84
+ s.start("Removing ".concat(pkgName, "..."));
85
+ return [4, execa(pkgManager, ['remove', pkgName], { stdio: 'inherit' })];
86
+ case 8:
87
+ _a.sent();
88
+ s.stop();
89
+ console.log(color.green("\u2714 ".concat(pkgName, " removed successfully!")));
90
+ return [3, 10];
91
+ case 9:
92
+ err_1 = _a.sent();
93
+ s.stop();
94
+ console.error(color.red("\u00D7 Failed to remove component ".concat(packageName)), err_1);
95
+ return [3, 10];
96
+ case 10: return [2];
97
+ }
98
+ });
99
+ });
100
+ }
@@ -0,0 +1,122 @@
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
+ var __values = (this && this.__values) || function(o) {
38
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
39
+ if (m) return m.call(o);
40
+ if (o && typeof o.length === "number") return {
41
+ next: function () {
42
+ if (o && i >= o.length) o = void 0;
43
+ return { value: o && o[i++], done: !o };
44
+ }
45
+ };
46
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
47
+ };
48
+ import { getCurrentPackageManager } from '../utils/getCurrentPackageManager';
49
+ import { spinner } from '@clack/prompts';
50
+ import { execa } from 'execa';
51
+ import color from 'picocolors';
52
+ export function upgrade(component, options) {
53
+ return __awaiter(this, void 0, void 0, function () {
54
+ var s, pkgManager, isAll, targets, versionSuffix, sLabel, targets_1, targets_1_1, pkg, fullSpecifier, e_1_1, err_1;
55
+ var e_1, _a;
56
+ return __generator(this, function (_b) {
57
+ switch (_b.label) {
58
+ case 0:
59
+ if (!component && !options.all) {
60
+ console.error(color.red('× No component specified for upgrade.'));
61
+ console.log(color.gray("Use: 'aristobyte-ui upgrade <component>' or 'aristobyte-ui upgrade --all'"));
62
+ process.exit(0);
63
+ }
64
+ s = spinner();
65
+ pkgManager = getCurrentPackageManager();
66
+ _b.label = 1;
67
+ case 1:
68
+ _b.trys.push([1, 10, , 11]);
69
+ isAll = options.all || component === 'all';
70
+ targets = isAll ? ['@aristobyte-ui/react'] : component ? ["@aristobyte-ui/".concat(component)] : [];
71
+ if (targets.length === 0) {
72
+ console.error(color.red('× No component specified for upgrade.'));
73
+ console.log(color.gray('Use: aristobyte-ui upgrade <component> or --all'));
74
+ process.exit(1);
75
+ }
76
+ versionSuffix = options.to ? "@".concat(options.to) : '';
77
+ sLabel = isAll ? 'Upgrading all AristoByteUI components...' : "Upgrading ".concat(targets.join(', '), "...");
78
+ s.start(sLabel);
79
+ _b.label = 2;
80
+ case 2:
81
+ _b.trys.push([2, 7, 8, 9]);
82
+ targets_1 = __values(targets), targets_1_1 = targets_1.next();
83
+ _b.label = 3;
84
+ case 3:
85
+ if (!!targets_1_1.done) return [3, 6];
86
+ pkg = targets_1_1.value;
87
+ fullSpecifier = "".concat(pkg).concat(versionSuffix);
88
+ return [4, execa(pkgManager, ['upgrade', fullSpecifier], {
89
+ stdio: 'inherit',
90
+ })];
91
+ case 4:
92
+ _b.sent();
93
+ _b.label = 5;
94
+ case 5:
95
+ targets_1_1 = targets_1.next();
96
+ return [3, 3];
97
+ case 6: return [3, 9];
98
+ case 7:
99
+ e_1_1 = _b.sent();
100
+ e_1 = { error: e_1_1 };
101
+ return [3, 9];
102
+ case 8:
103
+ try {
104
+ if (targets_1_1 && !targets_1_1.done && (_a = targets_1.return)) _a.call(targets_1);
105
+ }
106
+ finally { if (e_1) throw e_1.error; }
107
+ return [7];
108
+ case 9:
109
+ s.stop();
110
+ console.log(color.green("\u2714 Upgrade complete".concat(options.to ? " \u2192 version ".concat(options.to) : '', "!")));
111
+ return [3, 11];
112
+ case 10:
113
+ err_1 = _b.sent();
114
+ s.stop();
115
+ console.error(color.red("\u00D7 Upgrade failed."));
116
+ console.error(color.dim(String(err_1)));
117
+ return [3, 11];
118
+ case 11: return [2];
119
+ }
120
+ });
121
+ });
122
+ }
@@ -0,0 +1,212 @@
1
+ #!/usr/bin/env node
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 __read = (this && this.__read) || function (o, n) {
39
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
40
+ if (!m) return o;
41
+ var i = m.call(o), r, ar = [], e;
42
+ try {
43
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
+ }
45
+ catch (error) { e = { error: error }; }
46
+ finally {
47
+ try {
48
+ if (r && !r.done && (m = i["return"])) m.call(i);
49
+ }
50
+ finally { if (e) throw e.error; }
51
+ }
52
+ return ar;
53
+ };
54
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
55
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
56
+ if (ar || !(i in from)) {
57
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
58
+ ar[i] = from[i];
59
+ }
60
+ }
61
+ return to.concat(ar || Array.prototype.slice.call(from));
62
+ };
63
+ import { Command } from 'commander';
64
+ import { add } from './commands/add';
65
+ import { init } from './commands/init';
66
+ import { remove } from './commands/remove';
67
+ import { upgrade } from './commands/upgrade';
68
+ import { list } from './commands/list';
69
+ import { doctor } from './commands/doctor';
70
+ import { env } from './commands/env';
71
+ import { logoSmallGradient, logo3, logo4, darkGrey, lightGrey } from './utils/colors';
72
+ import { usage } from './utils/typography';
73
+ import { parseHelp } from './utils/parseHelp';
74
+ import pkg from '../../package.json';
75
+ var COMMANDS = ['init', 'add', 'remove', 'upgrade', 'list', 'doctor', 'env', 'help'];
76
+ var aristobyteui = new Command();
77
+ aristobyteui
78
+ .name('aristobyte-ui')
79
+ .usage(usage(['command', 'options']))
80
+ .description('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.')
81
+ .version(pkg.version, '-V, --version', 'Output the CLI version')
82
+ .helpOption('-H, --help', 'Show help information')
83
+ .configureHelp({
84
+ formatHelp: function (cmd, helper) { return parseHelp(cmd, helper); },
85
+ });
86
+ aristobyteui
87
+ .command('init [myProjectName]')
88
+ .usage(usage(['options', 'myProjectName']))
89
+ .description('Initialize a new AristoByteUI project')
90
+ .option('-LT, --list-templates', 'Display a list of available templates')
91
+ .option('-LPM, --list-package-managers', 'Display a list of available package managers')
92
+ .option('-T, --template <templateName>', 'Specify a template to use')
93
+ .option('-P, --package-manager <packageManager>', 'Select a package manager (npm, yarn, pnpm, bun)')
94
+ .configureHelp({
95
+ formatHelp: function (cmd, helper) { return parseHelp(cmd, helper); },
96
+ })
97
+ .action(init);
98
+ aristobyteui
99
+ .command('add [component]')
100
+ .usage(usage(['options', 'components...']))
101
+ .description('Add a UI component')
102
+ .option('-L, --list', 'Display a list of available packages, to be added')
103
+ .option('-P, --package-manager', 'Show the package manager used in current project')
104
+ .configureHelp({
105
+ formatHelp: function (cmd, helper) { return parseHelp(cmd, helper); },
106
+ })
107
+ .action(add);
108
+ aristobyteui
109
+ .command('remove [component]')
110
+ .usage(usage(['options', 'components...']))
111
+ .description('Remove a UI component')
112
+ .option('-L, --list', 'Display a list of installed packages, to be removed')
113
+ .option('-P, --package-manager', 'Show the package manager used in current project')
114
+ .configureHelp({
115
+ formatHelp: function (cmd, helper) { return parseHelp(cmd, helper); },
116
+ })
117
+ .action(remove);
118
+ aristobyteui
119
+ .command('upgrade [component]')
120
+ .usage(usage(['options', 'components...']))
121
+ .description('Upgrade a UI component')
122
+ .option('-A, --all', 'Upgrade all AristoByteUI components')
123
+ .option('-T, --to <version>', 'Upgrade to a specific version')
124
+ .configureHelp({
125
+ formatHelp: function (cmd, helper) { return parseHelp(cmd, helper); },
126
+ })
127
+ .action(upgrade);
128
+ aristobyteui
129
+ .command('list')
130
+ .usage(usage(['options']))
131
+ .description('List installed components')
132
+ .option('-A, --all', 'Display the list of all packages')
133
+ .option('-I, --installed', 'Display the list of installed packages')
134
+ .option('-O, --outdated', 'Check for available updates')
135
+ .configureHelp({
136
+ formatHelp: function (cmd, helper) { return parseHelp(cmd, helper); },
137
+ })
138
+ .action(function (options) { return list(options, true); });
139
+ aristobyteui
140
+ .command('doctor')
141
+ .usage(usage(['options']))
142
+ .description('Check system and project health')
143
+ .option('-A, --all', 'Run all diagnostics')
144
+ .option('-C, --configs', 'Validate project config files')
145
+ .option('-D, --deps', 'Validate installed AristoByteUI dependencies')
146
+ .option('-J, --json', 'Output diagnostics as JSON')
147
+ .option('-N, --network', 'Verify registry/network connectivity')
148
+ .option('-P, --pm', 'Check package manager state')
149
+ .option('-S, --system', 'Check system environment')
150
+ .configureHelp({
151
+ formatHelp: function (cmd, helper) { return parseHelp(cmd, helper); },
152
+ })
153
+ .action(doctor);
154
+ aristobyteui
155
+ .command('env')
156
+ .usage(usage(['options']))
157
+ .description('Display environment info')
158
+ .option('-A, --all', 'Display all environment diagnostics')
159
+ .option('-J, --json', 'Output environment info as JSON')
160
+ .option('-M, --pm', 'Show package manager details')
161
+ .option('-N, --network', 'Check registry/network connectivity')
162
+ .option('-P, --packages', 'Show installed AristoByteUI packages')
163
+ .option('-S, --system', 'Show system information')
164
+ .configureHelp({
165
+ formatHelp: function (cmd, helper) { return parseHelp(cmd, helper); },
166
+ })
167
+ .action(env);
168
+ aristobyteui
169
+ .command('help')
170
+ .usage(usage(['options']))
171
+ .description('Display help for command')
172
+ .action(env);
173
+ aristobyteui.command('help', { hidden: true });
174
+ aristobyteui.exitOverride(function (err) { return __awaiter(void 0, void 0, void 0, function () {
175
+ return __generator(this, function (_a) {
176
+ if (err.code === 'commander.unknownCommand') {
177
+ console.error.apply(console, __spreadArray([logoSmallGradient(' ◆ Possible commands are: \n')], __read(COMMANDS.map(function (cmd) {
178
+ return cmd === err.message.split('Did you mean ')[1].split('?')[0]
179
+ ? "".concat(logoSmallGradient('│ ')).concat(logo4('● aristobyte-ui'), " ").concat(logo4("".concat(cmd)), "\n")
180
+ : "".concat(logoSmallGradient('│ ○ aristobyte-ui'), " ").concat(logo3("".concat(cmd)), "\n");
181
+ })), false));
182
+ }
183
+ process.exit(1);
184
+ return [2];
185
+ });
186
+ }); });
187
+ (function () { return __awaiter(void 0, void 0, void 0, function () {
188
+ var args, err_1;
189
+ return __generator(this, function (_a) {
190
+ switch (_a.label) {
191
+ case 0:
192
+ args = process.argv.slice(2);
193
+ if (args.length === 0) {
194
+ aristobyteui.outputHelp();
195
+ process.exit(0);
196
+ }
197
+ _a.label = 1;
198
+ case 1:
199
+ _a.trys.push([1, 3, , 4]);
200
+ return [4, aristobyteui.parseAsync(args, { from: 'user' })];
201
+ case 2:
202
+ _a.sent();
203
+ return [3, 4];
204
+ case 3:
205
+ err_1 = _a.sent();
206
+ console.error(darkGrey('Error:'), lightGrey(err_1.message));
207
+ process.exit(1);
208
+ return [3, 4];
209
+ case 4: return [2];
210
+ }
211
+ });
212
+ }); })();
@@ -0,0 +1,8 @@
1
+ import { compareVersions } from "./compareVersions";
2
+ import color from "picocolors";
3
+ export function checkVersion(name, version, minVersion) {
4
+ if (version === "unknown" || compareVersions(version, minVersion) < 0) {
5
+ return color.red("\u00D7 ".concat(name, " >= ").concat(minVersion, " required"));
6
+ }
7
+ return color.green("\u2714 ".concat(version));
8
+ }