|
| 1 | +import coveragePlugin, { |
| 2 | + getNxCoveragePaths, |
| 3 | +} from '@code-pushup/coverage-plugin'; |
| 4 | +import eslintPlugin, { |
| 5 | + eslintConfigFromAllNxProjects, |
| 6 | +} from '@code-pushup/eslint-plugin'; |
| 7 | +import jsPackagesPlugin from '@code-pushup/js-packages-plugin'; |
| 8 | +import { mergeConfigs } from '@code-pushup/utils'; |
| 9 | +import type { CoreConfig } from '@code-pushup/models'; |
| 10 | +import 'dotenv/config'; |
| 11 | + |
| 12 | +const esLintConfig: CoreConfig = { |
| 13 | + plugins: [await eslintPlugin(await eslintConfigFromAllNxProjects())], |
| 14 | + categories: [ |
| 15 | + { |
| 16 | + slug: 'bug-prevention', |
| 17 | + title: 'Bug prevention', |
| 18 | + refs: [{ type: 'group', plugin: 'eslint', slug: 'problems', weight: 1 }], |
| 19 | + }, |
| 20 | + { |
| 21 | + slug: 'code-style', |
| 22 | + title: 'Code style', |
| 23 | + refs: [ |
| 24 | + { type: 'group', plugin: 'eslint', slug: 'suggestions', weight: 1 }, |
| 25 | + ], |
| 26 | + }, |
| 27 | + ], |
| 28 | +}; |
| 29 | + |
| 30 | +const coverageConfig: CoreConfig = { |
| 31 | + plugins: [ |
| 32 | + await coveragePlugin({ |
| 33 | + coverageToolCommand: { |
| 34 | + command: 'npx', |
| 35 | + args: ['nx', 'run-many', '-t', 'test', '--coverage', '--skipNxCache'], |
| 36 | + }, |
| 37 | + reports: await getNxCoveragePaths(['test']), |
| 38 | + }), |
| 39 | + ], |
| 40 | + categories: [ |
| 41 | + { |
| 42 | + slug: 'coverage', |
| 43 | + title: 'Coverage', |
| 44 | + refs: [ |
| 45 | + { type: 'group', plugin: 'coverage', slug: 'coverage', weight: 1 }, |
| 46 | + ], |
| 47 | + }, |
| 48 | + ], |
| 49 | +}; |
| 50 | + |
| 51 | +const jsPackagesConfig: CoreConfig = { |
| 52 | + plugins: [await jsPackagesPlugin({ packageManager: 'npm' })], |
| 53 | + categories: [ |
| 54 | + { |
| 55 | + slug: 'security', |
| 56 | + title: 'Security', |
| 57 | + refs: [ |
| 58 | + { type: 'group', plugin: 'js-packages', slug: 'npm-audit', weight: 1 }, |
| 59 | + ], |
| 60 | + }, |
| 61 | + { |
| 62 | + slug: 'updates', |
| 63 | + title: 'Updates', |
| 64 | + refs: [ |
| 65 | + { |
| 66 | + type: 'group', |
| 67 | + plugin: 'js-packages', |
| 68 | + slug: 'npm-outdated', |
| 69 | + weight: 1, |
| 70 | + }, |
| 71 | + ], |
| 72 | + }, |
| 73 | + ], |
| 74 | +}; |
| 75 | + |
| 76 | +const portalUploadConfig = process.env.CP_API_KEY |
| 77 | + ? { |
| 78 | + upload: { |
| 79 | + server: 'https://api.code-pushup.dev/graphql', |
| 80 | + apiKey: process.env.CP_API_KEY, |
| 81 | + organization: 'demos', |
| 82 | + project: 'ng-demo', |
| 83 | + }, |
| 84 | + } |
| 85 | + : {}; |
| 86 | + |
| 87 | +export default mergeConfigs( |
| 88 | + esLintConfig, |
| 89 | + jsPackagesConfig, |
| 90 | + coverageConfig, |
| 91 | + portalUploadConfig |
| 92 | +); |
0 commit comments