-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpnpmfile.js
More file actions
34 lines (33 loc) · 1.05 KB
/
pnpmfile.js
File metadata and controls
34 lines (33 loc) · 1.05 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
const babelCoreVersion = 'bridge'
const babelRuntimeVersion = 'next' //'7.0.0-beta.3'
const regenVersion = '<0.13'
const readPackage = (pkg, context) => {
// Fix Jest dependencies on babel
const core = pkg.dependencies && pkg.dependencies['babel-core']
const runtime = pkg.dependencies && pkg.dependencies['babel-runtime']
const regen = pkg.dependencies && pkg.dependencies['regenerator-runtime']
if (/^.?6/.test(core)) {
pkg.dependencies['babel-core'] = babelCoreVersion
context.log(
`replacing ${pkg.name}'s babel-core dep ${core} with ${babelCoreVersion}`
)
}
if (/^.?6/.test(runtime)) {
pkg.dependencies['babel-runtime'] = babelRuntimeVersion
context.log(
`replacing ${
pkg.name
}'s babel-runtime dep ${runtime} with ${babelRuntimeVersion}`
)
}
if (regen && regen !== regenVersion) {
pkg.dependencies['regenerator-runtime'] = regenVersion
context.log(
`replacing ${
pkg.name
}'s regenerator-runtime dep ${regen} with ${regenVersion} (fix until newer Babel runtime)`
)
}
return pkg
}
module.exports = {hooks: {readPackage}}