File tree Expand file tree Collapse file tree 3 files changed +22
-25
lines changed
packages/plugin-typescript/src/lib/runner Expand file tree Collapse file tree 3 files changed +22
-25
lines changed Original file line number Diff line number Diff line change 11import 'dotenv/config' ;
2- import { z } from 'zod' ;
2+ import { z } from 'zod' ;
33import {
44 coverageCoreConfigNx ,
55 eslintCoreConfigNx ,
66 jsPackagesCoreConfig ,
77 lighthouseCoreConfig ,
88 typescriptPluginConfigNx ,
99} from './code-pushup.preset.js' ;
10- import type { CoreConfig } from './packages/models/src/index.js' ;
11- import { BASIC_CHECKES } from './packages/plugin-typescript/src/lib/constants' ;
12- import { mergeConfigs } from './packages/utils/src/index.js' ;
10+ import type { CoreConfig } from './packages/models/src/index.js' ;
11+ import { BASIC_CHECKES } from './packages/plugin-typescript/src/lib/constants' ;
12+ import { mergeConfigs } from './packages/utils/src/index.js' ;
1313
1414// load upload configuration from environment
1515const envSchema = z . object ( {
@@ -18,7 +18,7 @@ const envSchema = z.object({
1818 CP_ORGANIZATION : z . string ( ) . min ( 1 ) ,
1919 CP_PROJECT : z . string ( ) . min ( 1 ) ,
2020} ) ;
21- const { data : env } = await envSchema . safeParseAsync ( process . env ) ;
21+ const { data : env } = await envSchema . safeParseAsync ( process . env ) ;
2222
2323const config : CoreConfig = {
2424 ...( env && {
Original file line number Diff line number Diff line change 11import type {
2- Audit ,
32 CategoryConfig ,
4- CategoryRef ,
53 CoreConfig ,
64} from './packages/models/src/index.js' ;
75import coveragePlugin , {
@@ -16,7 +14,7 @@ import lighthousePlugin, {
1614 lighthouseGroupRef ,
1715} from './packages/plugin-lighthouse/src/index.js' ;
1816import { typescriptPlugin } from './packages/plugin-typescript/src' ;
19- import { AUDITS as tsAudits } from './packages/plugin-typescript/src/lib/generated/audits' ;
17+ import { AUDITS } from './packages/plugin-typescript/src/lib/generated/audits' ;
2018import { TypescriptPluginOptions } from './packages/plugin-typescript/src/lib/typescript-plugin' ;
2119
2220export const jsPackagesCategories : CategoryConfig [ ] = [
@@ -139,21 +137,18 @@ export const typescriptPluginConfigNx = async (
139137) : Promise < CoreConfig > => {
140138 return {
141139 plugins : [ await typescriptPlugin ( options ) ] ,
142- /*...(supportedAuditSlugs.length > 0 ? {
143- categories: [
144- {
145- slug: 'typescript',
146- title: 'Typescript',
147- refs: supportedAuditSlugs
148- .map(({slug}) => ({
149- plugin: 'typescript',
150- type: 'audit' as const,
151- slug,
152- weight: 1
153- }))
154- }
155- ]
156- } : {})*/
140+ categories : [
141+ {
142+ slug : 'typescript' ,
143+ title : 'Typescript' ,
144+ refs : AUDITS . map ( ( { slug } ) => ( {
145+ plugin : 'typescript' ,
146+ type : 'audit' as const ,
147+ slug,
148+ weight : 1 ,
149+ } ) ) ,
150+ } ,
151+ ] ,
157152 } ;
158153} ;
159154
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import type {
77 RunnerFunction ,
88} from '@code-pushup/models' ;
99import type { TypescriptPluginOptions } from '../config.js' ;
10+ import { AUDITS } from '../generated/audits.js' ;
1011import type { AuditSlug } from '../types.js' ;
1112import { getDiagnostics } from './typescript-runner.js' ;
1213import {
@@ -53,10 +54,11 @@ export function createRunnerFunction(
5354 > ,
5455 ) ;
5556
56- return Object . values ( result ) . map ( ( { slug, details } ) => {
57+ return AUDITS . map ( audit => {
58+ const { details } = result [ audit . slug as AuditSlug ] ?? { } ;
5759 const issues = details ?. issues ?? [ ] ;
5860 return {
59- slug ,
61+ ... audit ,
6062 score : issues . length === 0 ? 1 : 0 ,
6163 value : issues . length ,
6264 ...( issues . length > 0 ? { details } : { } ) ,
You can’t perform that action at this time.
0 commit comments