forked from latticexyz/mud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pnpmfile.cjs
30 lines (28 loc) · 1.19 KB
/
.pnpmfile.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module.exports = {
hooks: {
readPackage,
},
};
const desiredPackageVersions = {
"@ethersproject/abi": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
ethers: "^5.7.2",
};
function readPackage(pkg) {
// I was seeing the following TS error in `network` and other packages:
//
// The inferred type of 'createNetwork' cannot be named without a reference to '.pnpm/@ethersproject+providers@5.7.2/node_modules/@ethersproject/providers'. This is likely not portable. A type annotation is necessary.
//
// This seems to come from some combination of using/exporting ethers internals and also typechain-generated files. This is made worse by the fact that typechain uses older versions of ethers, which makes it harder for us and TS to resolve the proper types. So we'll normalize the version numbers here.
if (pkg.name === "@typechain/ethers-v5") {
Object.entries(desiredPackageVersions).forEach(([packageName, desiredVersion]) => {
if (pkg.devDependencies[packageName]) {
pkg.devDependencies[packageName] = desiredVersion;
}
if (pkg.peerDependencies[packageName]) {
pkg.peerDependencies[packageName] = desiredVersion;
}
});
}
return pkg;
}