Skip to content

Commit 36fc93e

Browse files
committed
feat(plugin-axe): add plugin setup
1 parent cff690d commit 36fc93e

File tree

7 files changed

+65
-3
lines changed

7 files changed

+65
-3
lines changed

code-pushup.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dotenv/config';
22
import {
3+
axeCoreConfig,
34
coverageCoreConfigNx,
45
eslintCoreConfigNx,
56
jsDocsCoreConfig,
@@ -43,4 +44,7 @@ export default mergeConfigs(
4344
'!**/implementation/**',
4445
'!**/internal/**',
4546
]),
47+
axeCoreConfig(
48+
'https://github.com/code-pushup/cli?tab=readme-ov-file#code-pushup-cli/',
49+
),
4650
);

code-pushup.preset.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type {
44
CoreConfig,
55
PluginUrls,
66
} from './packages/models/src/index.js';
7+
import axePlugin from './packages/plugin-axe/src/index.js';
78
import coveragePlugin, {
89
getNxCoveragePaths,
910
} from './packages/plugin-coverage/src/index.js';
@@ -216,3 +217,7 @@ export const coverageCoreConfigNx = async (
216217
categories: coverageCategories,
217218
};
218219
};
220+
221+
export const axeCoreConfig = (urls: PluginUrls): CoreConfig => ({
222+
plugins: [axePlugin(urls)],
223+
});

nx.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,27 @@
306306
}
307307
}
308308
},
309+
"code-pushup-axe": {
310+
"cache": true,
311+
"inputs": ["default", "code-pushup-inputs"],
312+
"outputs": ["{projectRoot}/.code-pushup/axe/runner-output.json"],
313+
"executor": "nx:run-commands",
314+
"options": {
315+
"command": "node packages/cli/src/index.ts collect",
316+
"args": [
317+
"--no-progress",
318+
"--verbose",
319+
"--config={projectRoot}/code-pushup.config.ts",
320+
"--cache.write",
321+
"--onlyPlugins=axe",
322+
"--persist.outputDir={projectRoot}/.code-pushup"
323+
],
324+
"env": {
325+
"NODE_OPTIONS": "--import tsx",
326+
"TSX_TSCONFIG_PATH": "tsconfig.base.json"
327+
}
328+
}
329+
},
309330
"nx-release-publish": {
310331
"dependsOn": ["build"],
311332
"executor": "@nx/js:release-publish",

package-lock.json

Lines changed: 30 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
},
2020
"private": true,
2121
"dependencies": {
22+
"@axe-core/playwright": "^4.11.0",
2223
"@code-pushup/portal-client": "^0.16.0",
2324
"@isaacs/cliui": "^8.0.2",
2425
"@nx/devkit": "21.4.1",
@@ -36,6 +37,7 @@
3637
"nx": "21.4.1",
3738
"ora": "^9.0.0",
3839
"parse-lcov": "^1.0.4",
40+
"playwright-core": "^1.56.1",
3941
"rimraf": "^6.0.1",
4042
"semver": "^7.6.3",
4143
"simple-git": "^3.26.0",

packages/plugin-axe/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
import { axePlugin } from './lib/axe-plugin.js';
22

33
export default axePlugin;
4+
export type { AxePluginOptions } from './lib/config.js';
5+
export type { AxePreset } from './lib/constants.js';

project.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
},
2727
"code-pushup-jsdocs": {},
2828
"code-pushup-typescript": {},
29+
"code-pushup-axe": {},
2930
"code-pushup": {
3031
"dependsOn": ["code-pushup-*"],
3132
"executor": "nx:run-commands",

0 commit comments

Comments
 (0)