Skip to content

Commit 91b58ca

Browse files
committed
ci: meaningful categories configuration
1 parent 8fbaa53 commit 91b58ca

File tree

5 files changed

+35
-26
lines changed

5 files changed

+35
-26
lines changed

code-pushup.config.ts

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
packageJsonDocumentationGroupRef,
77
packageJsonPerformanceGroupRef,
88
packageJsonPlugin,
9-
packageJsonVersionControlGroupRef,
109
} from './dist/examples/plugins';
1110
import eslintPlugin, {
1211
eslintConfigFromNxProjects,
@@ -45,29 +44,25 @@ const config: CoreConfig = {
4544

4645
plugins: [
4746
await eslintPlugin(await eslintConfigFromNxProjects()),
47+
4848
fileSizePlugin({
49-
directory: './dist/packages',
49+
directory: './dist/examples/react-todos-app',
5050
pattern: /\.js$/,
51-
budget: 42_000,
51+
budget: 174_080, // 170 kB
5252
}),
53+
5354
packageJsonPlugin({
54-
directory: './packages',
55+
directory: './dist/packages',
5556
license: 'MIT',
5657
type: 'module',
57-
dependencies: {
58-
zod: '^3.22.4',
59-
},
6058
}),
6159
],
6260

6361
categories: [
6462
{
6563
slug: 'bug-prevention',
6664
title: 'Bug prevention',
67-
refs: [
68-
{ type: 'group', plugin: 'eslint', slug: 'problems', weight: 1 },
69-
packageJsonVersionControlGroupRef,
70-
],
65+
refs: [{ type: 'group', plugin: 'eslint', slug: 'problems', weight: 1 }],
7166
},
7267
{
7368
slug: 'code-style',
@@ -77,14 +72,13 @@ const config: CoreConfig = {
7772
],
7873
},
7974
{
80-
slug: 'performance',
81-
title: 'Performance',
82-
refs: [...fileSizeRecommendedRefs, packageJsonPerformanceGroupRef],
83-
},
84-
{
85-
slug: 'documentation',
86-
title: 'Documentation',
87-
refs: [packageJsonDocumentationGroupRef],
75+
slug: 'custom-checks',
76+
title: 'Custom checks',
77+
refs: [
78+
...fileSizeRecommendedRefs,
79+
packageJsonPerformanceGroupRef,
80+
packageJsonDocumentationGroupRef,
81+
],
8882
},
8983
],
9084
};

examples/plugins/src/package-json/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ The plugin crawls the file base depending on your configuration and checks the c
99
You can configure the plugin with the following options:
1010

1111
- `directory` - directory to crawl as string
12-
- `license` - file name pattern as string
13-
- `type` - size budget as number in bytes
12+
- `license` - expected value of [`license` property in `package.json`](https://docs.npmjs.com/cli/configuring-npm/package-json#license)
13+
- `type` - expected value of [`type` property in `package.json`](https://nodejs.org/api/packages.html#type)
1414
- `dependencies` - package dependencies as object
1515
- `devDependencies` - package dependencies as object
1616
- `optionalDependencies` - package dependencies as object

examples/plugins/src/package-json/src/integration/license.audit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const licenseAuditSlug = 'package-license';
1111
export const licenseAuditMeta: Audit = {
1212
slug: licenseAuditSlug,
1313
title: 'License',
14-
description: 'An audit to check NPM package license`.',
14+
description: 'An audit to check NPM package license.',
1515
};
1616

1717
export function licenseAudit(

examples/plugins/src/package-json/src/integration/type.audit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const typeAuditSlug = 'package-type';
1212
export const typeAuditInfoMeta = {
1313
slug: typeAuditSlug,
1414
title: 'Type',
15-
description: 'An audit to check NPM package type`.',
15+
description: 'An audit to check NPM package type.',
1616
};
1717

1818
export function typeAudit(

project.json

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@
3232
"command": "npx dist/packages/cli collect --config=code-pushup.config.ts",
3333
"dependsOn": [
3434
{
35-
"projects": ["cli", "plugin-eslint", "examples-plugins"],
35+
"projects": [
36+
"cli",
37+
"plugin-eslint",
38+
"examples-plugins",
39+
"react-todos-app"
40+
],
3641
"target": "build"
3742
}
3843
]
@@ -41,7 +46,12 @@
4146
"command": "npx dist/packages/cli upload --config=code-pushup.config.ts",
4247
"dependsOn": [
4348
{
44-
"projects": ["cli", "plugin-eslint", "examples-plugins"],
49+
"projects": [
50+
"cli",
51+
"plugin-eslint",
52+
"examples-plugins",
53+
"react-todos-app"
54+
],
4555
"target": "build"
4656
}
4757
]
@@ -50,7 +60,12 @@
5060
"command": "npx dist/packages/cli autorun --config=code-pushup.config.ts",
5161
"dependsOn": [
5262
{
53-
"projects": ["cli", "plugin-eslint", "examples-plugins"],
63+
"projects": [
64+
"cli",
65+
"plugin-eslint",
66+
"examples-plugins",
67+
"react-todos-app"
68+
],
5469
"target": "build"
5570
}
5671
]

0 commit comments

Comments
 (0)