Skip to content

Commit 07ace2f

Browse files
committed
chore: update code-pushup targets
1 parent da5de15 commit 07ace2f

File tree

22 files changed

+174
-30
lines changed

22 files changed

+174
-30
lines changed

CONTRIBUTING.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,41 @@ You can control the execution of long-running tests over the `INCLUDE_SLOW_TESTS
6969
To change this setup, open (or create) the `.env` file in the root folder.
7070
Edit or add the environment variable there as follows: `INCLUDE_SLOW_TESTS=true`.
7171

72+
### Testing with pkg-new
73+
74+
You can test the CLI using published packages from pull requests via [pkg-new](https://pkg.pr.new/). This is useful for testing changes before they are merged.
75+
76+
To test a specific PR (replace `<PR_NUMBER>` with the actual PR number):
77+
78+
```bash
79+
# Install required dependencies first
80+
npm install \
81+
https://pkg.pr.new/code-pushup/cli/@code-pushup/utils@<PR_NUMBER> \
82+
https://pkg.pr.new/code-pushup/cli/@code-pushup/models@<PR_NUMBER> \
83+
https://pkg.pr.new/code-pushup/cli/@code-pushup/core@<PR_NUMBER> \
84+
https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@<PR_NUMBER>
85+
```
86+
87+
Update nx.json to use pkg-new:
88+
89+
```jsonc
90+
{
91+
"targetDefaults": {
92+
"code-pushup": {
93+
"executor": "nx:run-commands",
94+
"options": {
95+
"command": "npx https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@<PR_NUMBER>", // instead of "command": "node packages/cli/src/index.ts"
96+
"args": [
97+
// ...
98+
],
99+
},
100+
},
101+
},
102+
}
103+
```
104+
105+
**Note:** The `@code-pushup/portal-client` package may not be available via pkg-new, but it's an optional peer dependency and won't affect collect functionality. Only the upload command is not working.
106+
72107
## Git
73108

74109
Commit messages must follow [conventional commits](https://conventionalcommits.org/) format.

e2e/create-cli-e2e/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "create-cli-e2e",
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4-
"sourceRoot": "examples/create-cli-e2e/src",
4+
"sourceRoot": "e2e/create-cli-e2e/src",
55
"projectType": "application",
66
"targets": {
77
"lint": {},

examples/plugins/project.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
"sourceRoot": "examples/plugins/src",
55
"projectType": "library",
66
"targets": {
7+
"code-pushup": {
8+
"dependsOn": ["code-pushup-coverage"]
9+
},
10+
"code-pushup-coverage": {
11+
"dependsOn": ["unit-test", "int-test"]
12+
},
713
"build": {
814
"executor": "@nx/js:tsc",
915
"outputs": ["{options.outputPath}"],

nx.json

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,60 @@
33
"targetDefaults": {
44
"code-pushup": {
55
"cache": true,
6-
"outputs": ["{options.outputPath}"],
6+
"outputs": [
7+
"{projectRoot}/.code-pushup/*.md",
8+
"{projectRoot}/.code-pushup/*.json"
9+
],
710
"executor": "nx:run-commands",
811
"options": {
9-
"command": "node packages/cli/src/index.ts --no-progress --verbose",
10-
"config": "{projectRoot}/code-pushup.config.ts",
11-
"persist": {
12-
"filename": "{projectName}-report",
13-
"outputDir": "{projectRoot}/.code-pushup"
14-
},
15-
"upload": {
16-
"project": "cli-{projectName}"
17-
},
12+
"command": "npx https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@1059",
13+
"args": [
14+
"--no-progress",
15+
"--verbose",
16+
"--config",
17+
"{projectRoot}/code-pushup.config.ts",
18+
"--persist.filename",
19+
"{projectName}-report",
20+
"--persist.outputDir",
21+
"{projectRoot}/.code-pushup",
22+
"--upload.project",
23+
"cli-{projectName}"
24+
],
1825
"outputPath": "{projectRoot}/.code-pushup",
1926
"env": {
2027
"NODE_OPTIONS": "--import tsx",
2128
"TSX_TSCONFIG_PATH": "tsconfig.base.json"
2229
}
2330
}
2431
},
32+
"code-pushup-coverage": {
33+
"cache": true,
34+
"outputs": ["{projectRoot}/.code-pushup/coverage"],
35+
"executor": "nx:run-commands",
36+
"options": {
37+
"command": "npm install https://pkg.pr.new/code-pushup/cli/@code-pushup/utils@1059 https://pkg.pr.new/code-pushup/cli/@code-pushup/models@1059 && npx --yes https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@1059",
38+
"args": [
39+
"--no-progress",
40+
"--verbose",
41+
"--config",
42+
"{projectRoot}/code-pushup.config.ts",
43+
"--cache.write",
44+
"true",
45+
"--onlyPlugins",
46+
"coverage",
47+
"--persist.skipReports",
48+
"true",
49+
"--persist.outputDir",
50+
"{projectRoot}/.code-pushup",
51+
"--upload.project",
52+
"{projectName}"
53+
],
54+
"env": {
55+
"NODE_OPTIONS": "--import tsx",
56+
"TSX_TSCONFIG_PATH": "tsconfig.base.json"
57+
}
58+
}
59+
},
2560
"build": {
2661
"dependsOn": ["^build"],
2762
"inputs": ["production", "^production"],

package-lock.json

Lines changed: 34 additions & 0 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
@@ -22,7 +22,9 @@
2222
"node": ">=22.14"
2323
},
2424
"dependencies": {
25+
"@code-pushup/models": "https://pkg.pr.new/code-pushup/cli/@code-pushup/models@1059",
2526
"@code-pushup/portal-client": "^0.15.0",
27+
"@code-pushup/utils": "https://pkg.pr.new/code-pushup/cli/@code-pushup/utils@1059",
2628
"@isaacs/cliui": "^8.0.2",
2729
"@nx/devkit": "19.8.13",
2830
"@poppinss/cliui": "6.4.1",

packages/ci/project.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
"sourceRoot": "packages/ci/src",
55
"projectType": "library",
66
"targets": {
7+
"code-pushup": {
8+
"dependsOn": ["code-pushup-coverage"]
9+
},
10+
"code-pushup-coverage": {
11+
"dependsOn": ["unit-test", "int-test"]
12+
},
713
"build": {},
814
"lint": {},
915
"unit-test": {

packages/cli/project.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
"projectType": "library",
66
"targets": {
77
"code-pushup": {
8-
"dependsOn": ["unit-test", "int-test"]
8+
"dependsOn": ["code-pushup-coverage"]
9+
},
10+
"code-pushup-coverage": {
11+
"dependsOn": ["unit-test", "int-test", "e2e-test"]
912
},
1013
"build": {},
1114
"lint": {},

packages/core/project.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"projectType": "library",
66
"targets": {
77
"code-pushup": {
8+
"dependsOn": ["code-pushup-coverage"]
9+
},
10+
"code-pushup-coverage": {
811
"dependsOn": ["unit-test", "int-test"]
912
},
1013
"build": {},

packages/create-cli/project.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"projectType": "library",
66
"targets": {
77
"code-pushup": {
8+
"dependsOn": ["code-pushup-coverage"]
9+
},
10+
"code-pushup-coverage": {
811
"dependsOn": ["unit-test", "int-test"]
912
},
1013
"build": {},

0 commit comments

Comments
 (0)