|
1 | | -const DEFAULT_CHECK_PATHS = ['/']; |
2 | | -const DEFAULT_FAIL_WITH_ISSUES = true; |
3 | | -const DEFAULT_IGNORE_DIRECTORIES = []; |
4 | | -const PA11Y_DEFAULT_STANDARD = 'WCAG2AA'; |
5 | | -const PA11Y_RUNNERS = ['axe']; |
6 | | -const PA11Y_USER_AGENT = 'netlify-plugin-a11y'; |
7 | | - |
8 | | -const DEFAULT_INPUTS = { |
9 | | - checkPaths: DEFAULT_CHECK_PATHS, |
10 | | - |
| 1 | +const DEFAULT_CHECK_PATHS = ['/'] |
| 2 | +const DEFAULT_FAIL_WITH_ISSUES = true |
| 3 | +const DEFAULT_IGNORE_DIRECTORIES = [] |
| 4 | +const PA11Y_DEFAULT_STANDARD = 'WCAG2AA' |
| 5 | +const PA11Y_RUNNERS = ['axe'] |
| 6 | +const PA11Y_USER_AGENT = 'netlify-plugin-a11y' |
| 7 | +const getConfiguration = ({ |
| 8 | + constants: { PUBLISH_DIR }, |
| 9 | + inputs: { checkPaths, debugMode, ignoreDirectories, failWithIssues, standard }, |
| 10 | +}) => { |
| 11 | + return { |
| 12 | + absolutePublishDir: PUBLISH_DIR || process.env.PUBLISH_DIR, |
| 13 | + checkPaths: checkPaths || DEFAULT_CHECK_PATHS, |
| 14 | + debugMode: debugMode || false, |
| 15 | + ignoreDirectories: ignoreDirectories || DEFAULT_IGNORE_DIRECTORIES, |
| 16 | + failWithIssues: failWithIssues !== undefined ? failWithIssues : DEFAULT_FAIL_WITH_ISSUES, |
| 17 | + pa11yOpts: { |
| 18 | + runners: PA11Y_RUNNERS, |
| 19 | + userAgent: PA11Y_USER_AGENT, |
| 20 | + standard: standard || PA11Y_DEFAULT_STANDARD, |
| 21 | + }, |
| 22 | + } |
11 | 23 | } |
12 | | -const getConfiguration = ({ constants: { PUBLISH_DIR }, inputs: { checkPaths, debugMode, ignoreDirectories, failWithIssues, standard } = { |
13 | | - |
14 | | -}, }) => { |
15 | | - return { |
16 | | - absolutePublishDir: PUBLISH_DIR || process.env.PUBLISH_DIR, |
17 | | - checkPaths: checkPaths || DEFAULT_CHECK_PATHS, |
18 | | - debugMode: debugMode || false, |
19 | | - ignoreDirectories: ignoreDirectories || DEFAULT_IGNORE_DIRECTORIES, |
20 | | - failWithIssues: failWithIssues !== undefined ? failWithIssues : DEFAULT_FAIL_WITH_ISSUES, |
21 | | - pa11yOpts: { |
22 | | - runners: PA11Y_RUNNERS, |
23 | | - userAgent: PA11Y_USER_AGENT, |
24 | | - standard: standard || PA11Y_DEFAULT_STANDARD, |
25 | | - }, |
26 | | - }; |
27 | | -}; |
28 | 24 | module.exports = { |
29 | | - getConfiguration, |
30 | | -}; |
| 25 | + getConfiguration, |
| 26 | +} |
0 commit comments