11/* eslint-disable @nx/enforce-module-boundaries */
22import { createProjectGraphAsync } from '@nx/devkit' ;
3- import type {
4- CategoryConfig ,
5- CoreConfig ,
6- PluginUrls ,
7- } from './packages/models/src/index.js' ;
8- import axePlugin , { axeCategories } from './packages/plugin-axe/src/index.js' ;
3+ import type { CoreConfig , PluginUrls } from './packages/models/src/index.js' ;
4+ import axePlugin , {
5+ type AxePluginOptions ,
6+ axeGroupRefs ,
7+ } from './packages/plugin-axe/src/index.js' ;
98import coveragePlugin , {
109 type CoveragePluginConfig ,
1110 getNxCoveragePaths ,
@@ -16,12 +15,12 @@ import eslintPlugin, {
1615import jsPackagesPlugin from './packages/plugin-js-packages/src/index.js' ;
1716import jsDocsPlugin from './packages/plugin-jsdocs/src/index.js' ;
1817import {
19- lighthouseCategories ,
20- lighthouseGroupRef ,
18+ lighthouseGroupRefs ,
2119 lighthousePlugin ,
2220} from './packages/plugin-lighthouse/src/index.js' ;
2321import typescriptPlugin , {
2422 getCategories ,
23+ tsconfigFromAllNxProjects ,
2524} from './packages/plugin-typescript/src/index.js' ;
2625
2726export function configureUpload ( projectName : string = 'workspace' ) : CoreConfig {
@@ -152,10 +151,17 @@ export async function configureJsPackagesPlugin(): Promise<CoreConfig> {
152151 } ;
153152}
154153
155- export function configureTypescriptPlugin ( projectName ?: string ) : CoreConfig {
154+ export async function configureTypescriptPlugin (
155+ projectName ?: string ,
156+ ) : Promise < CoreConfig > {
156157 const tsconfig = projectName
157158 ? `packages/${ projectName } /tsconfig.lib.json`
158- : 'tsconfig.code-pushup.json' ;
159+ : await tsconfigFromAllNxProjects ( {
160+ exclude : [
161+ 'test-fixtures' , // Intentionally incomplete tsconfigs
162+ 'models' , // Uses ts-patch transformer plugin
163+ ] ,
164+ } ) ;
159165 return {
160166 plugins : [ typescriptPlugin ( { tsconfig } ) ] ,
161167 categories : getCategories ( ) ,
@@ -195,38 +201,46 @@ export async function configureLighthousePlugin(
195201 urls : PluginUrls ,
196202) : Promise < CoreConfig > {
197203 const lhPlugin = await lighthousePlugin ( urls ) ;
198- const lhCategories : CategoryConfig [ ] = [
199- {
200- slug : 'performance' ,
201- title : 'Performance' ,
202- refs : [ lighthouseGroupRef ( 'performance' ) ] ,
203- } ,
204- {
205- slug : 'a11y' ,
206- title : 'Accessibility' ,
207- refs : [ lighthouseGroupRef ( 'accessibility' ) ] ,
208- } ,
209- {
210- slug : 'best-practices' ,
211- title : 'Best Practices' ,
212- refs : [ lighthouseGroupRef ( 'best-practices' ) ] ,
213- } ,
214- {
215- slug : 'seo' ,
216- title : 'SEO' ,
217- refs : [ lighthouseGroupRef ( 'seo' ) ] ,
218- } ,
219- ] ;
220204 return {
221205 plugins : [ lhPlugin ] ,
222- categories : lighthouseCategories ( lhPlugin , lhCategories ) ,
206+ categories : [
207+ {
208+ slug : 'performance' ,
209+ title : 'Performance' ,
210+ refs : lighthouseGroupRefs ( lhPlugin , 'performance' ) ,
211+ } ,
212+ {
213+ slug : 'a11y' ,
214+ title : 'Accessibility' ,
215+ refs : lighthouseGroupRefs ( lhPlugin , 'accessibility' ) ,
216+ } ,
217+ {
218+ slug : 'best-practices' ,
219+ title : 'Best Practices' ,
220+ refs : lighthouseGroupRefs ( lhPlugin , 'best-practices' ) ,
221+ } ,
222+ {
223+ slug : 'seo' ,
224+ title : 'SEO' ,
225+ refs : lighthouseGroupRefs ( lhPlugin , 'seo' ) ,
226+ } ,
227+ ] ,
223228 } ;
224229}
225230
226- export function configureAxePlugin ( urls : PluginUrls ) : CoreConfig {
227- const axe = axePlugin ( urls ) ;
231+ export function configureAxePlugin (
232+ urls : PluginUrls ,
233+ options ?: AxePluginOptions ,
234+ ) : CoreConfig {
235+ const axe = axePlugin ( urls , options ) ;
228236 return {
229237 plugins : [ axe ] ,
230- categories : axeCategories ( axe ) ,
238+ categories : [
239+ {
240+ slug : 'axe-a11y' ,
241+ title : 'Axe Accessibility' ,
242+ refs : axeGroupRefs ( axe ) ,
243+ } ,
244+ ] ,
231245 } ;
232246}
0 commit comments