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: README.md
+46-8Lines changed: 46 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
A Github Action for validating package.json conventions.
6
6
7
-
## Usage
7
+
## Rules
8
8
9
9
Use the `rules` input to specify one or more rules you would like to check for your `package.json`.
10
10
@@ -16,7 +16,7 @@ The following usage would allow `"my-package": "1.2.3"` but prevent `"my-package
16
16
```yaml
17
17
steps:
18
18
- name: Checkout
19
-
uses: actions/checkout@v2
19
+
uses: actions/checkout@v3
20
20
21
21
- uses: ExpediaGroup/package-json-validator@v1
22
22
with:
@@ -27,7 +27,7 @@ You can also specify `allowed-ranges`. The following would allow `"my-package":
27
27
```yaml
28
28
steps:
29
29
- name: Checkout
30
-
uses: actions/checkout@v2
30
+
uses: actions/checkout@v3
31
31
32
32
- uses: ExpediaGroup/package-json-validator@v1
33
33
with:
@@ -43,7 +43,7 @@ The following usage would allow `"my-package": "1.2.3"` but prevent `"my-package
43
43
```yaml
44
44
steps:
45
45
- name: Checkout
46
-
uses: actions/checkout@v2
46
+
uses: actions/checkout@v3
47
47
48
48
- uses: ExpediaGroup/package-json-validator@v1
49
49
with:
@@ -55,19 +55,57 @@ The following usage would allow `"my-package": "1.2.3-canary.456.0"` but prevent
55
55
```yaml
56
56
steps:
57
57
- name: Checkout
58
-
uses: actions/checkout@v2
58
+
uses: actions/checkout@v3
59
59
60
60
- uses: ExpediaGroup/package-json-validator@v1
61
61
with:
62
62
rules: tags
63
63
allowed-tags: canary
64
64
```
65
65
66
+
### Resolutions
67
+
The "resolutions" rule validates that your package.json does not contain the `resolutions` option.
68
+
69
+
```yaml
70
+
steps:
71
+
- name: Checkout
72
+
uses: actions/checkout@v3
73
+
74
+
- uses: ExpediaGroup/package-json-validator@v1
75
+
with:
76
+
rules: resolutions
77
+
```
78
+
79
+
### Keys
80
+
The "keys" rule validates that your package.json does not contain duplicate dependency keys.
81
+
82
+
```yaml
83
+
steps:
84
+
- name: Checkout
85
+
uses: actions/checkout@v3
86
+
87
+
- uses: ExpediaGroup/package-json-validator@v1
88
+
with:
89
+
rules: keys
90
+
```
91
+
92
+
Example invalid package.json this will prevent:
93
+
```json
94
+
{
95
+
"dependencies": {
96
+
"some-dependency": "1.0.0",
97
+
"some-dependency": "2.0.0"
98
+
}
99
+
}
100
+
```
101
+
102
+
## Other Inputs
103
+
66
104
Specify `dependency-types` to denote which type of package.json dependencies you wish to validate. Valid options include `dependencies`, `devDependencies`, `peerDependencies`, and `optionalDependencies`. Defaults to `dependencies`.
67
105
```yaml
68
106
steps:
69
107
- name: Checkout
70
-
uses: actions/checkout@v2
108
+
uses: actions/checkout@v3
71
109
72
110
- uses: ExpediaGroup/package-json-validator@v1
73
111
with:
@@ -79,7 +117,7 @@ Specify `ignore-packages` to skip validation entirely for certain packages. Opti
79
117
```yaml
80
118
steps:
81
119
- name: Checkout
82
-
uses: actions/checkout@v2
120
+
uses: actions/checkout@v3
83
121
84
122
- uses: ExpediaGroup/package-json-validator@v1
85
123
with:
@@ -92,7 +130,7 @@ You may also enforce multiple rules (and pass additional inputs) like this:
0 commit comments