@ubercode/channelvault 0.1.0 → 0.2.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/CHANGELOG.md +22 -0
- package/README.md +27 -3
- package/dist/cli.js +164 -37
- package/dist/cli.js.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/docs/roadmap.md +8 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -625,12 +625,17 @@ async function splitCollection(parent, containerKey, elementKey, root, serverDir
|
|
|
625
625
|
const wasArray = Array.isArray(raw);
|
|
626
626
|
const elements = asArray(raw);
|
|
627
627
|
const refs = [];
|
|
628
|
+
const byName = (el) => `${slug(el["name"]).toLowerCase()}\0${String(el["id"] ?? "")}`;
|
|
629
|
+
const slugs = /* @__PURE__ */ new Map();
|
|
630
|
+
for (const el of elements.filter(isPlainObject).sort((a, b) => byName(a) < byName(b) ? -1 : byName(a) > byName(b) ? 1 : 0)) {
|
|
631
|
+
slugs.set(el, uniqueSlug(slug(el["name"]), usedSlugs));
|
|
632
|
+
}
|
|
628
633
|
for (const el of elements) {
|
|
629
634
|
if (!isPlainObject(el)) {
|
|
630
635
|
refs.push(el);
|
|
631
636
|
continue;
|
|
632
637
|
}
|
|
633
|
-
const slugName =
|
|
638
|
+
const slugName = slugs.get(el);
|
|
634
639
|
const { jsonFile, resourceDir } = targetFor(el["name"], slugName);
|
|
635
640
|
const transformed = await explodeResource(el, resourceDir);
|
|
636
641
|
await writeJson(jsonFile, transformed);
|