@@ -3,17 +3,24 @@ const path = require("path");
33
44// An array of dependencies whose version checks are ignored for all the
55// packages
6- const IGNORE_FROM_ALL = [ "web3" , "hardhat" ] ;
6+ const IGNORE_SAME_VERSION_FROM_ALL = [ "web3" , "hardhat" ] ;
77
88// A map from dependencies to package names where it should be ignored
9- const IGNORE_FOR_PACKAGES = {
9+ const IGNORE_SAME_VERSION_FOR_PACKAGES = {
1010 chai : [ "@nomiclabs/hardhat-truffle4" , "@nomiclabs/hardhat-truffle5" ] ,
1111 "@types/chai" : [ "@nomiclabs/hardhat-truffle4" , "@nomiclabs/hardhat-truffle5" ] ,
1212 "truffle-contract" : [
1313 "@nomiclabs/hardhat-truffle4" ,
14- "@nomiclabs/hardhat-truffle5" ,
14+ "@nomiclabs/hardhat-truffle5"
1515 ] ,
1616 ethers : [ "@nomiclabs/hardhat-etherscan" ] ,
17+ typescript : [ "hardhat" ] ,
18+ [ "ts-node" ] : [ "hardhat" ]
19+ } ;
20+
21+ const IGNORE_PEER_DEPENDENCIES_CHECK_FOR_PACKAGES = {
22+ typescript : [ "hardhat" ] ,
23+ [ "ts-node" ] : [ "hardhat" ]
1724} ;
1825
1926function checkPeerDepedencies ( packageJson ) {
@@ -31,6 +38,10 @@ function checkPeerDepedencies(packageJson) {
3138
3239 let success = true ;
3340 for ( const dependency of Object . keys ( packageJson . peerDependencies ) ) {
41+ if ( IGNORE_PEER_DEPENDENCIES_CHECK_FOR_PACKAGES [ dependency ] ?. includes ( packageJson . name ) ) {
42+ continue ;
43+ }
44+
3445 if ( packageJson . devDependencies [ dependency ] === undefined ) {
3546 console . error (
3647 `${ packageJson . name } has ${ dependency } as peerDependency, but not as devDependency`
@@ -62,13 +73,13 @@ function addDependencies(packageName, dependenciesToAdd, allDependenciesMap) {
6273 }
6374
6475 for ( const [ name , spec ] of Object . entries ( dependenciesToAdd ) ) {
65- if ( IGNORE_FROM_ALL . includes ( name ) ) {
76+ if ( IGNORE_SAME_VERSION_FROM_ALL . includes ( name ) ) {
6677 continue ;
6778 }
6879
6980 if (
70- IGNORE_FOR_PACKAGES [ name ] !== undefined &&
71- IGNORE_FOR_PACKAGES [ name ] . includes ( packageName )
81+ IGNORE_SAME_VERSION_FOR_PACKAGES [ name ] !== undefined &&
82+ IGNORE_SAME_VERSION_FOR_PACKAGES [ name ] . includes ( packageName )
7283 ) {
7384 continue ;
7485 }
0 commit comments