-
Notifications
You must be signed in to change notification settings - Fork 1
/
.pnpmfile.cjs
49 lines (45 loc) · 1023 Bytes
/
.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function fixPeerDeps(pkg) {
// @wordpress/* and its dependencies are ages behind
const reactOldPkgs = new Set([
'react-autosize-textarea',
'reakit',
'reakit-system',
'reakit-utils',
'reakit-warning',
'@wordpress/data',
'@wordpress/compose',
'@wordpress/blocks',
'@wordpress/core-data',
]);
if (reactOldPkgs.has(pkg.name)) {
for (const p of ['react', 'react-dom']) {
if (!pkg.peerDependencies?.[p]) {
continue;
}
if (
pkg.peerDependencies[p].match(/(?:^|\|\|\s*)(?:\^16|16\.x)/) &&
!pkg.peerDependencies[p].match(/(?:^|\|\|\s*)(?:\^17|17\.x)/)
) {
pkg.peerDependencies[p] += ' || ^17';
}
if (
pkg.peerDependencies[p].match(/(?:^|\|\|\s*)(?:\^17|17\.x)/) &&
!pkg.peerDependencies[p].match(/(?:^|\|\|\s*)(?:\^18|18\.x)/)
) {
pkg.peerDependencies[p] += ' || ^18';
}
}
}
return pkg;
}
function readPackage(pkg, context) {
if (pkg.name) {
return fixPeerDeps(pkg, context);
}
return pkg;
}
module.exports = {
hooks: {
readPackage,
},
};