-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathpackage-extensions.ts
More file actions
52 lines (49 loc) · 1.2 KB
/
package-extensions.ts
File metadata and controls
52 lines (49 loc) · 1.2 KB
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
50
51
52
/**
* @fileoverview Package extensions for compatibility adjustments.
*
* Package extensions allow modifying package.json fields of dependencies
* to fix compatibility issues, missing peer dependencies, etc.
*/
import yarnPkgExtensions from '@yarnpkg/extensions'
const { freeze: ObjectFreeze } = Object
export default ObjectFreeze(
[
yarnPkgExtensions.packageExtensions,
[
'@yarnpkg/extensions@>=1.1.0',
{
// Properties with undefined values are omitted when saved as JSON.
peerDependencies: undefined,
},
],
[
'abab@>=2.0.0',
{
devDependencies: {
// Lower the Webpack from v4.x to one supported by abab's peers.
webpack: '^3.12.0',
},
},
],
[
'is-generator-function@>=1.0.7',
{
scripts: {
// Make the script a silent no-op.
'test:uglified': '',
},
},
],
].sort((a_, b_) => {
const a = a_[0].slice(0, a_[0].lastIndexOf('@'))
const b = b_[0].slice(0, b_[0].lastIndexOf('@'))
// Simulate the default compareFn of String.prototype.sort.
if (a < b) {
return -1
}
if (a > b) {
return 1
}
return 0
}),
)