Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bbd8648
feat: use jiti for plugin loading
BioPhoton Jan 21, 2026
b2a0154
Merge branch 'refs/heads/main' into feat/jiti-module-loading
BioPhoton Jan 22, 2026
cc442d1
refactor: move loadTargetConfig into utils
BioPhoton Jan 22, 2026
c9cb895
refactor: move importModule into extra file
BioPhoton Jan 22, 2026
aee50d9
refactor: use jiti to load module
BioPhoton Jan 23, 2026
4c75af5
refactor: fix lint
BioPhoton Jan 23, 2026
2f53690
refactor: fix lint
BioPhoton Jan 23, 2026
3428c50
refactor: fix int-test
BioPhoton Jan 23, 2026
e477cbc
refactor: fix unit-test
BioPhoton Jan 23, 2026
81fd996
refactor: fix unit-test
BioPhoton Jan 23, 2026
23ff44d
refactor: fix build
BioPhoton Jan 23, 2026
8447ae2
refactor: fix int-test
BioPhoton Jan 23, 2026
5301aa7
refactor: fix lint
BioPhoton Jan 23, 2026
bf7dd0a
refactor: fix jiti context
BioPhoton Jan 23, 2026
a5319d8
refactor: fix jiti context
BioPhoton Jan 23, 2026
5a67328
refactor: fix int test
BioPhoton Jan 23, 2026
11c493b
refactor: fix e2e test
BioPhoton Jan 23, 2026
1b679b8
refactor: move mocks
BioPhoton Jan 23, 2026
933daf1
refactor: adjust path resolution
BioPhoton Jan 23, 2026
1a51ca9
refactor: fix axe
BioPhoton Jan 23, 2026
51106e9
refactor: fix eslint
BioPhoton Jan 23, 2026
7c3341b
refactor: fix eslint
BioPhoton Jan 23, 2026
03ff1f2
refactor: fix axe
BioPhoton Jan 23, 2026
481b536
refactor: fix import order
BioPhoton Jan 23, 2026
d5125c3
refactor: fix lint
BioPhoton Jan 23, 2026
b7109fb
refactor: add safe axeCore import helper
BioPhoton Jan 23, 2026
ba61c0a
refactor: wip
BioPhoton Jan 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 37 additions & 25 deletions code-pushup.preset.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
/* eslint-disable @nx/enforce-module-boundaries */
import { createProjectGraphAsync } from '@nx/devkit';
import type { CoreConfig, PluginUrls } from './packages/models/src/index.js';
import axePlugin, {
type AxePluginOptions,
axeGroupRefs,
} from './packages/plugin-axe/src/index.js';
import coveragePlugin, {
type CoveragePluginConfig,
getNxCoveragePaths,
} from './packages/plugin-coverage/src/index.js';
import eslintPlugin, {
eslintConfigFromAllNxProjects,
} from './packages/plugin-eslint/src/index.js';
import jsPackagesPlugin from './packages/plugin-js-packages/src/index.js';
import jsDocsPlugin from './packages/plugin-jsdocs/src/index.js';
import {
lighthouseGroupRefs,
lighthousePlugin,
} from './packages/plugin-lighthouse/src/index.js';
import typescriptPlugin, {
getCategories,
} from './packages/plugin-typescript/src/index.js';

export function configureUpload(projectName: string = 'workspace'): CoreConfig {
return {
Expand All @@ -39,6 +19,10 @@ export function configureUpload(projectName: string = 'workspace'): CoreConfig {
export async function configureEslintPlugin(
projectName?: string,
): Promise<CoreConfig> {
const { default: eslintPlugin, eslintConfigFromAllNxProjects } = await import(
'./packages/plugin-eslint/src/index.js'
);

return {
plugins: [
projectName
Expand Down Expand Up @@ -81,8 +65,12 @@ export async function configureEslintPlugin(
export async function configureCoveragePlugin(
projectName?: string,
): Promise<CoreConfig> {
const { default: coveragePlugin, getNxCoveragePaths } = await import(
'./packages/plugin-coverage/src/index.js'
);

const targets = ['unit-test', 'int-test'];
const config: CoveragePluginConfig = projectName
const config = projectName
? // We do not need to run a coverageToolCommand. This is handled over the Nx task graph.
{
reports: Object.keys(
Expand Down Expand Up @@ -117,6 +105,10 @@ export async function configureCoveragePlugin(
}

export async function configureJsPackagesPlugin(): Promise<CoreConfig> {
const { default: jsPackagesPlugin } = await import(
'./packages/plugin-js-packages/src/index.js'
);

return {
plugins: [await jsPackagesPlugin()],
categories: [
Expand Down Expand Up @@ -150,7 +142,13 @@ export async function configureJsPackagesPlugin(): Promise<CoreConfig> {
};
}

export function configureTypescriptPlugin(projectName?: string): CoreConfig {
export async function configureTypescriptPlugin(
projectName?: string,
): Promise<CoreConfig> {
const { default: typescriptPlugin, getCategories } = await import(
'./packages/plugin-typescript/src/index.js'
);

const tsconfig = projectName
? `packages/${projectName}/tsconfig.lib.json`
: 'tsconfig.code-pushup.json';
Expand All @@ -160,7 +158,13 @@ export function configureTypescriptPlugin(projectName?: string): CoreConfig {
};
}

export function configureJsDocsPlugin(projectName?: string): CoreConfig {
export async function configureJsDocsPlugin(
projectName?: string,
): Promise<CoreConfig> {
const { default: jsDocsPlugin } = await import(
'./packages/plugin-jsdocs/src/index.js'
);

const patterns: string[] = [
`packages/${projectName ?? '*'}/src/**/*.ts`,
`!**/node_modules`,
Expand Down Expand Up @@ -192,6 +196,10 @@ export function configureJsDocsPlugin(projectName?: string): CoreConfig {
export async function configureLighthousePlugin(
urls: PluginUrls,
): Promise<CoreConfig> {
const { lighthousePlugin, lighthouseGroupRefs } = await import(
'./packages/plugin-lighthouse/src/index.js'
);

const lhPlugin = await lighthousePlugin(urls);
return {
plugins: [lhPlugin],
Expand Down Expand Up @@ -220,10 +228,14 @@ export async function configureLighthousePlugin(
};
}

export function configureAxePlugin(
export async function configureAxePlugin(
urls: PluginUrls,
options?: AxePluginOptions,
): CoreConfig {
): Promise<CoreConfig> {
const { default: axePlugin, axeGroupRefs } = await import(
'./packages/plugin-axe/src/index.js'
);

const axe = axePlugin(urls, options);
return {
plugins: [axe],
Expand Down
17 changes: 10 additions & 7 deletions e2e/ci-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';

export default tseslint.config(...baseConfig, {
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
export default tseslint.config(
...(await (typeof baseConfig === 'function' ? baseConfig() : baseConfig)),
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
});
);
17 changes: 10 additions & 7 deletions e2e/cli-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';

export default tseslint.config(...baseConfig, {
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
export default tseslint.config(
...(await (typeof baseConfig === 'function' ? baseConfig() : baseConfig)),
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
});
);
4 changes: 2 additions & 2 deletions e2e/cli-e2e/tests/print-config.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('CLI print-config', () => {
'print-config',
'--output=config.json',
`--config=${configFilePath(ext)}`,
'--tsconfig=tsconfig.base.json',
`--tsconfig=${path.join(process.cwd(), 'tsconfig.base.json')}`,
'--persist.outputDir=output-dir',
'--persist.format=md',
`--persist.filename=${ext}-report`,
Expand All @@ -64,7 +64,7 @@ describe('CLI print-config', () => {
expect(JSON.parse(output)).toEqual(
expect.objectContaining({
config: expect.stringContaining(`code-pushup.config.${ext}`),
tsconfig: 'tsconfig.base.json',
tsconfig: path.join(process.cwd(), 'tsconfig.base.json'),
plugins: [
expect.objectContaining({
slug: 'dummy-plugin',
Expand Down
17 changes: 10 additions & 7 deletions e2e/create-cli-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';

export default tseslint.config(...baseConfig, {
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
export default tseslint.config(
...(await (typeof baseConfig === 'function' ? baseConfig() : baseConfig)),
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
});
);
17 changes: 10 additions & 7 deletions e2e/nx-plugin-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';

export default tseslint.config(...baseConfig, {
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
export default tseslint.config(
...(await (typeof baseConfig === 'function' ? baseConfig() : baseConfig)),
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
});
);
17 changes: 10 additions & 7 deletions e2e/plugin-axe-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';

export default tseslint.config(...baseConfig, {
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
export default tseslint.config(
...(await (typeof baseConfig === 'function' ? baseConfig() : baseConfig)),
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
});
);
17 changes: 10 additions & 7 deletions e2e/plugin-coverage-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';

export default tseslint.config(...baseConfig, {
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
export default tseslint.config(
...(await (typeof baseConfig === 'function' ? baseConfig() : baseConfig)),
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
});
);
17 changes: 10 additions & 7 deletions e2e/plugin-eslint-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';

export default tseslint.config(...baseConfig, {
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
export default tseslint.config(
...(await (typeof baseConfig === 'function' ? baseConfig() : baseConfig)),
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
});
);
17 changes: 10 additions & 7 deletions e2e/plugin-js-packages-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';

export default tseslint.config(...baseConfig, {
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
export default tseslint.config(
...(await (typeof baseConfig === 'function' ? baseConfig() : baseConfig)),
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
});
);
17 changes: 10 additions & 7 deletions e2e/plugin-jsdocs-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';

export default tseslint.config(...baseConfig, {
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
export default tseslint.config(
...(await (typeof baseConfig === 'function' ? baseConfig() : baseConfig)),
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
});
);
17 changes: 10 additions & 7 deletions e2e/plugin-lighthouse-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';

export default tseslint.config(...baseConfig, {
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
export default tseslint.config(
...(await (typeof baseConfig === 'function' ? baseConfig() : baseConfig)),
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
});
);
17 changes: 10 additions & 7 deletions e2e/plugin-typescript-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';

export default tseslint.config(...baseConfig, {
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
export default tseslint.config(
...(await (typeof baseConfig === 'function' ? baseConfig() : baseConfig)),
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
});
);
Loading
Loading