You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/plugin-js-packages/README.md
+40-22
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
7
7
📦 **Code PushUp plugin for JavaScript packages.** 🛡️
8
8
9
-
This plugin allows you to list outdated dependencies and run audit for known vulnerabilities.
9
+
This plugin checks for known vulnerabilities and outdated dependencies.
10
10
It supports the following package managers:
11
11
12
12
-[NPM](https://docs.npmjs.com/)
@@ -17,9 +17,7 @@ It supports the following package managers:
17
17
18
18
1. If you haven't already, install [@code-pushup/cli](../cli/README.md) and create a configuration file.
19
19
20
-
2. Insert plugin configuration. By default, `audit` and `outdated` commands will be run.
21
-
22
-
Default configuration will look as follows:
20
+
2. Insert plugin configuration with your package manager. By default, both `audit` and `outdated` checks will be run. The result should look as follows:
@@ -28,14 +26,12 @@ It supports the following package managers:
28
26
// ...
29
27
plugins: [
30
28
// ...
31
-
awaitjsPackagesPlugin(),
29
+
awaitjsPackagesPlugin({ packageManager:'npm' }), // replace with your package manager
32
30
],
33
31
};
34
32
```
35
33
36
-
You may run this plugin with a custom configuration for any supported package manager or command.
37
-
38
-
A custom configuration will look similarly to the following:
34
+
You may run this plugin with a custom configuration for any supported package manager or command. A custom configuration will look similarly to the following:
@@ -49,7 +45,7 @@ It supports the following package managers:
49
45
};
50
46
```
51
47
52
-
3. (Optional) Reference individual audits or the provided plugin group which you wish to include in custom categories (use `npx code-pushup print-config` to list audits and groups).
48
+
3. (Optional) Reference individual audits or the provided plugin groups which you wish to include in custom categories (use `npx code-pushup print-config` to list audits and groups).
53
49
54
50
💡 Assign weights based on what influence each command should have on the overall category score (assign weight 0 to only include as extra info, without influencing category score).
55
51
@@ -58,17 +54,30 @@ It supports the following package managers:
58
54
// ...
59
55
categories: [
60
56
{
61
-
slug:'dependencies',
62
-
title:'Package dependencies',
57
+
slug:'security',
58
+
title:'Security',
63
59
refs: [
64
60
{
65
61
type:'group',
66
-
plugin:'npm-package-manager', // replace prefix with your package manager
62
+
plugin:'npm-audit', // replace prefix with your package manager
67
63
slug:'js-packages',
68
64
weight:1,
69
65
},
70
66
],
71
67
},
68
+
{
69
+
slug:'up-to-date',
70
+
title:'Up-to-date tools',
71
+
refs: [
72
+
{
73
+
type:'group',
74
+
plugin:'npm-outdated', // replace prefix with your package manager
75
+
slug:'js-packages',
76
+
weight:1,
77
+
},
78
+
// ...
79
+
],
80
+
},
72
81
// ...
73
82
],
74
83
};
@@ -82,16 +91,13 @@ It supports the following package managers:
82
91
83
92
The plugin accepts the following parameters:
84
93
85
-
-(optional) `packageManager`: The package manager you are using. Supported values: `npm`, `yarn-classic` (v1), `yarn-modern` (v2+), `pnpm`. Default is `npm`.
94
+
-`packageManager`: The package manager you are using. Supported values: `npm`, `yarn-classic` (v1), `yarn-modern` (v2+), `pnpm`.
86
95
- (optional) `checks`: Array of checks to be run. Supported commands: `audit`, `outdated`. Both are configured by default.
87
96
- (optional) `auditLevelMapping`: If you wish to set a custom level of issue severity based on audit vulnerability level, you may do so here. Any omitted values will be filled in by defaults. Audit levels are: `critical`, `high`, `moderate`, `low` and `info`. Issue severities are: `error`, `warn` and `info`. By default the mapping is as follows: `critical` and `high` → `error`; `moderate` and `low` → `warning`; `info` → `info`.
88
97
89
-
> [!NOTE]
90
-
> All parameters are optional so the plugin can be called with no arguments in the default setting.
91
-
92
98
### Audits and group
93
99
94
-
This plugin provides a group for convenient declaration in your config. When defined this way, all measured coverage type audits have the same weight.
100
+
This plugin provides a group per check for a convenient declaration in your config.
95
101
96
102
```ts
97
103
// ...
@@ -103,7 +109,13 @@ This plugin provides a group for convenient declaration in your config. When def
103
109
{
104
110
type: 'group',
105
111
plugin: 'js-packages',
106
-
slug: 'npm-package-manager', // replace prefix with your package manager
112
+
slug: 'npm-audit', // replace prefix with your package manager
113
+
weight: 1,
114
+
},
115
+
{
116
+
type: 'group',
117
+
plugin: 'js-packages',
118
+
slug: 'npm-outdated', // replace prefix with your package manager
107
119
weight: 1,
108
120
},
109
121
// ...
@@ -113,7 +125,7 @@ This plugin provides a group for convenient declaration in your config. When def
113
125
],
114
126
```
115
127
116
-
Each package manager command still has its own audit. So when you want to include a subset of commands or assign different weights to them, you can do so in the following way:
128
+
Each dependency group has its own audit. If you want to check only a subset of dependencies (e.g. run audit and outdated for production dependencies) or assign different weights to them, you can do so in the following way:
117
129
118
130
```ts
119
131
// ...
@@ -125,15 +137,21 @@ Each package manager command still has its own audit. So when you want to includ
125
137
{
126
138
type: 'audit',
127
139
plugin: 'js-packages',
128
-
slug: 'npm-audit', // replace prefix with your package manager
140
+
slug: 'npm-audit-prod', // replace prefix with your package manager
129
141
weight: 2,
130
142
},
131
-
{
143
+
{
132
144
type: 'audit',
133
145
plugin: 'js-packages',
134
-
slug: 'npm-outdated', // replace prefix with your package manager
146
+
slug: 'npm-audit-dev', // replace prefix with your package manager
135
147
weight: 1,
136
148
},
149
+
{
150
+
type: 'audit',
151
+
plugin: 'js-packages',
152
+
slug: 'npm-outdated-prod', // replace prefix with your package manager
0 commit comments