-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-defaults-to-plugin-options
# Conflicts: # code-pushup.config.ts
- Loading branch information
Showing
36 changed files
with
1,604 additions
and
495 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
**/*.mock.* | ||
**/code-pushup.config.ts | ||
**/mocks/fixtures/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
import { DEFAULT_FLAGS } from 'chrome-launcher/dist/flags.js'; | ||
import coveragePlugin, { | ||
getNxCoveragePaths, | ||
} from './dist/packages/plugin-coverage'; | ||
import eslintPlugin, { | ||
eslintConfigFromAllNxProjects, | ||
eslintConfigFromNxProject, | ||
} from './dist/packages/plugin-eslint'; | ||
import jsPackagesPlugin from './dist/packages/plugin-js-packages'; | ||
import lighthousePlugin, { | ||
lighthouseGroupRef, | ||
} from './dist/packages/plugin-lighthouse'; | ||
import type { CategoryConfig, CoreConfig } from './packages/models/src'; | ||
|
||
export const jsPackagesCategories: CategoryConfig[] = [ | ||
{ | ||
slug: 'security', | ||
title: 'Security', | ||
description: 'Finds known **vulnerabilities** in 3rd-party packages.', | ||
refs: [ | ||
{ | ||
type: 'group', | ||
plugin: 'js-packages', | ||
slug: 'npm-audit', | ||
weight: 1, | ||
}, | ||
], | ||
}, | ||
{ | ||
slug: 'updates', | ||
title: 'Updates', | ||
description: 'Finds **outdated** 3rd-party packages.', | ||
refs: [ | ||
{ | ||
type: 'group', | ||
plugin: 'js-packages', | ||
slug: 'npm-outdated', | ||
weight: 1, | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
export const lighthouseCategories: CategoryConfig[] = [ | ||
{ | ||
slug: 'performance', | ||
title: 'Performance', | ||
refs: [lighthouseGroupRef('performance')], | ||
}, | ||
{ | ||
slug: 'a11y', | ||
title: 'Accessibility', | ||
refs: [lighthouseGroupRef('accessibility')], | ||
}, | ||
{ | ||
slug: 'best-practices', | ||
title: 'Best Practices', | ||
refs: [lighthouseGroupRef('best-practices')], | ||
}, | ||
{ | ||
slug: 'seo', | ||
title: 'SEO', | ||
refs: [lighthouseGroupRef('seo')], | ||
}, | ||
]; | ||
|
||
export const eslintCategories: CategoryConfig[] = [ | ||
{ | ||
slug: 'bug-prevention', | ||
title: 'Bug prevention', | ||
description: 'Lint rules that find **potential bugs** in your code.', | ||
refs: [{ type: 'group', plugin: 'eslint', slug: 'problems', weight: 1 }], | ||
}, | ||
{ | ||
slug: 'code-style', | ||
title: 'Code style', | ||
description: | ||
'Lint rules that promote **good practices** and consistency in your code.', | ||
refs: [{ type: 'group', plugin: 'eslint', slug: 'suggestions', weight: 1 }], | ||
}, | ||
]; | ||
|
||
export const coverageCategories: CategoryConfig[] = [ | ||
{ | ||
slug: 'code-coverage', | ||
title: 'Code coverage', | ||
description: 'Measures how much of your code is **covered by tests**.', | ||
refs: [ | ||
{ | ||
type: 'group', | ||
plugin: 'coverage', | ||
slug: 'coverage', | ||
weight: 1, | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
export const jsPackagesCoreConfig = async (): Promise<CoreConfig> => { | ||
return { | ||
plugins: [await jsPackagesPlugin({ packageManager: 'npm' })], | ||
categories: jsPackagesCategories, | ||
}; | ||
}; | ||
|
||
export const lighthouseCoreConfig = async ( | ||
url: string, | ||
): Promise<CoreConfig> => { | ||
return { | ||
plugins: [ | ||
await lighthousePlugin(url, { | ||
chromeFlags: DEFAULT_FLAGS.concat(['--headless']), | ||
}), | ||
], | ||
categories: lighthouseCategories, | ||
}; | ||
}; | ||
|
||
export const eslintCoreConfigNx = async ( | ||
projectName?: string, | ||
): Promise<CoreConfig> => { | ||
return { | ||
plugins: [ | ||
await eslintPlugin( | ||
await (projectName | ||
? eslintConfigFromNxProject(projectName) | ||
: eslintConfigFromAllNxProjects()), | ||
), | ||
], | ||
categories: eslintCategories, | ||
}; | ||
}; | ||
|
||
export const coverageCoreConfigNx = async ( | ||
projectName?: string, | ||
): Promise<CoreConfig> => { | ||
if (projectName) { | ||
throw new Error('coverageCoreConfigNx for single projects not implemented'); | ||
} | ||
const targetNames = ['unit-test', 'integration-test']; | ||
const targetArgs = [ | ||
'-t', | ||
'unit-test', | ||
'integration-test', | ||
'--coverage.enabled', | ||
'--skipNxCache', | ||
]; | ||
return { | ||
plugins: [ | ||
await coveragePlugin({ | ||
coverageToolCommand: { | ||
command: 'npx', | ||
args: [ | ||
'nx', | ||
projectName ? `run --project ${projectName}` : 'run-many', | ||
...targetArgs, | ||
], | ||
}, | ||
reports: await getNxCoveragePaths(targetNames), | ||
}), | ||
], | ||
categories: coverageCategories, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"executors": { | ||
"autorun": { | ||
"implementation": "./src/executors/autorun/executor", | ||
"schema": "./src/executors/autorun/schema.json", | ||
"description": "CodePushup CLI autorun command executor. Executes the @code-pushup/cli autorun command See: https://github.com/code-pushup/cli/blob/main/packages/cli/README.md#autorun-command" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { NormalizedExecutorContext } from '../../src/executors/internal/context'; | ||
|
||
export function normalizedExecutorContext( | ||
nameOrOpt: string | { projectName: string }, | ||
): NormalizedExecutorContext { | ||
const { projectName } = | ||
typeof nameOrOpt === 'string' ? { projectName: nameOrOpt } : nameOrOpt; | ||
return { | ||
projectName, | ||
workspaceRoot: 'workspaceRoot', | ||
projectConfig: { | ||
name: projectName, | ||
root: 'root', | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.