@mccaskie-labs/workbench-site 0.15.1 → 0.15.2
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 +6 -0
- package/dist/builder.js +5 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @mccaskie-labs/workbench-site
|
|
2
2
|
|
|
3
|
+
## 0.15.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Two pages on the same menu number (header, footer, admin menu or Admin home's counts) keep one order, by address, whatever order they were added in.
|
|
8
|
+
|
|
3
9
|
## 0.15.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/builder.js
CHANGED
|
@@ -479,13 +479,15 @@ function indexFile(pages, byId) {
|
|
|
479
479
|
].join("\n");
|
|
480
480
|
}
|
|
481
481
|
/** src/pages/needs.ts: the admin dashboard's counts, one per page on the site that has one, in the admin menu's order. */
|
|
482
|
+
/** Two menu places on the same number keep one order: by address. */
|
|
483
|
+
const byText = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
482
484
|
function needsFile(pages, byId) {
|
|
483
485
|
const counts = pages
|
|
484
486
|
.flatMap((p) => {
|
|
485
487
|
const r = byId.get(p.recipe);
|
|
486
488
|
return r?.needsYou && p.path !== null ? [{ order: r.menu?.admin ?? 1000, label: r.needsYou.label, href: p.path, file: r.needsYou.file, fn: r.needsYou.fn }] : [];
|
|
487
489
|
})
|
|
488
|
-
.sort((a, b) => a.order - b.order);
|
|
490
|
+
.sort((a, b) => a.order - b.order || byText(a.href, b.href));
|
|
489
491
|
const imports = [...new Map(counts.map((c) => [`${c.fn}|${c.file}`, c])).values()].map((c) => `import { ${c.fn} } from "./${c.file.replace(/^src\/pages\//, "")}";`);
|
|
490
492
|
return [
|
|
491
493
|
`// Generated by ${PACKAGE} from workbench/site.json and its recipes: \`npx workbench-site add <page>\``,
|
|
@@ -558,7 +560,7 @@ function navFile(pages, byId) {
|
|
|
558
560
|
const entries = (place) => pages
|
|
559
561
|
.map((p) => ({ p, menu: byId.get(p.recipe)?.menu }))
|
|
560
562
|
.filter((x) => x.p.path !== null && x.menu?.[place] !== undefined)
|
|
561
|
-
.sort((a, b) => a.menu[place] - b.menu[place])
|
|
563
|
+
.sort((a, b) => a.menu[place] - b.menu[place] || byText(a.p.path, b.p.path))
|
|
562
564
|
.map(({ p, menu }) => ` [${JSON.stringify(menu.label)}, ${JSON.stringify(p.path)}],`);
|
|
563
565
|
const admin = [
|
|
564
566
|
...pages.flatMap((p) => {
|
|
@@ -567,7 +569,7 @@ function navFile(pages, byId) {
|
|
|
567
569
|
}),
|
|
568
570
|
...pages.flatMap((p) => (byId.get(p.recipe)?.links ?? []).map((l) => ({ order: l.admin, label: l.label, href: l.href, about: l.about }))),
|
|
569
571
|
]
|
|
570
|
-
.sort((a, b) => a.order - b.order)
|
|
572
|
+
.sort((a, b) => a.order - b.order || byText(a.href, b.href))
|
|
571
573
|
.map((l) => ` [${JSON.stringify(l.label)}, ${JSON.stringify(l.href)}, ${JSON.stringify(l.about)}],`);
|
|
572
574
|
const list = (lines) => (lines.length ? `[\n${lines.join("\n")}\n]` : "[]");
|
|
573
575
|
return [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mccaskie-labs/workbench-site",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "A Workbench project's standard pages: page recipes, the builder that turns them into thin page files calling Workbench's tools, and the page frames and sections they are drawn with (wb-site-*, restylable, on the project's theme tokens).",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|