Refactor tool catalog into documentation layout
All checks were successful
Deploy Sokko G / deploy (push) Successful in 7s

This commit is contained in:
Shinuwa 2026-08-09 13:34:08 +02:00
parent d53d4160af
commit a9b5ca423a
12 changed files with 1925 additions and 114 deletions

View file

@ -53,8 +53,22 @@ export function validateSiteContent(site) {
"library.summaryLabel",
"library.tocLabel",
"library.tocTitle",
"library.docTocTitle",
"library.tocDescription",
"library.toolsLabel",
"library.categoryLabel",
"library.featureHeading",
"library.controlLegendHeading",
"library.categories.notesTracking",
"library.categories.references",
"library.categories.calculationData",
"library.categories.timeRoutines",
"library.categories.buildsCommands",
"library.categoryDescriptions.notesTracking",
"library.categoryDescriptions.references",
"library.categoryDescriptions.calculationData",
"library.categoryDescriptions.timeRoutines",
"library.categoryDescriptions.buildsCommands",
"home.hero.eyebrow",
"home.hero.title",
"home.hero.description",
@ -442,6 +456,45 @@ export function validateSiteContent(site) {
assert.equal(typeof item, "object", `library.summaryItems[${index}] must be an object`);
});
const libraryToolDocs = valueAt(site, "library.toolDocs");
["notepad", "checklist", "counters", "images", "imageAnnotation", "links", "calculator", "table", "timer", "taskPlanner", "combos", "equipmentPlanner"].forEach((toolType) => {
const docs = libraryToolDocs?.[toolType];
assert.equal(typeof docs, "object", `library.toolDocs.${toolType} must be an object`);
assert.ok(Array.isArray(docs.controls), `library.toolDocs.${toolType}.controls must be an array`);
assert.ok(docs.controls.length >= 1, `library.toolDocs.${toolType}.controls must not be empty`);
docs.controls.forEach((control, index) => {
assert.equal(typeof control, "object", `library.toolDocs.${toolType}.controls[${index}] must be an object`);
assertNonEmptyString({ control }, "control.group");
assertNonEmptyString({ control }, "control.icon");
assertNonEmptyString({ control }, "control.title");
if (control.text) assertNonEmptyString({ control }, "control.text");
if (control.preview) {
assert.equal(typeof control.preview, "object", `library.toolDocs.${toolType}.controls[${index}].preview must be an object`);
assertNonEmptyString({ preview: control.preview }, "preview.kind");
}
});
assert.ok(Array.isArray(docs.features), `library.toolDocs.${toolType}.features must be an array`);
assert.ok(docs.features.length >= 1, `library.toolDocs.${toolType}.features must not be empty`);
docs.features.forEach((feature, index) => {
assertNonEmptyString({ feature }, "feature.title");
assertNonEmptyString({ feature }, "feature.text");
assert.equal(typeof feature, "object", `library.toolDocs.${toolType}.features[${index}] must be an object`);
if (feature.details) {
assert.ok(Array.isArray(feature.details), `library.toolDocs.${toolType}.features[${index}].details must be an array`);
assert.ok(feature.details.length >= 1, `library.toolDocs.${toolType}.features[${index}].details must not be empty`);
feature.details.forEach((detail, detailIndex) => {
assert.equal(typeof detail, "string", `library.toolDocs.${toolType}.features[${index}].details[${detailIndex}] must be a string`);
assert.ok(detail.trim(), `library.toolDocs.${toolType}.features[${index}].details[${detailIndex}] must not be empty`);
});
}
});
if (docs.importFormat) {
assertNonEmptyString({ importFormat: docs.importFormat }, "importFormat.title");
assertNonEmptyString({ importFormat: docs.importFormat }, "importFormat.text");
assertNonEmptyString({ importFormat: docs.importFormat }, "importFormat.example");
}
});
const aboutLimits = valueAt(site, "about.limits");
assert.ok(Array.isArray(aboutLimits), "about.limits must be an array");
assert.ok(aboutLimits.length >= 3, "about.limits must contain at least 3 items");