Skip to content

Commit

Permalink
ci: meaningful categories configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
matejchalk committed Jan 8, 2024
1 parent e895d16 commit 1415f67
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 26 deletions.
32 changes: 13 additions & 19 deletions code-pushup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
packageJsonDocumentationGroupRef,
packageJsonPerformanceGroupRef,
packageJsonPlugin,
packageJsonVersionControlGroupRef,
} from './dist/examples/plugins';
import eslintPlugin, {
eslintConfigFromNxProjects,
Expand Down Expand Up @@ -45,29 +44,25 @@ const config: CoreConfig = {

plugins: [
await eslintPlugin(await eslintConfigFromNxProjects()),

fileSizePlugin({
directory: './dist/packages',
directory: './dist/examples/react-todos-app',
pattern: /\.js$/,
budget: 42_000,
budget: 174_080, // 170 kB
}),

packageJsonPlugin({
directory: './packages',
directory: './dist/packages',
license: 'MIT',
type: 'module',
dependencies: {
zod: '^3.22.4',
},
}),
],

categories: [
{
slug: 'bug-prevention',
title: 'Bug prevention',
refs: [
{ type: 'group', plugin: 'eslint', slug: 'problems', weight: 1 },
packageJsonVersionControlGroupRef,
],
refs: [{ type: 'group', plugin: 'eslint', slug: 'problems', weight: 1 }],
},
{
slug: 'code-style',
Expand All @@ -77,14 +72,13 @@ const config: CoreConfig = {
],
},
{
slug: 'performance',
title: 'Performance',
refs: [...fileSizeRecommendedRefs, packageJsonPerformanceGroupRef],
},
{
slug: 'documentation',
title: 'Documentation',
refs: [packageJsonDocumentationGroupRef],
slug: 'custom-checks',
title: 'Custom checks',
refs: [
...fileSizeRecommendedRefs,
packageJsonPerformanceGroupRef,
packageJsonDocumentationGroupRef,
],
},
],
};
Expand Down
4 changes: 2 additions & 2 deletions examples/plugins/src/package-json/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ The plugin crawls the file base depending on your configuration and checks the c
You can configure the plugin with the following options:

- `directory` - directory to crawl as string
- `license` - file name pattern as string
- `type` - size budget as number in bytes
- `license` - expected value of [`license` property in `package.json`](https://docs.npmjs.com/cli/configuring-npm/package-json#license)
- `type` - expected value of [`type` property in `package.json`](https://nodejs.org/api/packages.html#type)
- `dependencies` - package dependencies as object
- `devDependencies` - package dependencies as object
- `optionalDependencies` - package dependencies as object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const licenseAuditSlug = 'package-license';
export const licenseAuditMeta: Audit = {
slug: licenseAuditSlug,
title: 'License',
description: 'An audit to check NPM package license`.',
description: 'An audit to check NPM package license.',
};

export function licenseAudit(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const typeAuditSlug = 'package-type';
export const typeAuditInfoMeta = {
slug: typeAuditSlug,
title: 'Type',
description: 'An audit to check NPM package type`.',
description: 'An audit to check NPM package type.',
};

export function typeAudit(
Expand Down
21 changes: 18 additions & 3 deletions project.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
"command": "npx dist/packages/cli collect --config=code-pushup.config.ts",
"dependsOn": [
{
"projects": ["cli", "plugin-eslint", "examples-plugins"],
"projects": [
"cli",
"plugin-eslint",
"examples-plugins",
"react-todos-app"
],
"target": "build"
}
]
Expand All @@ -41,7 +46,12 @@
"command": "npx dist/packages/cli upload --config=code-pushup.config.ts",
"dependsOn": [
{
"projects": ["cli", "plugin-eslint", "examples-plugins"],
"projects": [
"cli",
"plugin-eslint",
"examples-plugins",
"react-todos-app"
],
"target": "build"
}
]
Expand All @@ -50,7 +60,12 @@
"command": "npx dist/packages/cli autorun --config=code-pushup.config.ts",
"dependsOn": [
{
"projects": ["cli", "plugin-eslint", "examples-plugins"],
"projects": [
"cli",
"plugin-eslint",
"examples-plugins",
"react-todos-app"
],
"target": "build"
}
]
Expand Down

0 comments on commit 1415f67

Please sign in to comment.