Skip to content

Commit 9894919

Browse files
risantosfranciscocardoso
authored andcommitted
Fix peerDependencies
- Move `validator.js` to dev and peer dependency - Update invalid `optionalPeerDependencies` to `peerDependencies` and `peerDependenciesMeta`
1 parent 0b4e83d commit 9894919

File tree

2 files changed

+66
-5
lines changed

2 files changed

+66
-5
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ $ npm install --save validator.js-asserts
1212
```
1313

1414
### Peer dependencies
15-
Some asserts require manually installing some _peer dependencies_. Failing to do so will result in runtime errors, as packages are required dynamically.
1615

17-
Peer dependencies are not listed on `package.json` because npm 2 considers them _mandatory peer dependencies_ and, therefore, always installs them, while [npm 3](https://github.com/npm/npm/blob/master/CHANGELOG.md#peerdependencies) follows a more consensual approach of _optional peer dependencies_, not installing them by default but generating warning and confusing error messages instead.
16+
Some asserts require manually installing some _peer dependencies_. Failing to do so will result in runtime errors, as packages are required dynamically.
1817

19-
You should pin these package's peer dependencies to the ranges listed on the _optionalPeerDependencies_ key of this package's manifest.
18+
Peer dependencies are listed on `package.json` under `peerDependencies`.
19+
The `peerDependenciesMeta` key identifies which peer dependencies are optional. NPM will not automatically install optional peer dependencies. See [the NPM documentation](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#peerdependenciesmeta) for more information.
2020

2121
## Asserts
2222
The following set of extra asserts are provided by this package:

package.json

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
"test:watch": "node --test --watch"
4040
},
4141
"dependencies": {
42-
"lodash": "^4.17.21",
43-
"validator.js": "^2.0.0"
42+
"lodash": "^4.17.21"
4443
},
4544
"devDependencies": {
4645
"@fastify/pre-commit": "^2.2.0",
@@ -62,8 +61,70 @@
6261
"uk-modulus-checking": "0.0.3",
6362
"urijs": "^1.17.1",
6463
"validate-rfc": "^2.0.3",
64+
"validator.js": "^2.0.0",
6565
"validator": "^13.15.15"
6666
},
67+
"peerDependencies": {
68+
"abavalidator": "^2.0.0",
69+
"bignumber.js": ">=7 || <=9.3.0",
70+
"cpf": "^2.0.1",
71+
"creditcard": ">=0.0.1 <1.0.0",
72+
"curp": "^1.2.3",
73+
"google-libphonenumber": ">=1 <4",
74+
"iban": ">=0.0.6 <1.0.0",
75+
"isoc": ">=0.0.1 <1.0.0",
76+
"moment": "^2.0.0",
77+
"tin-validator": "^1.0.0",
78+
"uk-modulus-checking": "^0.0.2",
79+
"urijs": "^1.0.0",
80+
"validate-rfc": "^2.0.3",
81+
"validator.js": "^2.0.0",
82+
"validator": ">=3 <14"
83+
},
84+
"peerDependenciesMeta": {
85+
"abavalidator": {
86+
"optional": true
87+
},
88+
"bignumber.js": {
89+
"optional": true
90+
},
91+
"cpf": {
92+
"optional": true
93+
},
94+
"creditcard": {
95+
"optional": true
96+
},
97+
"curp": {
98+
"optional": true
99+
},
100+
"google-libphonenumber": {
101+
"optional": true
102+
},
103+
"iban": {
104+
"optional": true
105+
},
106+
"isoc": {
107+
"optional": true
108+
},
109+
"moment": {
110+
"optional": true
111+
},
112+
"tin-validator": {
113+
"optional": true
114+
},
115+
"uk-modulus-checking": {
116+
"optional": true
117+
},
118+
"urijs": {
119+
"optional": true
120+
},
121+
"validate-rfc": {
122+
"optional": true
123+
},
124+
"validator": {
125+
"optional": true
126+
}
127+
},
67128
"engines": {
68129
"node": ">=20"
69130
},

0 commit comments

Comments
 (0)