Skip to content

Commit 53cb658

Browse files
committed
revert
1 parent 0bcba8f commit 53cb658

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+4280
-18
lines changed

packages/cli/docs/nx-caching.md

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,9 @@ export default {
4949
"coverage.reportsDirectory": "{projectRoot}/coverage/unit-test"
5050
}
5151
},
52-
"code-pushup-js-packages": {
53-
"cache": false,
54-
"executor": "nx:run-commands",
55-
"options": {
56-
"command": "npx @code-pushup/cli collect",
57-
"args": ["--config={projectRoot}/code-pushup.config.ts", "--cache.write=true", "--persist.skipReports=true", "--persist.outputDir={projectRoot}/.code-pushup", "--upload.project={projectName}"]
58-
}
59-
},
6052
"code-pushup-coverage": {
6153
"cache": true,
62-
"outputs": ["{projectRoot}/.code-pushup/coverage/runner-output.json"],
54+
"outputs": ["{projectRoot}/.code-pushup/coverage"],
6355
"executor": "nx:run-commands",
6456
"options": {
6557
"command": "npx @code-pushup/cli collect",
@@ -69,13 +61,13 @@ export default {
6961
},
7062
"code-pushup": {
7163
"cache": true,
72-
"outputs": ["{projectRoot}/.code-pushup/report.*"],
64+
"outputs": ["{projectRoot}/.code-pushup"],
7365
"executor": "nx:run-commands",
7466
"options": {
7567
"command": "npx @code-pushup/cli",
7668
"args": ["--config={projectRoot}/code-pushup.config.ts", "--cache.read=true", "--persist.outputDir={projectRoot}/.code-pushup", "--upload.project={projectName}"]
7769
},
78-
"dependsOn": ["code-pushup-coverage", "code-pushup-js-packages"]
70+
"dependsOn": ["code-pushup-coverage"]
7971
}
8072
}
8173
}
@@ -88,14 +80,12 @@ This configuration creates the following task dependency graph:
8880
**Legend:**
8981

9082
- 🐳 = Cached target
91-
- 💾 = Parallel execution
9283

9384
```mermaid
9485
graph TD
95-
A[lib-a:code-pushup 🐳] --> B[lib-a:code-pushup-coverage 💾🐳]
96-
A --> C[lib-a:code-pushup-js-packages 💾]
97-
B --> C[lib-a:unit-test 💾🐳]
98-
B --> D[lib-a:int-test 💾🐳]
86+
A[lib-a:code-pushup 🐳] --> B[lib-a:code-pushup-coverage 🐳]
87+
B --> C[lib-a:unit-test 🐳]
88+
B --> D[lib-a:int-test 🐳]
9989
```
10090

10191
## Command Line Example
@@ -110,7 +100,7 @@ nx affected --target=code-pushup
110100

111101
This approach has the following benefits:
112102

113-
1. **💾 Parallel Execution**: Plugins can run in parallel
114-
2. **🐳 Fine-grained Caching**: Code level cache invalidation enables usage of [affected](https://nx.dev/recipes/affected-tasks) command
103+
1. **Parallel Execution**: Plugins can run in parallel
104+
2. **Fine-grained Caching**: Code level cache invalidation enables usage of [affected](https://nx.dev/recipes/affected-tasks) command
115105
3. **Dependency Management**: Leverage Nx task dependencies and its caching strategy
116106
4. **Clear Separation**: Each plugin has its own target for better debugging and maintainability

packages/nx-plugin/.env.lint.local

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NODE_OPTIONS=--experimental-require-module

packages/nx-plugin/README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# @code-pushup/nx-plugin
2+
3+
### Plugin
4+
5+
Register this plugin in your `nx.json` to leverage a set of generators and executors to integrate Code PushUp into a Nx workspace.
6+
7+
#### Registration
8+
9+
```jsonc
10+
// nx.json
11+
{
12+
//...
13+
"plugins": ["@code-pushup/nx-plugin"],
14+
}
15+
```
16+
17+
Resulting targets:
18+
19+
- `nx run <project-name>:code-pushup--configuration` (no config file present)
20+
- `nx run <project-name>:code-pushup` (`code-pushup.config.{ts,mjs,js}` is present)
21+
22+
### Generators
23+
24+
#### Init
25+
26+
Install JS packages and register plugin.
27+
See [init generator docs](./src/generators/init/README.md) for details
28+
29+
Examples:
30+
31+
- `nx g @code-pushup/nx-plugin:init` - setup code-pushup in the workspace
32+
- `nx g @code-pushup/nx-plugin:init --skipPackageJson` - skip `package.json` update
33+
34+
#### Configuration
35+
36+
Adds a `code-pushup` target to your `project.json`.
37+
See [configuration generator docs](./src/generators/configuration/README.md) for details
38+
39+
Examples:
40+
41+
- `nx g @code-pushup/nx-plugin:configuration --project=<project-name>`
42+
- `nx g @code-pushup/nx-plugin:configuration --project=<project-name> --targetName=cp`
43+
44+
### Executor
45+
46+
#### CLI
47+
48+
Install JS packages configure a target in your project json.
49+
See [CLI executor docs](./src/executors/cli/README.md) for details
50+
51+
Examples:
52+
53+
```json
54+
{
55+
"name": "my-project",
56+
"targets": {
57+
"code-pushup": {
58+
"executor": "@code-pushup/nx-plugin:cli",
59+
"options": {
60+
"projectPrefix": "workspace-name"
61+
}
62+
}
63+
}
64+
}
65+
```
66+
67+
- `nx run <project-name>:code-pushup`
68+
- `nx run <project-name>:code-pushup print-config --persist.filename=custom-report`
47.7 KB
Loading
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const tseslint = require('typescript-eslint');
2+
const baseConfig = require('../../eslint.config.js').default;
3+
4+
module.exports = tseslint.config(
5+
...baseConfig,
6+
{
7+
files: ['**/*.ts'],
8+
languageOptions: {
9+
parserOptions: {
10+
projectService: true,
11+
tsconfigRootDir: __dirname,
12+
},
13+
},
14+
},
15+
{
16+
files: ['**/*.ts'],
17+
rules: {
18+
// Nx plugins don't yet support ESM: https://github.com/nrwl/nx/issues/15682
19+
'unicorn/prefer-module': 'off',
20+
// used instead of verbatimModuleSyntax tsconfig flag (requires ESM)
21+
'@typescript-eslint/consistent-type-imports': [
22+
'warn',
23+
{
24+
fixStyle: 'inline-type-imports',
25+
disallowTypeAnnotations: false,
26+
},
27+
],
28+
'@typescript-eslint/consistent-type-exports': [
29+
'warn',
30+
{ fixMixedExportsWithInlineTypeSpecifier: true },
31+
],
32+
// `import path from 'node:path'` incompatible with CJS runtime, prefer `import * as path from 'node:path'`
33+
'unicorn/import-style': [
34+
'warn',
35+
{ styles: { 'node:path': { namespace: true } } },
36+
],
37+
},
38+
},
39+
{
40+
files: ['**/*.json'],
41+
rules: {
42+
'@nx/dependency-checks': 'error',
43+
},
44+
},
45+
{
46+
files: ['**/package.json', '**/generators.json'],
47+
rules: {
48+
'@nx/nx-plugin-checks': 'error',
49+
},
50+
},
51+
);

packages/nx-plugin/executors.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"executors": {
3+
"cli": {
4+
"implementation": "./src/executors/cli/executor",
5+
"schema": "./src/executors/cli/schema.json",
6+
"description": "CodePushup CLI executor. Executes the @code-pushup/cli command's See: https://github.com/code-pushup/cli/blob/main/packages/cli/README.md#commands"
7+
}
8+
}
9+
}

packages/nx-plugin/generators.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"generators": {
3+
"init": {
4+
"factory": "./src/generators/init/generator",
5+
"schema": "./src/generators/init/schema.json",
6+
"description": "init generator"
7+
},
8+
"configuration": {
9+
"factory": "./src/generators/configuration/generator",
10+
"schema": "./src/generators/configuration/schema.json",
11+
"description": "configuration generator"
12+
}
13+
}
14+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export const ENV = {
2+
CP_SERVER: 'https://portal.code.pushup.dev',
3+
CP_ORGANIZATION: 'code-pushup',
4+
CP_PROJECT: 'utils',
5+
CP_API_KEY: '23456789098765432345678909876543',
6+
CP_TIMEOUT: '9',
7+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { NormalizedExecutorContext } from '../../src/executors/internal/context.js';
2+
3+
export function normalizedExecutorContext(
4+
nameOrOpt: string | { projectName: string },
5+
): NormalizedExecutorContext {
6+
const { projectName } =
7+
typeof nameOrOpt === 'string' ? { projectName: nameOrOpt } : nameOrOpt;
8+
return {
9+
projectName,
10+
workspaceRoot: 'workspaceRoot',
11+
projectConfig: {
12+
name: projectName,
13+
root: 'root',
14+
},
15+
};
16+
}

packages/nx-plugin/package.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "@code-pushup/nx-plugin",
3+
"version": "0.74.0",
4+
"license": "MIT",
5+
"description": "Nx plugin to integrate the Code PushUp CLI into your workspace 🛠️",
6+
"publishConfig": {
7+
"access": "public"
8+
},
9+
"homepage": "https://code-pushup.dev",
10+
"bugs": {
11+
"url": "https://github.com/code-pushup/cli/issues?q=is%3Aissue%20state%3Aopen%20type%3ABug%20label%3A\"🧩%20nx-plugin\""
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "git+https://github.com/code-pushup/cli.git",
16+
"directory": "packages/nx-plugin"
17+
},
18+
"keywords": [
19+
"CLI",
20+
"Code PushUp",
21+
"Nx",
22+
"plugin",
23+
"automation",
24+
"developer tools",
25+
"code quality",
26+
"conformance",
27+
"build tools"
28+
],
29+
"type": "commonjs",
30+
"main": "./src/index.js",
31+
"typings": "./src/index.d.ts",
32+
"generators": "./generators.json",
33+
"executors": "./executors.json",
34+
"dependencies": {
35+
"@code-pushup/models": "0.74.0",
36+
"@code-pushup/utils": "0.74.0",
37+
"@nx/devkit": "^17.0.0 || ^18.0.0 || ^19.0.0",
38+
"ansis": "^3.3.0",
39+
"nx": "^17.0.0 || ^18.0.0 || ^19.0.0",
40+
"zod": "^4.0.5"
41+
},
42+
"files": [
43+
"src",
44+
"./generators.json",
45+
"./executors.json",
46+
"!**/*.tsbuildinfo"
47+
]
48+
}

0 commit comments

Comments
 (0)