@dalexto/lexsys-cli 0.0.5 → 0.0.6
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/dist/index.js +87 -33
- package/dist/utils/registry-errors.d.ts +6 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -313,9 +313,14 @@ var getRegistryTemplatePath = (templatePath) => {
|
|
|
313
313
|
);
|
|
314
314
|
return fileURLToPath(templateUrl);
|
|
315
315
|
};
|
|
316
|
-
var
|
|
316
|
+
var generatedStyleFileHeader = `/**
|
|
317
|
+
* AUTO-GENERATED FILE.
|
|
318
|
+
*
|
|
319
|
+
* Generated by @dalexto/lexsys-tokens.
|
|
320
|
+
* Manual changes will be overwritten.
|
|
321
|
+
`;
|
|
317
322
|
var isGeneratedLexsysStyle = (content) => {
|
|
318
|
-
return content.startsWith(
|
|
323
|
+
return content.startsWith(generatedStyleFileHeader);
|
|
319
324
|
};
|
|
320
325
|
var ensureProjectStructure = async (config) => {
|
|
321
326
|
await mkdir(join(getCwd(), config.paths.components), { recursive: true });
|
|
@@ -1119,7 +1124,14 @@ var runAdd = async (args2) => {
|
|
|
1119
1124
|
]);
|
|
1120
1125
|
if (!items.length) {
|
|
1121
1126
|
if (yes) {
|
|
1122
|
-
console.log(
|
|
1127
|
+
console.log(
|
|
1128
|
+
"No components specified. Pass names to install non-interactively, for example:"
|
|
1129
|
+
);
|
|
1130
|
+
console.log(" lexsys add button dialog --yes");
|
|
1131
|
+
console.log(
|
|
1132
|
+
"To refresh all tracked components, use `lexsys update --yes` instead."
|
|
1133
|
+
);
|
|
1134
|
+
process.exitCode = 1;
|
|
1123
1135
|
return;
|
|
1124
1136
|
}
|
|
1125
1137
|
items = await promptSelectItems();
|
|
@@ -1255,6 +1267,29 @@ var runConfig = async (options = {}) => {
|
|
|
1255
1267
|
const config = await loadConfig();
|
|
1256
1268
|
console.log(JSON.stringify(config, null, 2));
|
|
1257
1269
|
};
|
|
1270
|
+
|
|
1271
|
+
// src/utils/registry-errors.ts
|
|
1272
|
+
var formatRegistryResolveError = (error) => {
|
|
1273
|
+
return error instanceof Error ? error.message : String(error);
|
|
1274
|
+
};
|
|
1275
|
+
var markRegistryResolveFailure = () => {
|
|
1276
|
+
process.exitCode = 1;
|
|
1277
|
+
};
|
|
1278
|
+
var printRegistryResolveFailure = (error) => {
|
|
1279
|
+
console.log("Failed to resolve registry.");
|
|
1280
|
+
console.log(formatRegistryResolveError(error));
|
|
1281
|
+
markRegistryResolveFailure();
|
|
1282
|
+
};
|
|
1283
|
+
var printRegistryResolveFailureChecklist = (error, options = {}) => {
|
|
1284
|
+
if (options.sectionHeading) {
|
|
1285
|
+
console.log(options.sectionHeading);
|
|
1286
|
+
}
|
|
1287
|
+
console.log("\xD7 failed to resolve registry");
|
|
1288
|
+
console.log(formatRegistryResolveError(error));
|
|
1289
|
+
markRegistryResolveFailure();
|
|
1290
|
+
};
|
|
1291
|
+
|
|
1292
|
+
// src/commands/doctor.ts
|
|
1258
1293
|
var runDoctor = async (options = {}) => {
|
|
1259
1294
|
console.log("Lexsys doctor\n");
|
|
1260
1295
|
const config = await loadConfig();
|
|
@@ -1295,10 +1330,9 @@ var runDoctor = async (options = {}) => {
|
|
|
1295
1330
|
console.log(`\u2713 items: ${registryResult.items.length}`);
|
|
1296
1331
|
} catch (error) {
|
|
1297
1332
|
registryFailed = true;
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
process.exitCode = 1;
|
|
1333
|
+
printRegistryResolveFailureChecklist(error, {
|
|
1334
|
+
sectionHeading: "\nRegistry:"
|
|
1335
|
+
});
|
|
1302
1336
|
}
|
|
1303
1337
|
if (registryFailed && options.noFallback) {
|
|
1304
1338
|
return;
|
|
@@ -1352,7 +1386,7 @@ Usage
|
|
|
1352
1386
|
|
|
1353
1387
|
Options
|
|
1354
1388
|
--dry-run, -d Preview files, dependencies, and install paths
|
|
1355
|
-
--yes, -y
|
|
1389
|
+
--yes, -y Non-interactive when component names are provided
|
|
1356
1390
|
--no-fallback Fail instead of falling back to local registry
|
|
1357
1391
|
--cwd, -C <path> Run from a different project directory
|
|
1358
1392
|
--help, -h Show this help
|
|
@@ -1381,6 +1415,7 @@ Options
|
|
|
1381
1415
|
--help, -h Show this help
|
|
1382
1416
|
|
|
1383
1417
|
Run without arguments for guided update picker.
|
|
1418
|
+
With --yes and no names, updates all tracked components.
|
|
1384
1419
|
|
|
1385
1420
|
Examples
|
|
1386
1421
|
lexsys up
|
|
@@ -1408,6 +1443,9 @@ Usage
|
|
|
1408
1443
|
lexsys status
|
|
1409
1444
|
lexsys st
|
|
1410
1445
|
|
|
1446
|
+
Shows template drift for tracked components (up to date vs out of sync).
|
|
1447
|
+
For project paths and registry connectivity, use \`lexsys doctor\`.
|
|
1448
|
+
|
|
1411
1449
|
Options
|
|
1412
1450
|
--no-fallback Fail instead of falling back to local registry
|
|
1413
1451
|
--help, -h Show this help
|
|
@@ -1419,6 +1457,7 @@ Usage
|
|
|
1419
1457
|
Options
|
|
1420
1458
|
--dry-run, -d Preview reset without writing files
|
|
1421
1459
|
--with-deps, -w Also reset installed registry dependencies in the closure
|
|
1460
|
+
--yes, -y Non-interactive; with no names, resets all tracked components
|
|
1422
1461
|
--no-fallback Fail instead of falling back to local registry
|
|
1423
1462
|
--cwd, -C <path> Run from a different project directory
|
|
1424
1463
|
--help, -h Show this help
|
|
@@ -1438,6 +1477,8 @@ Usage
|
|
|
1438
1477
|
Options
|
|
1439
1478
|
--dry-run, -d Preview uninstall without removing files
|
|
1440
1479
|
--with-deps, -w Also remove registry-owned shared dependencies
|
|
1480
|
+
--yes, -y Non-interactive; with no names, uninstalls all tracked components
|
|
1481
|
+
--no-fallback Fail instead of falling back to local registry
|
|
1441
1482
|
--help, -h Show this help
|
|
1442
1483
|
|
|
1443
1484
|
Run without arguments for guided uninstall picker.
|
|
@@ -1451,6 +1492,9 @@ Usage
|
|
|
1451
1492
|
lexsys doctor
|
|
1452
1493
|
lexsys dr
|
|
1453
1494
|
|
|
1495
|
+
Checks project paths, registry connectivity, and on-disk component folders.
|
|
1496
|
+
For template drift vs the registry, use \`lexsys status\`.
|
|
1497
|
+
|
|
1454
1498
|
Options
|
|
1455
1499
|
--no-fallback Fail instead of falling back to local registry
|
|
1456
1500
|
--help, -h Show this help
|
|
@@ -1516,8 +1560,8 @@ Components
|
|
|
1516
1560
|
|
|
1517
1561
|
Inspect
|
|
1518
1562
|
list List available registry items [alias: ls]
|
|
1519
|
-
status
|
|
1520
|
-
doctor
|
|
1563
|
+
status Template drift for installed components [alias: st]
|
|
1564
|
+
doctor Project paths and registry health [alias: dr]
|
|
1521
1565
|
registry Inspect registry source and manifest [alias: reg]
|
|
1522
1566
|
config Print or update Lexsys config [alias: cfg]
|
|
1523
1567
|
|
|
@@ -1527,7 +1571,7 @@ Meta
|
|
|
1527
1571
|
|
|
1528
1572
|
Global Options
|
|
1529
1573
|
--cwd, -C <path> Run from a different project directory
|
|
1530
|
-
--yes, -y
|
|
1574
|
+
--yes, -y Non-interactive mode (add, update, reset, uninstall)
|
|
1531
1575
|
--no-fallback Disable local registry fallback
|
|
1532
1576
|
--help, -h Show help
|
|
1533
1577
|
--version, -v Show CLI version
|
|
@@ -2630,9 +2674,7 @@ var runStatus = async (options = {}) => {
|
|
|
2630
2674
|
fallback: !options.noFallback
|
|
2631
2675
|
});
|
|
2632
2676
|
} catch (error) {
|
|
2633
|
-
|
|
2634
|
-
console.log(error instanceof Error ? error.message : String(error));
|
|
2635
|
-
process.exitCode = 1;
|
|
2677
|
+
printRegistryResolveFailure(error);
|
|
2636
2678
|
return;
|
|
2637
2679
|
}
|
|
2638
2680
|
console.log("Installed Lexsys components:\n");
|
|
@@ -2862,6 +2904,7 @@ var resolveInstalledKey = async (name, installed) => {
|
|
|
2862
2904
|
var runReset = async (args2) => {
|
|
2863
2905
|
const dryRun = hasFlag(args2, "--dry-run", "-d");
|
|
2864
2906
|
const withDeps = hasFlag(args2, "--with-deps", "-w");
|
|
2907
|
+
const yes = hasFlag(args2, "--yes", "-y");
|
|
2865
2908
|
const noFallback = hasFlag(args2, "--no-fallback");
|
|
2866
2909
|
const targetArgs = removeFlagsWithValues(
|
|
2867
2910
|
removeFlags(args2, [
|
|
@@ -2869,6 +2912,8 @@ var runReset = async (args2) => {
|
|
|
2869
2912
|
"-d",
|
|
2870
2913
|
"--with-deps",
|
|
2871
2914
|
"-w",
|
|
2915
|
+
"--yes",
|
|
2916
|
+
"-y",
|
|
2872
2917
|
"--no-fallback"
|
|
2873
2918
|
]),
|
|
2874
2919
|
["--cwd", "-C"]
|
|
@@ -2890,13 +2935,17 @@ var runReset = async (args2) => {
|
|
|
2890
2935
|
return;
|
|
2891
2936
|
}
|
|
2892
2937
|
if (!targetArgs.length) {
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2938
|
+
if (yes) {
|
|
2939
|
+
targetArgs.push(...installed);
|
|
2940
|
+
} else {
|
|
2941
|
+
const selected = await promptMultiselect(
|
|
2942
|
+
"Select components to reset",
|
|
2943
|
+
installed.map((name) => ({ title: name, value: name })),
|
|
2944
|
+
{ min: 1 }
|
|
2945
|
+
);
|
|
2946
|
+
if (!selected.length) return;
|
|
2947
|
+
targetArgs.push(...selected);
|
|
2948
|
+
}
|
|
2900
2949
|
}
|
|
2901
2950
|
const resetNames = /* @__PURE__ */ new Set();
|
|
2902
2951
|
for (const name of targetArgs) {
|
|
@@ -2963,6 +3012,7 @@ var collectOrphanedSharedResources = (removedItems, remainingItems) => {
|
|
|
2963
3012
|
var runUninstall = async (args2) => {
|
|
2964
3013
|
const dryRun = hasFlag(args2, "--dry-run", "-d");
|
|
2965
3014
|
const withDeps = hasFlag(args2, "--with-deps", "-w");
|
|
3015
|
+
const yes = hasFlag(args2, "--yes", "-y");
|
|
2966
3016
|
const noFallback = hasFlag(args2, "--no-fallback");
|
|
2967
3017
|
const targetArgs = removeFlagsWithValues(
|
|
2968
3018
|
removeFlags(args2, [
|
|
@@ -2970,27 +3020,31 @@ var runUninstall = async (args2) => {
|
|
|
2970
3020
|
"-d",
|
|
2971
3021
|
"--with-deps",
|
|
2972
3022
|
"-w",
|
|
3023
|
+
"--yes",
|
|
3024
|
+
"-y",
|
|
2973
3025
|
"--no-fallback"
|
|
2974
3026
|
]),
|
|
2975
3027
|
["--cwd", "-C"]
|
|
2976
3028
|
);
|
|
3029
|
+
const config = await loadConfig();
|
|
3030
|
+
const installed = [...config.installed ?? []];
|
|
2977
3031
|
if (!targetArgs.length) {
|
|
2978
|
-
|
|
2979
|
-
const installedNames = preConfig.installed ?? [];
|
|
2980
|
-
if (installedNames.length === 0) {
|
|
3032
|
+
if (!installed.length) {
|
|
2981
3033
|
console.log("No components installed.");
|
|
2982
3034
|
return;
|
|
2983
3035
|
}
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
3036
|
+
if (yes) {
|
|
3037
|
+
targetArgs.push(...installed);
|
|
3038
|
+
} else {
|
|
3039
|
+
const selected = await promptMultiselect(
|
|
3040
|
+
"Select components to uninstall",
|
|
3041
|
+
installed.map((name) => ({ title: name, value: name })),
|
|
3042
|
+
{ min: 1 }
|
|
3043
|
+
);
|
|
3044
|
+
if (!selected.length) return;
|
|
3045
|
+
targetArgs.push(...selected);
|
|
3046
|
+
}
|
|
2991
3047
|
}
|
|
2992
|
-
const config = await loadConfig();
|
|
2993
|
-
const installed = [...config.installed ?? []];
|
|
2994
3048
|
const resolvedTargets = [];
|
|
2995
3049
|
const notTracked = [];
|
|
2996
3050
|
for (const name of targetArgs) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const formatRegistryResolveError: (error: unknown) => string;
|
|
2
|
+
export declare const markRegistryResolveFailure: () => void;
|
|
3
|
+
export declare const printRegistryResolveFailure: (error: unknown) => void;
|
|
4
|
+
export declare const printRegistryResolveFailureChecklist: (error: unknown, options?: {
|
|
5
|
+
sectionHeading?: string;
|
|
6
|
+
}) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalexto/lexsys-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Registry-first CLI that installs Lexsys React UI components into your project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"prompts": "^2.4.2",
|
|
35
|
-
"@dalexto/lexsys-registry": "0.0.
|
|
35
|
+
"@dalexto/lexsys-registry": "0.0.6"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^25.9.1",
|