@fluid-app/fluid-cli-theme-dev 0.1.189 → 0.1.190
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.mjs +47 -0
- package/dist/index.mjs.map +1 -1
- package/dist/skills/themes-review/SKILL.md +13 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1465,6 +1465,51 @@ function findMissingSectionReferences(templates, existingSectionNames) {
|
|
|
1465
1465
|
return missing;
|
|
1466
1466
|
}
|
|
1467
1467
|
//#endregion
|
|
1468
|
+
//#region ../../platform/theme-schema/src/templates.ts
|
|
1469
|
+
const ROUTED_TEMPLATE_TYPES = {
|
|
1470
|
+
home_page: "/",
|
|
1471
|
+
shop_page: "/home/shop",
|
|
1472
|
+
product: "/home/products/<slug>",
|
|
1473
|
+
collection: "/home/collections/<slug>",
|
|
1474
|
+
collection_page: "/home/collections",
|
|
1475
|
+
category: "/home/categories/<slug>",
|
|
1476
|
+
category_page: "/home/categories",
|
|
1477
|
+
post: "/home/posts/<slug>",
|
|
1478
|
+
post_page: "/home/blog",
|
|
1479
|
+
page: "/home/pages/<slug>",
|
|
1480
|
+
enrollment_pack: "/home/enrollments/<slug>",
|
|
1481
|
+
library: "/home/libraries/<slug>",
|
|
1482
|
+
medium: "/home/media/<slug>",
|
|
1483
|
+
cart_page: "/cart",
|
|
1484
|
+
join_page: "/home/join"
|
|
1485
|
+
};
|
|
1486
|
+
/**
|
|
1487
|
+
* Find the routed storefront template types a theme has no template for.
|
|
1488
|
+
* `presentTypes` holds the theme's top-level page-type folder names (`product`,
|
|
1489
|
+
* `post`, …). Emits one `warning` per missing type: a store that doesn't use a
|
|
1490
|
+
* page type (a blog, playlists) can leave it out, so this doesn't fail lint.
|
|
1491
|
+
*/
|
|
1492
|
+
function findMissingTemplateTypes(presentTypes) {
|
|
1493
|
+
const missing = [];
|
|
1494
|
+
for (const [templateType, exampleUrl] of Object.entries(ROUTED_TEMPLATE_TYPES)) {
|
|
1495
|
+
if (presentTypes.has(templateType)) continue;
|
|
1496
|
+
const expectedPath = `${templateType}/default/index.liquid`;
|
|
1497
|
+
missing.push({
|
|
1498
|
+
templateType,
|
|
1499
|
+
expectedPath,
|
|
1500
|
+
diagnostic: {
|
|
1501
|
+
severity: "warning",
|
|
1502
|
+
message: `no '${templateType}' template: ${exampleUrl} shows the home page instead. Add ${expectedPath} rather than redirecting from the layout`,
|
|
1503
|
+
target: {
|
|
1504
|
+
kind: "template",
|
|
1505
|
+
templateType
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
return missing;
|
|
1511
|
+
}
|
|
1512
|
+
//#endregion
|
|
1468
1513
|
//#region src/theme/file.ts
|
|
1469
1514
|
const NON_TEMPLATE_DIRS = new Set([
|
|
1470
1515
|
"sections",
|
|
@@ -6022,6 +6067,8 @@ function createLintCommand() {
|
|
|
6022
6067
|
content
|
|
6023
6068
|
}));
|
|
6024
6069
|
for (const missing of findMissingSectionReferences(referrers, existingSectionNames)) record(missing.templatePath, missing.diagnostic);
|
|
6070
|
+
const presentTemplateTypes = new Set(liquidFiles.map(({ file }) => file).filter((f) => f.isTemplate && f.name === "index.liquid").map((f) => f.relativePath.split(/[/\\]/)[0]));
|
|
6071
|
+
for (const missing of findMissingTemplateTypes(presentTemplateTypes)) record(missing.expectedPath, missing.diagnostic);
|
|
6025
6072
|
const results = [...byFile.entries()].map(([path, diagnostics]) => ({
|
|
6026
6073
|
path,
|
|
6027
6074
|
diagnostics
|