Skip to content

Commit 54d79ba

Browse files
committed
Bugfix: pa11y requires absolute paths for local files
See also: https://github.com/pa11y/pa11y PUBLISH_DIR is a relative path. This changes it to use the config to get the absolute path.
1 parent 9cf1a75 commit 54d79ba

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

plugin/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ const pluginCore = require('./pluginCore');
1010
module.exports = {
1111
async onPostBuild({
1212
inputs: { checkPaths, ignoreDirectories, resultMode, debugMode },
13-
constants: { PUBLISH_DIR },
14-
utils: { build }
13+
utils: { build },
14+
netlifyConfig
1515
}) {
1616
const htmlFilePaths = await pluginCore.generateFilePaths({
1717
fileAndDirPaths: checkPaths,
1818
ignoreDirectories: ignoreDirectories || [],
19-
PUBLISH_DIR
19+
absolutePublishDir: netlifyConfig.build.publish
2020
});
2121
if (debugMode) {
2222
console.log({ htmlFilePaths });

plugin/pluginCore.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const runPa11yOnFile = async function(htmlFilePath, build) {
3636
exports.generateFilePaths = async function({
3737
fileAndDirPaths, // array, mix of html and directories
3838
ignoreDirectories = [],
39-
PUBLISH_DIR,
39+
absolutePublishDir,
4040
testMode,
4141
debugMode
4242
}) {
@@ -46,7 +46,7 @@ exports.generateFilePaths = async function({
4646
);
4747
const htmlFilePaths = await Promise.all(
4848
fileAndDirPaths.map(fileAndDirPath =>
49-
findHtmlFiles(`${PUBLISH_DIR}${fileAndDirPath}`, excludeDirGlobs)
49+
findHtmlFiles(`${absolutePublishDir}${fileAndDirPath}`, excludeDirGlobs)
5050
)
5151
)
5252
return [].concat(...htmlFilePaths)

0 commit comments

Comments
 (0)