- 
                Notifications
    You must be signed in to change notification settings 
- Fork 16
Open
Labels
Description
Preconditions
- refactor: remove target generator in favour of task inference #1110
- feat(nx-plugin): adjust bin path handling #1109
- fix(nx-plugin): print process output for CLI command #1095
- [IN_PROGRESS] remove merge logic from executor
- chore: use @code-pushup/nx-plugin in repo #1091
User story
As a Nx user I want to have my CodePushup targets set up automatically in standalone mode.
Acceptance criteria
- default target
- plugin caching
- DX when using with or without caching
Implementation details
nx.json
packages/utils/project.json
{
  "targets": {
    "code-pushup": {
      "executor": "@code-pushup/nx-plugin:cli",
      "cache": true,
      "inputs": ["default", "code-pushup-inputs"],
      "outputs": ["{projectRoot}/.code-pushup/**/*"],
      "options": {
        "bin": "node ./packages/cli/src/index.ts",
        "config": "{projectRoot}/code-pushup.config.ts",
        "progress": false,
        "verbose": true,
        "persist": { "outputDir": "{projectRoot}/.code-pushup" }
      },
      "configurations": {
        "autorun": {
          "command": "autorun"
        },
        "print-config": {
          "command": "print-config",
          "output": "{projectRoot}/.code-pushup/code-pushup-config.json"
        },
        "collect": {
          "command": "collect",
          "cache": { "write": true }
        },
        "upload": {
          "command": "upload",
          "upload": { "project": "cli-{projectName}" }
        },
        /* per-plugin “collect” configs (distinct cache keys) */
        "collect-eslint-cache":     { "command": "collect", "onlyPlugins": ["eslint"],     "cache": { "write": true }, "persist": { "skipReports": true } },
        "collect-coverage-cache":   { "command": "collect", "onlyPlugins": ["coverage"],   "cache": { "write": true }, "persist": { "skipReports": true } },
        "collect-typescript-cache": { "command": "collect", "onlyPlugins": ["typescript"], "cache": { "write": true }, "persist": { "skipReports": true } },
        "collect-jsdocs-cache":     { "command": "collect", "onlyPlugins": ["jsdocs"],     "cache": { "write": true }, "persist": { "skipReports": true } },
        "collect-lighthouse-cache": { "command": "collect", "onlyPlugins": ["lighthouse"], "cache": { "write": true }, "persist": { "skipReports": true } },
        "collect-js-packages-cache":{ "command": "collect", "onlyPlugins": ["js-packages"] }
      },
      "defaultConfiguration": "autorun"
    }
  }
}Run examples:
- nx run myproj:code-pushup→ autorun
- nx run myproj:code-pushup:collect-eslint→ collect eslint only
- nx run myproj:code-pushup:collect-eslint-cached→ for plugin caching setup
- nx run myproj:code-pushup:upload
{ "plugins": [ { "plugin": "@code-pushup/nx-plugin", "options": { "targetName": "cp", "projectPrefix": "cli", } } ] }