forked from babel/babel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: replace yarn-upgrade by bump-babel-dependencies in e2e tests (b…
…abel#11021) * chore: pin yarn version in e2e vue tests * fix: replace yarn-upgrade by bump-babel-dependencies * chore: update e2e-cra test
- Loading branch information
Showing
3 changed files
with
35 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
scripts/integration-tests/utils/bump-babel-dependencies.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const cwd = process.cwd(); | ||
const packageJSONPath = path.resolve(cwd, "./package.json"); | ||
const content = JSON.parse(fs.readFileSync(packageJSONPath)); | ||
|
||
let bumped = false; | ||
function bumpBabelDependency(dependencies) { | ||
for (const dep of Object.keys(dependencies)) { | ||
if (dep.startsWith("@babel/")) { | ||
dependencies[dep] = "latest"; | ||
bumped = true; | ||
} | ||
} | ||
} | ||
|
||
if ("peerDependencies" in content) { | ||
bumpBabelDependency(content.peerDependencies); | ||
} | ||
if ("devDependencies" in content) { | ||
bumpBabelDependency(content.devDependencies); | ||
} | ||
if ("dependencies" in content) { | ||
bumpBabelDependency(content.dependencies); | ||
} | ||
|
||
if (bumped) { | ||
fs.writeFileSync(packageJSONPath, JSON.stringify(content, undefined, 2)); | ||
} |