Skip to content

Commit

Permalink
chore(rules): fix import rules target path
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Mar 11, 2024
1 parent e6783b3 commit 2314195
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions kayle/builder/build-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ import type { Rule } from "./build-types";
};
// import rule list with locales
export const importRules = async (locale: ${localesList.map((l) => `"${l}"`).join(" | ")}, runner: "htmlcs" | "axe"): Promise<Rule[]> => {
export const importRules = async (locale: ${localesList.map((l) => `"${l}"`).join(" | ")}, runner: "htmlcs" | "axe", baseDir?: "string"): Promise<Rule[]> => {
const rules = await import(` +
"`./${locale.replace('-', '_')}/${runner === 'htmlcs' ? 'htmlcs' : 'axe'}-rules`" +
"`${baseDir || './'}${locale.replace('-', '_')}/${runner === 'htmlcs' ? 'htmlcs' : 'axe'}-rules`" +
`` +
`);
Expand Down
3 changes: 2 additions & 1 deletion kayle/lib/rules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ export const importRules = async (
| "pt_BR"
| "en",
runner: "htmlcs" | "axe",
baseDir?: "string",
): Promise<Rule[]> => {
const rules = await import(
`./${locale.replace("-", "_")}/${runner === "htmlcs" ? "htmlcs" : "axe"}-rules`
`${baseDir || "./"}${locale.replace("-", "_")}/${runner === "htmlcs" ? "htmlcs" : "axe"}-rules`
);

return rules.axeRules || rules.htmlcsRules;
Expand Down
2 changes: 1 addition & 1 deletion kayle/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kayle",
"version": "0.8.37",
"version": "0.8.40",
"description": "Extremely fast and accurate accessibility engine built for any headless tool like playwright or puppeteer.",
"main": "./build/index.js",
"keywords": [
Expand Down

0 comments on commit 2314195

Please sign in to comment.