@resourcexjs/cli 2.8.0 → 2.10.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/dist/index.js +69 -61
- package/dist/index.js.map +5 -5
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -4855,25 +4855,34 @@ function define(input) {
|
|
|
4855
4855
|
}
|
|
4856
4856
|
function locate(rxm) {
|
|
4857
4857
|
return {
|
|
4858
|
-
registry: rxm.registry,
|
|
4859
|
-
path: rxm.path,
|
|
4860
|
-
name: rxm.name,
|
|
4861
|
-
tag: rxm.tag
|
|
4858
|
+
registry: rxm.definition.registry,
|
|
4859
|
+
path: rxm.definition.path,
|
|
4860
|
+
name: rxm.definition.name,
|
|
4861
|
+
tag: rxm.definition.tag
|
|
4862
4862
|
};
|
|
4863
4863
|
}
|
|
4864
4864
|
function manifest(rxd) {
|
|
4865
4865
|
return {
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4866
|
+
definition: {
|
|
4867
|
+
name: rxd.name,
|
|
4868
|
+
type: rxd.type,
|
|
4869
|
+
tag: rxd.tag ?? "latest",
|
|
4870
|
+
registry: rxd.registry,
|
|
4871
|
+
path: rxd.path,
|
|
4872
|
+
description: rxd.description,
|
|
4873
|
+
author: rxd.author,
|
|
4874
|
+
license: rxd.license,
|
|
4875
|
+
keywords: rxd.keywords,
|
|
4876
|
+
repository: rxd.repository
|
|
4877
|
+
},
|
|
4878
|
+
archive: {},
|
|
4879
|
+
source: {}
|
|
4871
4880
|
};
|
|
4872
4881
|
}
|
|
4873
4882
|
function resource(rxm, rxa) {
|
|
4874
|
-
const
|
|
4883
|
+
const rxi = locate(rxm);
|
|
4875
4884
|
return {
|
|
4876
|
-
|
|
4885
|
+
identifier: rxi,
|
|
4877
4886
|
manifest: rxm,
|
|
4878
4887
|
archive: rxa
|
|
4879
4888
|
};
|
|
@@ -17273,12 +17282,9 @@ var add = defineCommand({
|
|
|
17273
17282
|
consola.success(`Added resource:
|
|
17274
17283
|
`);
|
|
17275
17284
|
console.log(` Locator: ${resource2.locator}`);
|
|
17276
|
-
console.log(` Name: ${resource2.name}`);
|
|
17277
|
-
console.log(` Type: ${resource2.type}`);
|
|
17278
|
-
console.log(` Tag: ${resource2.tag}`);
|
|
17279
|
-
if (resource2.files?.length) {
|
|
17280
|
-
console.log(` Files: ${resource2.files.join(", ")}`);
|
|
17281
|
-
}
|
|
17285
|
+
console.log(` Name: ${resource2.definition.name}`);
|
|
17286
|
+
console.log(` Type: ${resource2.definition.type}`);
|
|
17287
|
+
console.log(` Tag: ${resource2.definition.tag}`);
|
|
17282
17288
|
} catch (error48) {
|
|
17283
17289
|
consola.error(error48 instanceof Error ? error48.message : "Failed to add resource");
|
|
17284
17290
|
process.exit(1);
|
|
@@ -17393,24 +17399,40 @@ var info = defineCommand({
|
|
|
17393
17399
|
try {
|
|
17394
17400
|
const rx = await getClient();
|
|
17395
17401
|
const resource2 = await rx.info(args.locator);
|
|
17402
|
+
const { definition, source } = resource2;
|
|
17396
17403
|
console.log();
|
|
17397
|
-
console.log(` ${
|
|
17404
|
+
console.log(` ${definition.name}:${definition.tag}`);
|
|
17398
17405
|
console.log(` ${"\u2500".repeat(40)}`);
|
|
17399
17406
|
console.log();
|
|
17400
17407
|
console.log(` Locator: ${resource2.locator}`);
|
|
17401
|
-
if (
|
|
17402
|
-
console.log(` Registry: ${
|
|
17408
|
+
if (definition.registry) {
|
|
17409
|
+
console.log(` Registry: ${definition.registry}`);
|
|
17410
|
+
}
|
|
17411
|
+
if (definition.path) {
|
|
17412
|
+
console.log(` Path: ${definition.path}`);
|
|
17403
17413
|
}
|
|
17404
|
-
|
|
17405
|
-
|
|
17414
|
+
console.log(` Name: ${definition.name}`);
|
|
17415
|
+
console.log(` Type: ${definition.type}`);
|
|
17416
|
+
console.log(` Tag: ${definition.tag}`);
|
|
17417
|
+
if (definition.description) {
|
|
17418
|
+
console.log(` Desc: ${definition.description}`);
|
|
17419
|
+
}
|
|
17420
|
+
if (definition.author) {
|
|
17421
|
+
console.log(` Author: ${definition.author}`);
|
|
17406
17422
|
}
|
|
17407
|
-
console.log(` Name: ${resource2.name}`);
|
|
17408
|
-
console.log(` Type: ${resource2.type}`);
|
|
17409
|
-
console.log(` Tag: ${resource2.tag}`);
|
|
17410
17423
|
console.log();
|
|
17411
|
-
if (
|
|
17424
|
+
if (source.files && Object.keys(source.files).length > 0) {
|
|
17412
17425
|
console.log(` Files:`);
|
|
17413
|
-
printFileTree(
|
|
17426
|
+
printFileTree(source.files);
|
|
17427
|
+
}
|
|
17428
|
+
if (source.preview) {
|
|
17429
|
+
console.log();
|
|
17430
|
+
console.log(` Preview:`);
|
|
17431
|
+
const lines = source.preview.split(`
|
|
17432
|
+
`).slice(0, 5);
|
|
17433
|
+
for (const line of lines) {
|
|
17434
|
+
console.log(` ${line}`);
|
|
17435
|
+
}
|
|
17414
17436
|
}
|
|
17415
17437
|
console.log();
|
|
17416
17438
|
} catch (error48) {
|
|
@@ -17419,44 +17441,30 @@ var info = defineCommand({
|
|
|
17419
17441
|
}
|
|
17420
17442
|
}
|
|
17421
17443
|
});
|
|
17422
|
-
function
|
|
17423
|
-
|
|
17424
|
-
|
|
17425
|
-
|
|
17426
|
-
|
|
17427
|
-
|
|
17428
|
-
|
|
17429
|
-
|
|
17430
|
-
} else {
|
|
17431
|
-
const dir = parts[0];
|
|
17432
|
-
const rest = parts.slice(1).join("/");
|
|
17433
|
-
if (!tree[dir]) {
|
|
17434
|
-
tree[dir] = [];
|
|
17435
|
-
}
|
|
17436
|
-
tree[dir].push(rest);
|
|
17437
|
-
}
|
|
17438
|
-
}
|
|
17439
|
-
const dirs = Object.keys(tree).sort();
|
|
17440
|
-
const allItems = [...dirs, ...rootFiles];
|
|
17441
|
-
for (let i2 = 0;i2 < allItems.length; i2++) {
|
|
17442
|
-
const item = allItems[i2];
|
|
17443
|
-
const isLast = i2 === allItems.length - 1;
|
|
17444
|
+
function isFileEntry(value) {
|
|
17445
|
+
return "size" in value && typeof value.size === "number";
|
|
17446
|
+
}
|
|
17447
|
+
function printFileTree(tree, indent = "") {
|
|
17448
|
+
const entries = Object.entries(tree);
|
|
17449
|
+
for (let i2 = 0;i2 < entries.length; i2++) {
|
|
17450
|
+
const [name, value] = entries[i2];
|
|
17451
|
+
const isLast = i2 === entries.length - 1;
|
|
17444
17452
|
const prefix = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
17445
|
-
|
|
17446
|
-
|
|
17447
|
-
|
|
17453
|
+
const childIndent = indent + (isLast ? " " : "\u2502 ");
|
|
17454
|
+
if (isFileEntry(value)) {
|
|
17455
|
+
console.log(` ${indent}${prefix}${name} (${formatSize(value.size)})`);
|
|
17448
17456
|
} else {
|
|
17449
|
-
console.log(` ${prefix}${
|
|
17457
|
+
console.log(` ${indent}${prefix}${name}`);
|
|
17458
|
+
printFileTree(value, childIndent);
|
|
17450
17459
|
}
|
|
17451
17460
|
}
|
|
17452
17461
|
}
|
|
17453
|
-
function
|
|
17454
|
-
|
|
17455
|
-
|
|
17456
|
-
|
|
17457
|
-
|
|
17458
|
-
|
|
17459
|
-
}
|
|
17462
|
+
function formatSize(bytes) {
|
|
17463
|
+
if (bytes < 1024)
|
|
17464
|
+
return `${bytes}B`;
|
|
17465
|
+
if (bytes < 1024 * 1024)
|
|
17466
|
+
return `${(bytes / 1024).toFixed(1)}KB`;
|
|
17467
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
|
|
17460
17468
|
}
|
|
17461
17469
|
|
|
17462
17470
|
// src/commands/list.ts
|
|
@@ -17869,4 +17877,4 @@ var main = defineCommand({
|
|
|
17869
17877
|
});
|
|
17870
17878
|
runMain(main);
|
|
17871
17879
|
|
|
17872
|
-
//# debugId=
|
|
17880
|
+
//# debugId=1CE1059D7A48473B64756E2164756E21
|