diff --git a/11ty/guidelines.ts b/11ty/guidelines.ts index 7eb46f29dd..e033c0964e 100644 --- a/11ty/guidelines.ts +++ b/11ty/guidelines.ts @@ -6,7 +6,7 @@ import { readFile } from "fs/promises"; import { basename } from "path"; import { flattenDomFromFile, load } from "./cheerio"; -import { generateId, resolveDecimalVersion } from "./common"; +import { generateId } from "./common"; export type WcagVersion = "20" | "21" | "22"; export function assertIsWcagVersion(v: string): asserts v is WcagVersion { @@ -29,9 +29,10 @@ type ActMapping = { "act-rules": ActRule[]; }; -/** Retrieves act-mapping.json data for test-rules sections. */ -export const getActRules = async () => - (JSON.parse(await readFile("guidelines/act-mapping.json", "utf8")) as ActMapping)["act-rules"]; +/** Data used for test-rules sections, from act-mapping.json */ +export const actRules = ( + JSON.parse(await readFile("guidelines/act-mapping.json", "utf8")) as ActMapping +)["act-rules"]; /** * Flattened object hash, mapping each WCAG 2 SC slug to the earliest WCAG version it applies to. @@ -280,16 +281,6 @@ export const getAcknowledgementsForVersion = async (version: WcagVersion) => { return subsections; }; -/** - * Retrieves act-mapping.json data for test-rules sections, pinned to an earlier WCAG version. - */ -export const getActRulesForVersion = async (version: WcagVersion) => - ( - await axios.get( - `https://raw.githubusercontent.com/w3c/wcag/refs/heads/WCAG-${resolveDecimalVersion(version)}/guidelines/act-mapping.json` - ) - ).data["act-rules"]; - /** * Retrieves and processes a pinned WCAG version using published guidelines. */ diff --git a/eleventy.config.ts b/eleventy.config.ts index dd313feec8..529bee8e0c 100644 --- a/eleventy.config.ts +++ b/eleventy.config.ts @@ -5,9 +5,8 @@ import { copyFile } from "fs/promises"; import { CustomLiquid } from "11ty/CustomLiquid"; import { resolveDecimalVersion } from "11ty/common"; import { + actRules, assertIsWcagVersion, - getActRules, - getActRulesForVersion, getFlatGuidelines, getPrinciples, getPrinciplesForVersion, @@ -47,10 +46,6 @@ const isTechniqueObsolete = (technique: Technique | undefined) => const isGuidelineObsolete = (guideline: Principle | Guideline | SuccessCriterion | undefined) => guideline?.type === "SC" && guideline.level === ""; -const actRules = process.env.WCAG_VERSION - ? await getActRulesForVersion(version) - : await getActRules(); - /** Tree of Principles/Guidelines/SC across all versions (including later than selected) */ const allPrinciples = await getPrinciples(); /** Flattened Principles/Guidelines/SC across all versions (including later than selected) */