@hanzogui/get 8.1.0 → 8.1.1
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/cli.js +32 -49
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -5,43 +5,25 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
function __accessProp(key) {
|
|
9
|
-
return this[key];
|
|
10
|
-
}
|
|
11
|
-
var __toESMCache_node;
|
|
12
|
-
var __toESMCache_esm;
|
|
13
8
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
-
var canCache = mod != null && typeof mod === "object";
|
|
15
|
-
if (canCache) {
|
|
16
|
-
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
-
var cached = cache.get(mod);
|
|
18
|
-
if (cached)
|
|
19
|
-
return cached;
|
|
20
|
-
}
|
|
21
9
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
10
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
11
|
for (let key of __getOwnPropNames(mod))
|
|
24
12
|
if (!__hasOwnProp.call(to, key))
|
|
25
13
|
__defProp(to, key, {
|
|
26
|
-
get:
|
|
14
|
+
get: () => mod[key],
|
|
27
15
|
enumerable: true
|
|
28
16
|
});
|
|
29
|
-
if (canCache)
|
|
30
|
-
cache.set(mod, to);
|
|
31
17
|
return to;
|
|
32
18
|
};
|
|
33
19
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
-
var __returnValue = (v) => v;
|
|
35
|
-
function __exportSetter(name, newValue) {
|
|
36
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
37
|
-
}
|
|
38
20
|
var __export = (target, all) => {
|
|
39
21
|
for (var name in all)
|
|
40
22
|
__defProp(target, name, {
|
|
41
23
|
get: all[name],
|
|
42
24
|
enumerable: true,
|
|
43
25
|
configurable: true,
|
|
44
|
-
set:
|
|
26
|
+
set: (newValue) => all[name] = () => newValue
|
|
45
27
|
});
|
|
46
28
|
};
|
|
47
29
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -350,7 +332,8 @@ class FuseIndex {
|
|
|
350
332
|
value: item
|
|
351
333
|
});
|
|
352
334
|
});
|
|
353
|
-
}
|
|
335
|
+
} else
|
|
336
|
+
;
|
|
354
337
|
}
|
|
355
338
|
record.$[keyIndex] = subRecords;
|
|
356
339
|
} else if (isString(value) && !isBlank(value)) {
|
|
@@ -1419,6 +1402,32 @@ async function readConfig(root) {
|
|
|
1419
1402
|
function resolveInstallDir(root, config) {
|
|
1420
1403
|
return path.join(root, config.installDir ?? DEFAULT_INSTALL_DIR);
|
|
1421
1404
|
}
|
|
1405
|
+
async function getInstallDir(opts) {
|
|
1406
|
+
if (opts.installDir)
|
|
1407
|
+
return opts.installDir;
|
|
1408
|
+
const root = await findProjectRoot(opts.cwd);
|
|
1409
|
+
return resolveInstallDir(root, await readConfig(root));
|
|
1410
|
+
}
|
|
1411
|
+
async function installRecipe(recipe, opts = {}) {
|
|
1412
|
+
const installDir = await getInstallDir(opts);
|
|
1413
|
+
const written = [];
|
|
1414
|
+
for (const file of recipe.files) {
|
|
1415
|
+
const dest = path2.join(installDir, file.path);
|
|
1416
|
+
const dir = path2.dirname(dest);
|
|
1417
|
+
if (!existsSync2(dir))
|
|
1418
|
+
await fs2.mkdir(dir, { recursive: true });
|
|
1419
|
+
await fs2.writeFile(dest, file.source);
|
|
1420
|
+
written.push(dest);
|
|
1421
|
+
}
|
|
1422
|
+
return written;
|
|
1423
|
+
}
|
|
1424
|
+
async function installPlan(plan, opts = {}) {
|
|
1425
|
+
const written = [];
|
|
1426
|
+
for (const r of [plan.recipe, ...plan.transitiveRecipes]) {
|
|
1427
|
+
written.push(...await installRecipe(r, opts));
|
|
1428
|
+
}
|
|
1429
|
+
return written;
|
|
1430
|
+
}
|
|
1422
1431
|
async function getJSON(url) {
|
|
1423
1432
|
const res = await fetch(url, { headers: { Accept: "application/json" } });
|
|
1424
1433
|
if (!res.ok) {
|
|
@@ -1466,36 +1475,10 @@ async function resolveRecipe(slug, opts = {}) {
|
|
|
1466
1475
|
})();
|
|
1467
1476
|
const recipe = seen.get(slug);
|
|
1468
1477
|
const transitiveRecipes = Array.from(seen.values()).filter((r) => r.slug !== slug);
|
|
1469
|
-
const
|
|
1470
|
-
const targetPaths = [recipe, ...transitiveRecipes].flatMap((r) => r.files.map((f) =>
|
|
1478
|
+
const path3 = await import("node:path");
|
|
1479
|
+
const targetPaths = [recipe, ...transitiveRecipes].flatMap((r) => r.files.map((f) => path3.join(installDir, f.path)));
|
|
1471
1480
|
return { recipe, transitiveRecipes, targetPaths };
|
|
1472
1481
|
}
|
|
1473
|
-
async function getInstallDir(opts) {
|
|
1474
|
-
if (opts.installDir)
|
|
1475
|
-
return opts.installDir;
|
|
1476
|
-
const root = await findProjectRoot(opts.cwd);
|
|
1477
|
-
return resolveInstallDir(root, await readConfig(root));
|
|
1478
|
-
}
|
|
1479
|
-
async function installRecipe(recipe, opts = {}) {
|
|
1480
|
-
const installDir = await getInstallDir(opts);
|
|
1481
|
-
const written = [];
|
|
1482
|
-
for (const file of recipe.files) {
|
|
1483
|
-
const dest = path2.join(installDir, file.path);
|
|
1484
|
-
const dir = path2.dirname(dest);
|
|
1485
|
-
if (!existsSync2(dir))
|
|
1486
|
-
await fs2.mkdir(dir, { recursive: true });
|
|
1487
|
-
await fs2.writeFile(dest, file.source);
|
|
1488
|
-
written.push(dest);
|
|
1489
|
-
}
|
|
1490
|
-
return written;
|
|
1491
|
-
}
|
|
1492
|
-
async function installPlan(plan, opts = {}) {
|
|
1493
|
-
const written = [];
|
|
1494
|
-
for (const r of [plan.recipe, ...plan.transitiveRecipes]) {
|
|
1495
|
-
written.push(...await installRecipe(r, opts));
|
|
1496
|
-
}
|
|
1497
|
-
return written;
|
|
1498
|
-
}
|
|
1499
1482
|
var DEFAULT_BASE_URL = "https://base.hanzo.ai", RECIPES_COLLECTION = "gui_recipes", DEFAULT_INSTALL_DIR = "src/gui", DEFAULT_CONFIG_FILENAMES;
|
|
1500
1483
|
var init_dist = __esm(() => {
|
|
1501
1484
|
DEFAULT_CONFIG_FILENAMES = ["gui.config.json", ".guirc.json"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzogui/get",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.1",
|
|
4
4
|
"description": "CLI installer for Hanzo GUI recipes.",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"author": "Hanzo AI <dev@hanzo.ai>",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"test": "bun test"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@hanzogui/recipes": "8.1.
|
|
33
|
+
"@hanzogui/recipes": "8.1.1",
|
|
34
34
|
"fuse.js": "7.1.0"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|