@dalexto/lexsys-cli 0.0.2 → 0.0.3
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 +131 -181
- package/dist/install/installer.d.ts +1 -1
- package/dist/install/results.d.ts +10 -0
- package/dist/install/target.d.ts +0 -1
- package/dist/scaffold/scaffold-helpers.d.ts +4 -0
- package/dist/{core → utils}/fs.d.ts +0 -1
- package/dist/utils/prompt.d.ts +9 -0
- package/package.json +2 -2
- package/dist/install/uninstall-results.d.ts +0 -10
- /package/dist/{core → utils}/backup.d.ts +0 -0
- /package/dist/{core → utils}/cli-error.d.ts +0 -0
- /package/dist/{core → utils}/context.d.ts +0 -0
- /package/dist/{core → utils}/flags.d.ts +0 -0
- /package/dist/{core → utils}/hash.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import prompts from 'prompts';
|
|
3
2
|
import { registryManifest, getInstallLayer, registryItems, validateRegistry, registryStyles, registryVersion, validateRegistryItem, registryUtilities as registryUtilities$1 } from '@dalexto/lexsys-registry';
|
|
4
3
|
import { readFile, access, mkdir, copyFile, writeFile, unlink, readdir, rm } from 'fs/promises';
|
|
5
4
|
import { dirname, join, resolve, relative, basename } from 'path';
|
|
@@ -7,8 +6,9 @@ import { createHash } from 'crypto';
|
|
|
7
6
|
import { constants } from 'fs';
|
|
8
7
|
import { fileURLToPath } from 'url';
|
|
9
8
|
import { execFileSync } from 'child_process';
|
|
9
|
+
import prompts from 'prompts';
|
|
10
10
|
|
|
11
|
-
// src/
|
|
11
|
+
// src/utils/cli-error.ts
|
|
12
12
|
var CliError = class extends Error {
|
|
13
13
|
suggestion;
|
|
14
14
|
constructor(message, suggestion) {
|
|
@@ -67,7 +67,7 @@ var filesAreEqual = async (sourcePath, targetPath) => {
|
|
|
67
67
|
return sourceHash === targetHash;
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
// src/
|
|
70
|
+
// src/utils/context.ts
|
|
71
71
|
var currentWorkingDirectory = process.cwd();
|
|
72
72
|
var setCwd = (cwd2) => {
|
|
73
73
|
currentWorkingDirectory = cwd2;
|
|
@@ -191,12 +191,10 @@ var validateTemplateFiles = async (item) => {
|
|
|
191
191
|
|
|
192
192
|
// src/install/results.ts
|
|
193
193
|
var createInstallResourceResult = () => {
|
|
194
|
-
return {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
conflicted: []
|
|
199
|
-
};
|
|
194
|
+
return { created: [], updated: [], skipped: [], conflicted: [] };
|
|
195
|
+
};
|
|
196
|
+
var createUninstallResourceResult = () => {
|
|
197
|
+
return { removed: [], skipped: [], conflicted: [], missing: [] };
|
|
200
198
|
};
|
|
201
199
|
var mergeInstallResults = (results) => {
|
|
202
200
|
return results.reduce(
|
|
@@ -209,33 +207,6 @@ var mergeInstallResults = (results) => {
|
|
|
209
207
|
createInstallResourceResult()
|
|
210
208
|
);
|
|
211
209
|
};
|
|
212
|
-
var hasInstallConflicts = (result) => {
|
|
213
|
-
return result.conflicted.length > 0;
|
|
214
|
-
};
|
|
215
|
-
var printResourceSummary = (label, result) => {
|
|
216
|
-
const total = result.created.length + result.updated.length + result.skipped.length + result.conflicted.length;
|
|
217
|
-
if (!total) {
|
|
218
|
-
console.log(`- ${label}: no changes`);
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
const parts = [
|
|
222
|
-
result.created.length ? `${result.created.length} created` : void 0,
|
|
223
|
-
result.updated.length ? `${result.updated.length} updated` : void 0,
|
|
224
|
-
result.skipped.length ? `${result.skipped.length} skipped` : void 0,
|
|
225
|
-
result.conflicted.length ? `${result.conflicted.length} conflicted` : void 0
|
|
226
|
-
].filter((part) => typeof part === "string");
|
|
227
|
-
console.log(`- ${label}: ${parts.join(", ")}`);
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
// src/install/uninstall-results.ts
|
|
231
|
-
var createUninstallResourceResult = () => {
|
|
232
|
-
return {
|
|
233
|
-
removed: [],
|
|
234
|
-
skipped: [],
|
|
235
|
-
conflicted: [],
|
|
236
|
-
missing: []
|
|
237
|
-
};
|
|
238
|
-
};
|
|
239
210
|
var mergeUninstallResults = (results) => {
|
|
240
211
|
return results.reduce(
|
|
241
212
|
(merged, result) => ({
|
|
@@ -247,21 +218,39 @@ var mergeUninstallResults = (results) => {
|
|
|
247
218
|
createUninstallResourceResult()
|
|
248
219
|
);
|
|
249
220
|
};
|
|
221
|
+
var hasInstallConflicts = (result) => {
|
|
222
|
+
return result.conflicted.length > 0;
|
|
223
|
+
};
|
|
250
224
|
var hasUninstallConflicts = (result) => {
|
|
251
225
|
return result.conflicted.length > 0;
|
|
252
226
|
};
|
|
227
|
+
var formatParts = (parts) => {
|
|
228
|
+
return parts.filter((p) => p.count > 0).map((p) => `${p.count} ${p.label}`);
|
|
229
|
+
};
|
|
230
|
+
var printResourceSummary = (label, result) => {
|
|
231
|
+
const parts = formatParts([
|
|
232
|
+
{ label: "created", count: result.created.length },
|
|
233
|
+
{ label: "updated", count: result.updated.length },
|
|
234
|
+
{ label: "skipped", count: result.skipped.length },
|
|
235
|
+
{ label: "conflicted", count: result.conflicted.length }
|
|
236
|
+
]);
|
|
237
|
+
if (!parts.length) {
|
|
238
|
+
console.log(`- ${label}: no changes`);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
console.log(`- ${label}: ${parts.join(", ")}`);
|
|
242
|
+
};
|
|
253
243
|
var printUninstallSummary = (label, result) => {
|
|
254
|
-
const
|
|
255
|
-
|
|
244
|
+
const parts = formatParts([
|
|
245
|
+
{ label: "removed", count: result.removed.length },
|
|
246
|
+
{ label: "skipped", count: result.skipped.length },
|
|
247
|
+
{ label: "missing", count: result.missing.length },
|
|
248
|
+
{ label: "conflicted", count: result.conflicted.length }
|
|
249
|
+
]);
|
|
250
|
+
if (!parts.length) {
|
|
256
251
|
console.log(`- ${label}: no changes`);
|
|
257
252
|
return;
|
|
258
253
|
}
|
|
259
|
-
const parts = [
|
|
260
|
-
result.removed.length ? `${result.removed.length} removed` : void 0,
|
|
261
|
-
result.skipped.length ? `${result.skipped.length} skipped` : void 0,
|
|
262
|
-
result.missing.length ? `${result.missing.length} missing` : void 0,
|
|
263
|
-
result.conflicted.length ? `${result.conflicted.length} conflicted` : void 0
|
|
264
|
-
].filter((part) => typeof part === "string");
|
|
265
254
|
console.log(`- ${label}: ${parts.join(", ")}`);
|
|
266
255
|
};
|
|
267
256
|
|
|
@@ -1010,7 +999,7 @@ var resolveRegistryUtilities = (names) => {
|
|
|
1010
999
|
});
|
|
1011
1000
|
};
|
|
1012
1001
|
|
|
1013
|
-
// src/
|
|
1002
|
+
// src/utils/flags.ts
|
|
1014
1003
|
var hasFlag = (args2, ...flags) => {
|
|
1015
1004
|
return flags.some((f) => args2.includes(f));
|
|
1016
1005
|
};
|
|
@@ -1036,30 +1025,37 @@ var removeFlagsWithValues = (args2, flags) => {
|
|
|
1036
1025
|
}
|
|
1037
1026
|
return result;
|
|
1038
1027
|
};
|
|
1039
|
-
|
|
1040
|
-
// src/commands/add.ts
|
|
1041
|
-
var promptSelectItems = async () => {
|
|
1028
|
+
var promptMultiselect = async (message, choices, options = {}) => {
|
|
1042
1029
|
const response = await prompts({
|
|
1043
1030
|
type: "multiselect",
|
|
1044
|
-
name: "
|
|
1045
|
-
message
|
|
1046
|
-
choices
|
|
1047
|
-
|
|
1048
|
-
value: item.name
|
|
1049
|
-
}))
|
|
1031
|
+
name: "selected",
|
|
1032
|
+
message,
|
|
1033
|
+
choices,
|
|
1034
|
+
...options.min !== void 0 ? { min: options.min } : {}
|
|
1050
1035
|
});
|
|
1051
1036
|
if (typeof response !== "object" || response === null) {
|
|
1052
1037
|
return [];
|
|
1053
1038
|
}
|
|
1054
|
-
const
|
|
1055
|
-
if (!Array.isArray(
|
|
1039
|
+
const selected = response.selected;
|
|
1040
|
+
if (!Array.isArray(selected)) {
|
|
1056
1041
|
return [];
|
|
1057
1042
|
}
|
|
1058
|
-
return
|
|
1043
|
+
return selected.filter((item) => typeof item === "string");
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
// src/commands/add.ts
|
|
1047
|
+
var promptSelectItems = async () => {
|
|
1048
|
+
return promptMultiselect(
|
|
1049
|
+
"Select components to add",
|
|
1050
|
+
registryItems.map((item) => ({
|
|
1051
|
+
title: `${item.canonicalName} (${item.category})`,
|
|
1052
|
+
value: item.name
|
|
1053
|
+
}))
|
|
1054
|
+
);
|
|
1059
1055
|
};
|
|
1060
1056
|
var runAdd = async (args2) => {
|
|
1061
1057
|
const dryRun = hasFlag(args2, "--dry-run", "-d");
|
|
1062
|
-
hasFlag(args2, "--yes", "-y");
|
|
1058
|
+
const yes = hasFlag(args2, "--yes", "-y");
|
|
1063
1059
|
const noFallback = hasFlag(args2, "--no-fallback");
|
|
1064
1060
|
let items = removeFlagsWithValues(args2, ["--cwd", "-C"]);
|
|
1065
1061
|
items = removeFlags(items, [
|
|
@@ -1070,6 +1066,10 @@ var runAdd = async (args2) => {
|
|
|
1070
1066
|
"--no-fallback"
|
|
1071
1067
|
]);
|
|
1072
1068
|
if (!items.length) {
|
|
1069
|
+
if (yes) {
|
|
1070
|
+
console.log("No components specified. Pass component names to add them.");
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
1073
|
items = await promptSelectItems();
|
|
1074
1074
|
if (!items.length) {
|
|
1075
1075
|
console.log("No components selected.");
|
|
@@ -1468,6 +1468,49 @@ Global Options
|
|
|
1468
1468
|
Run \`lexsys <command> --help\` for command-specific options.
|
|
1469
1469
|
`);
|
|
1470
1470
|
};
|
|
1471
|
+
var writeScaffoldFile = async (targetPath, content, options = {}) => {
|
|
1472
|
+
if (await fileExists(targetPath)) {
|
|
1473
|
+
const existingContent = await readFile(targetPath, "utf-8");
|
|
1474
|
+
if (existingContent === content) {
|
|
1475
|
+
console.log(`Skipped identical scaffold file: ${targetPath}`);
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
if (options.allowExisting) {
|
|
1479
|
+
console.log(`Skipped existing scaffold file: ${targetPath}`);
|
|
1480
|
+
return;
|
|
1481
|
+
}
|
|
1482
|
+
throw new Error(
|
|
1483
|
+
`Refusing to overwrite existing scaffold file: ${targetPath}`
|
|
1484
|
+
);
|
|
1485
|
+
}
|
|
1486
|
+
await mkdir(dirname(targetPath), { recursive: true });
|
|
1487
|
+
await writeFile(targetPath, content, "utf-8");
|
|
1488
|
+
console.log(`Created scaffold file: ${targetPath}`);
|
|
1489
|
+
};
|
|
1490
|
+
var writePackageJsonFile = async (targetDirectory, getContent, mergeContent) => {
|
|
1491
|
+
const targetPath = join(targetDirectory, "package.json");
|
|
1492
|
+
if (!await fileExists(targetPath)) {
|
|
1493
|
+
await writeFile(targetPath, getContent(targetDirectory), "utf-8");
|
|
1494
|
+
console.log(`Created scaffold file: ${targetPath}`);
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
let parsed;
|
|
1498
|
+
try {
|
|
1499
|
+
parsed = JSON.parse(await readFile(targetPath, "utf-8"));
|
|
1500
|
+
} catch {
|
|
1501
|
+
throw new Error(`Invalid existing package.json: ${targetPath}`);
|
|
1502
|
+
}
|
|
1503
|
+
const content = await readFile(targetPath, "utf-8");
|
|
1504
|
+
const mergedContent = mergeContent(targetDirectory, parsed);
|
|
1505
|
+
if (content === mergedContent) {
|
|
1506
|
+
console.log(`Skipped package.json: ${targetPath} already configured`);
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
await writeFile(targetPath, mergedContent, "utf-8");
|
|
1510
|
+
console.log(`Updated package.json: ${targetPath}`);
|
|
1511
|
+
};
|
|
1512
|
+
|
|
1513
|
+
// src/scaffold/next.ts
|
|
1471
1514
|
var NEXT_VERSION = "15.3.3";
|
|
1472
1515
|
var gitIgnore = `node_modules
|
|
1473
1516
|
.next
|
|
@@ -1648,50 +1691,9 @@ var mergePackageJson = (targetDirectory, existingPackageJson) => {
|
|
|
1648
1691
|
}
|
|
1649
1692
|
return JSON.stringify(mergedPackageJson, null, 2) + "\n";
|
|
1650
1693
|
};
|
|
1651
|
-
var writePackageJson = async (targetDirectory) => {
|
|
1652
|
-
const targetPath = join(targetDirectory, "package.json");
|
|
1653
|
-
if (!await fileExists(targetPath)) {
|
|
1654
|
-
await writeFile(targetPath, getPackageJson(targetDirectory), "utf-8");
|
|
1655
|
-
console.log(`Created scaffold file: ${targetPath}`);
|
|
1656
|
-
return;
|
|
1657
|
-
}
|
|
1658
|
-
let parsed;
|
|
1659
|
-
try {
|
|
1660
|
-
parsed = JSON.parse(await readFile(targetPath, "utf-8"));
|
|
1661
|
-
} catch {
|
|
1662
|
-
throw new Error(`Invalid existing package.json: ${targetPath}`);
|
|
1663
|
-
}
|
|
1664
|
-
const content = await readFile(targetPath, "utf-8");
|
|
1665
|
-
const mergedContent = mergePackageJson(targetDirectory, parsed);
|
|
1666
|
-
if (content === mergedContent) {
|
|
1667
|
-
console.log(`Skipped package.json: ${targetPath} already configured`);
|
|
1668
|
-
return;
|
|
1669
|
-
}
|
|
1670
|
-
await writeFile(targetPath, mergedContent, "utf-8");
|
|
1671
|
-
console.log(`Updated package.json: ${targetPath}`);
|
|
1672
|
-
};
|
|
1673
|
-
var writeScaffoldFile = async (targetPath, content, options = {}) => {
|
|
1674
|
-
if (await fileExists(targetPath)) {
|
|
1675
|
-
const existingContent = await readFile(targetPath, "utf-8");
|
|
1676
|
-
if (existingContent === content) {
|
|
1677
|
-
console.log(`Skipped identical scaffold file: ${targetPath}`);
|
|
1678
|
-
return;
|
|
1679
|
-
}
|
|
1680
|
-
if (options.allowExisting) {
|
|
1681
|
-
console.log(`Skipped existing scaffold file: ${targetPath}`);
|
|
1682
|
-
return;
|
|
1683
|
-
}
|
|
1684
|
-
throw new Error(
|
|
1685
|
-
`Refusing to overwrite existing scaffold file: ${targetPath}`
|
|
1686
|
-
);
|
|
1687
|
-
}
|
|
1688
|
-
await mkdir(dirname(targetPath), { recursive: true });
|
|
1689
|
-
await writeFile(targetPath, content, "utf-8");
|
|
1690
|
-
console.log(`Created scaffold file: ${targetPath}`);
|
|
1691
|
-
};
|
|
1692
1694
|
var scaffoldNextProject = async (targetDirectory) => {
|
|
1693
1695
|
await mkdir(targetDirectory, { recursive: true });
|
|
1694
|
-
await
|
|
1696
|
+
await writePackageJsonFile(targetDirectory, getPackageJson, mergePackageJson);
|
|
1695
1697
|
await writeScaffoldFile(join(targetDirectory, ".gitignore"), gitIgnore, {
|
|
1696
1698
|
allowExisting: true
|
|
1697
1699
|
});
|
|
@@ -2176,83 +2178,42 @@ var mergePackageJson2 = (targetDirectory, existingPackageJson) => {
|
|
|
2176
2178
|
}
|
|
2177
2179
|
return JSON.stringify(mergedPackageJson, null, 2) + "\n";
|
|
2178
2180
|
};
|
|
2179
|
-
var writePackageJson2 = async (targetDirectory) => {
|
|
2180
|
-
const targetPath = join(targetDirectory, "package.json");
|
|
2181
|
-
if (!await fileExists(targetPath)) {
|
|
2182
|
-
await writeFile(targetPath, getPackageJson2(targetDirectory), "utf-8");
|
|
2183
|
-
console.log(`Created scaffold file: ${targetPath}`);
|
|
2184
|
-
return;
|
|
2185
|
-
}
|
|
2186
|
-
let parsed;
|
|
2187
|
-
try {
|
|
2188
|
-
parsed = JSON.parse(await readFile(targetPath, "utf-8"));
|
|
2189
|
-
} catch {
|
|
2190
|
-
throw new Error(`Invalid existing package.json: ${targetPath}`);
|
|
2191
|
-
}
|
|
2192
|
-
const content = await readFile(targetPath, "utf-8");
|
|
2193
|
-
const mergedContent = mergePackageJson2(targetDirectory, parsed);
|
|
2194
|
-
if (content === mergedContent) {
|
|
2195
|
-
console.log(`Skipped package.json: ${targetPath} already configured`);
|
|
2196
|
-
return;
|
|
2197
|
-
}
|
|
2198
|
-
await writeFile(targetPath, mergedContent, "utf-8");
|
|
2199
|
-
console.log(`Updated package.json: ${targetPath}`);
|
|
2200
|
-
};
|
|
2201
|
-
var writeScaffoldFile2 = async (targetPath, content, options = {}) => {
|
|
2202
|
-
if (await fileExists(targetPath)) {
|
|
2203
|
-
const existingContent = await readFile(targetPath, "utf-8");
|
|
2204
|
-
if (existingContent === content) {
|
|
2205
|
-
console.log(`Skipped identical scaffold file: ${targetPath}`);
|
|
2206
|
-
return;
|
|
2207
|
-
}
|
|
2208
|
-
if (options.allowExisting) {
|
|
2209
|
-
console.log(`Skipped existing scaffold file: ${targetPath}`);
|
|
2210
|
-
return;
|
|
2211
|
-
}
|
|
2212
|
-
throw new Error(
|
|
2213
|
-
`Refusing to overwrite existing scaffold file: ${targetPath}`
|
|
2214
|
-
);
|
|
2215
|
-
}
|
|
2216
|
-
await mkdir(dirname(targetPath), { recursive: true });
|
|
2217
|
-
await writeFile(targetPath, content, "utf-8");
|
|
2218
|
-
console.log(`Created scaffold file: ${targetPath}`);
|
|
2219
|
-
};
|
|
2220
2181
|
var scaffoldViteProject = async (targetDirectory) => {
|
|
2221
2182
|
await mkdir(targetDirectory, { recursive: true });
|
|
2222
|
-
await
|
|
2223
|
-
await
|
|
2183
|
+
await writePackageJsonFile(targetDirectory, getPackageJson2, mergePackageJson2);
|
|
2184
|
+
await writeScaffoldFile(join(targetDirectory, ".gitignore"), gitIgnore2, {
|
|
2224
2185
|
allowExisting: true
|
|
2225
2186
|
});
|
|
2226
|
-
await
|
|
2187
|
+
await writeScaffoldFile(
|
|
2227
2188
|
join(targetDirectory, ".prettierignore"),
|
|
2228
2189
|
prettierIgnore2,
|
|
2229
2190
|
{
|
|
2230
2191
|
allowExisting: true
|
|
2231
2192
|
}
|
|
2232
2193
|
);
|
|
2233
|
-
await
|
|
2194
|
+
await writeScaffoldFile(
|
|
2234
2195
|
join(targetDirectory, ".prettierrc"),
|
|
2235
2196
|
prettierConfig2,
|
|
2236
2197
|
{
|
|
2237
2198
|
allowExisting: true
|
|
2238
2199
|
}
|
|
2239
2200
|
);
|
|
2240
|
-
await
|
|
2241
|
-
await
|
|
2242
|
-
await
|
|
2201
|
+
await writeScaffoldFile(join(targetDirectory, "index.html"), indexHtml);
|
|
2202
|
+
await writeScaffoldFile(join(targetDirectory, "tsconfig.json"), tsConfig2);
|
|
2203
|
+
await writeScaffoldFile(
|
|
2243
2204
|
join(targetDirectory, "tsconfig.app.json"),
|
|
2244
2205
|
tsConfigApp
|
|
2245
2206
|
);
|
|
2246
|
-
await
|
|
2207
|
+
await writeScaffoldFile(
|
|
2247
2208
|
join(targetDirectory, "tsconfig.node.json"),
|
|
2248
2209
|
tsConfigNode
|
|
2249
2210
|
);
|
|
2250
|
-
await
|
|
2211
|
+
await writeScaffoldFile(join(targetDirectory, "vite.config.ts"), viteConfig, {
|
|
2251
2212
|
allowExisting: true
|
|
2252
2213
|
});
|
|
2253
|
-
await
|
|
2254
|
-
await
|
|
2255
|
-
await
|
|
2214
|
+
await writeScaffoldFile(join(targetDirectory, "src", "main.tsx"), mainTsx);
|
|
2215
|
+
await writeScaffoldFile(join(targetDirectory, "src", "App.tsx"), appTsx);
|
|
2216
|
+
await writeScaffoldFile(join(targetDirectory, "src", "style.css"), styleCss, {
|
|
2256
2217
|
allowExisting: true
|
|
2257
2218
|
});
|
|
2258
2219
|
};
|
|
@@ -2686,18 +2647,13 @@ var runUninstall = async (args2) => {
|
|
|
2686
2647
|
console.log("No components installed.");
|
|
2687
2648
|
return;
|
|
2688
2649
|
}
|
|
2689
|
-
const
|
|
2690
|
-
|
|
2691
|
-
name:
|
|
2692
|
-
|
|
2693
|
-
choices: installedNames.map((name) => ({ title: name, value: name })),
|
|
2694
|
-
min: 1
|
|
2695
|
-
});
|
|
2696
|
-
const selected = response.components;
|
|
2697
|
-
if (!Array.isArray(selected) || !selected.length) return;
|
|
2698
|
-
targetArgs.push(
|
|
2699
|
-
...selected.filter((c) => typeof c === "string")
|
|
2650
|
+
const selected = await promptMultiselect(
|
|
2651
|
+
"Select components to uninstall",
|
|
2652
|
+
installedNames.map((name) => ({ title: name, value: name })),
|
|
2653
|
+
{ min: 1 }
|
|
2700
2654
|
);
|
|
2655
|
+
if (!selected.length) return;
|
|
2656
|
+
targetArgs.push(...selected);
|
|
2701
2657
|
}
|
|
2702
2658
|
const config = await loadConfig();
|
|
2703
2659
|
const installed = config.installed ?? {};
|
|
@@ -3131,9 +3087,6 @@ var runUpdate = async (args2) => {
|
|
|
3131
3087
|
process.exitCode = 1;
|
|
3132
3088
|
return;
|
|
3133
3089
|
}
|
|
3134
|
-
if (yes) {
|
|
3135
|
-
console.log("Auto-confirm mode is enabled.");
|
|
3136
|
-
}
|
|
3137
3090
|
if (!updateAll && !stylesFlag && !utilitiesFlag && targetArgs.length === 0) {
|
|
3138
3091
|
const installedNames = Object.keys(installed);
|
|
3139
3092
|
if (installedNames.length === 0) {
|
|
@@ -3142,18 +3095,17 @@ var runUpdate = async (args2) => {
|
|
|
3142
3095
|
);
|
|
3143
3096
|
return;
|
|
3144
3097
|
}
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
);
|
|
3098
|
+
if (yes) {
|
|
3099
|
+
targetArgs.push(...installedNames);
|
|
3100
|
+
} else {
|
|
3101
|
+
const selected = await promptMultiselect(
|
|
3102
|
+
"Select components to update",
|
|
3103
|
+
installedNames.map((name) => ({ title: name, value: name })),
|
|
3104
|
+
{ min: 1 }
|
|
3105
|
+
);
|
|
3106
|
+
if (!selected.length) return;
|
|
3107
|
+
targetArgs.push(...selected);
|
|
3108
|
+
}
|
|
3157
3109
|
}
|
|
3158
3110
|
const shouldUpdateComponents = updateAll || targetArgs.length > 0;
|
|
3159
3111
|
const resourcesOnly = (stylesFlag || utilitiesFlag) && !shouldUpdateComponents;
|
|
@@ -3329,5 +3281,3 @@ try {
|
|
|
3329
3281
|
} catch (error) {
|
|
3330
3282
|
handleCliError(error);
|
|
3331
3283
|
}
|
|
3332
|
-
runHelp();
|
|
3333
|
-
process.exit(1);
|
|
@@ -2,7 +2,7 @@ import type { RegistryItem } from "@dalexto/lexsys-registry";
|
|
|
2
2
|
import type { LexsysConfig } from "../config/config.js";
|
|
3
3
|
import type { ResolvedRegistryStyle, ResolvedRegistryUtility } from "../registry/types.js";
|
|
4
4
|
import type { InstallResourceResult } from "./results.js";
|
|
5
|
-
import { type UninstallResourceResult } from "./
|
|
5
|
+
import { type UninstallResourceResult } from "./results.js";
|
|
6
6
|
export declare const getRegistryTemplatePath: (templatePath: string) => string;
|
|
7
7
|
export declare const ensureProjectStructure: (config: LexsysConfig) => Promise<void>;
|
|
8
8
|
export declare const installUtilities: (utilities: ResolvedRegistryUtility[], config: LexsysConfig) => Promise<InstallResourceResult>;
|
|
@@ -4,7 +4,17 @@ export interface InstallResourceResult {
|
|
|
4
4
|
skipped: string[];
|
|
5
5
|
conflicted: string[];
|
|
6
6
|
}
|
|
7
|
+
export interface UninstallResourceResult {
|
|
8
|
+
removed: string[];
|
|
9
|
+
skipped: string[];
|
|
10
|
+
conflicted: string[];
|
|
11
|
+
missing: string[];
|
|
12
|
+
}
|
|
7
13
|
export declare const createInstallResourceResult: () => InstallResourceResult;
|
|
14
|
+
export declare const createUninstallResourceResult: () => UninstallResourceResult;
|
|
8
15
|
export declare const mergeInstallResults: (results: InstallResourceResult[]) => InstallResourceResult;
|
|
16
|
+
export declare const mergeUninstallResults: (results: UninstallResourceResult[]) => UninstallResourceResult;
|
|
9
17
|
export declare const hasInstallConflicts: (result: InstallResourceResult) => boolean;
|
|
18
|
+
export declare const hasUninstallConflicts: (result: UninstallResourceResult) => boolean;
|
|
10
19
|
export declare const printResourceSummary: (label: string, result: InstallResourceResult) => void;
|
|
20
|
+
export declare const printUninstallSummary: (label: string, result: UninstallResourceResult) => void;
|
package/dist/install/target.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { RegistryItem } from "@dalexto/lexsys-registry";
|
|
2
2
|
import type { LexsysConfig } from "../config/config.js";
|
|
3
|
-
export declare const resolveComponentsRoot: (config: LexsysConfig) => string;
|
|
4
3
|
export declare const resolveItemInstallTarget: (config: LexsysConfig, item: RegistryItem) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const writeScaffoldFile: (targetPath: string, content: string, options?: {
|
|
2
|
+
allowExisting?: boolean;
|
|
3
|
+
}) => Promise<void>;
|
|
4
|
+
export declare const writePackageJsonFile: (targetDirectory: string, getContent: (dir: string) => string, mergeContent: (dir: string, existing: Record<string, unknown>) => string) => Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface MultiselectChoice {
|
|
2
|
+
title: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
interface MultiselectOptions {
|
|
6
|
+
min?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const promptMultiselect: (message: string, choices: MultiselectChoice[], options?: MultiselectOptions) => Promise<string[]>;
|
|
9
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalexto/lexsys-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
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.3"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^25.9.1",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface UninstallResourceResult {
|
|
2
|
-
removed: string[];
|
|
3
|
-
skipped: string[];
|
|
4
|
-
conflicted: string[];
|
|
5
|
-
missing: string[];
|
|
6
|
-
}
|
|
7
|
-
export declare const createUninstallResourceResult: () => UninstallResourceResult;
|
|
8
|
-
export declare const mergeUninstallResults: (results: UninstallResourceResult[]) => UninstallResourceResult;
|
|
9
|
-
export declare const hasUninstallConflicts: (result: UninstallResourceResult) => boolean;
|
|
10
|
-
export declare const printUninstallSummary: (label: string, result: UninstallResourceResult) => void;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|