Skip to content

Commit 7f8417a

Browse files
committed
ci: simplify standalone code-pushup target
1 parent fb73fc5 commit 7f8417a

File tree

3 files changed

+36
-56
lines changed

3 files changed

+36
-56
lines changed

code-pushup.preset.ts

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type {
66
} from './packages/models/src/index.js';
77
import axePlugin from './packages/plugin-axe/src/index.js';
88
import coveragePlugin, {
9+
type CoveragePluginConfig,
910
getNxCoveragePaths,
1011
} from './packages/plugin-coverage/src/index.js';
1112
import eslintPlugin, {
@@ -174,17 +175,22 @@ export const eslintCoreConfigNx = async (
174175
): Promise<CoreConfig> => ({
175176
plugins: [
176177
projectName
177-
? await eslintPlugin({
178-
eslintrc: `packages/${projectName}/eslint.config.js`,
179-
patterns: ['.'],
180-
})
181-
: await eslintPlugin(await eslintConfigFromAllNxProjects(), {
182-
artifacts: {
183-
// We leverage Nx dependsOn to only run all lint targets before we run code-pushup
184-
// generateArtifactsCommand: 'npx nx run-many -t lint',
185-
artifactsPaths: ['packages/**/.eslint/eslint-report.json'],
178+
? await eslintPlugin(
179+
{
180+
eslintrc: `packages/${projectName}/eslint.config.js`,
181+
patterns: ['.'],
186182
},
187-
}),
183+
{
184+
artifacts: {
185+
// We leverage Nx dependsOn to only run all lint targets before we run code-pushup
186+
// generateArtifactsCommand: 'npx nx run-many -t lint',
187+
artifactsPaths: [
188+
`packages/${projectName}/.eslint/eslint-report.json`,
189+
],
190+
},
191+
},
192+
)
193+
: await eslintPlugin(await eslintConfigFromAllNxProjects()),
188194
],
189195
categories: eslintCategories,
190196
});
@@ -199,21 +205,24 @@ export const typescriptPluginConfig = async (
199205
export const coverageCoreConfigNx = async (
200206
projectName?: string,
201207
): Promise<CoreConfig> => {
202-
const targetNames = ['unit-test', 'int-test'];
208+
const config: CoveragePluginConfig = projectName
209+
? // We do not need to run a coverageToolCommand. This is handled over the Nx task graph.
210+
{
211+
reports: [
212+
{
213+
pathToProject: `packages/${projectName}`,
214+
resultsPath: `packages/${projectName}/coverage/lcov.info`,
215+
},
216+
],
217+
}
218+
: {
219+
reports: await getNxCoveragePaths(['unit-test', 'int-test']),
220+
coverageToolCommand: {
221+
command: 'npx nx run-many -t unit-test,int-test',
222+
},
223+
};
203224
return {
204-
plugins: [
205-
await coveragePlugin({
206-
// We do not need to run a coverageToolCommand. This is handled over the Nx task graph.
207-
reports: projectName
208-
? [
209-
{
210-
pathToProject: `packages/${projectName}`,
211-
resultsPath: `packages/${projectName}/coverage/lcov.info`,
212-
},
213-
]
214-
: await getNxCoveragePaths(targetNames),
215-
}),
216-
],
225+
plugins: [await coveragePlugin(config)],
217226
categories: coverageCategories,
218227
};
219228
};

nx.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
"code-pushup": {
117117
"cache": false,
118118
"executor": "nx:run-commands",
119+
"dependsOn": ["code-pushup-*"],
119120
"options": {
120121
"command": "node packages/cli/src/index.ts",
121122
"args": [

project.json

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,10 @@
22
"name": "cli-workspace",
33
"$schema": "node_modules/nx/schemas/project-schema.json",
44
"targets": {
5-
"code-pushup-js-packages": {},
6-
"code-pushup-lighthouse": {},
7-
"code-pushup-coverage": {
8-
"dependsOn": [
9-
{
10-
"target": "unit-test",
11-
"projects": "*"
12-
},
13-
{
14-
"target": "int-test",
15-
"projects": "*"
16-
}
17-
]
18-
},
19-
"code-pushup-eslint": {
20-
"dependsOn": [
21-
{
22-
"target": "lint",
23-
"projects": "*"
24-
}
25-
]
26-
},
27-
"code-pushup-jsdocs": {},
28-
"code-pushup-typescript": {},
29-
"code-pushup-axe": {},
305
"code-pushup": {
31-
"dependsOn": ["code-pushup-*"],
32-
"executor": "nx:run-commands",
6+
"dependsOn": [],
337
"options": {
34-
"args": [
35-
"--cache.read",
36-
"--persist.outputDir={projectRoot}/.code-pushup",
37-
"--upload.project={projectName}"
38-
]
8+
"args": []
399
}
4010
}
4111
}

0 commit comments

Comments
 (0)