Skip to content

Commit

Permalink
chore(scripts): make sure that update-electron script hoists all elec…
Browse files Browse the repository at this point in the history
…tron and electron related deps (#6279)

* chore: update electron

* chore(scripts): make sure all electron related dependencies are hoisted

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
gribnoysup and github-actions[bot] authored Sep 25, 2024
1 parent 9d33a70 commit f8d79ba
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 75 deletions.
2 changes: 1 addition & 1 deletion configs/webpack-config-compass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
"babel-loader": "^8.2.5",
"babel-plugin-istanbul": "^5.2.0",
"browserslist": "^4.23.3",
"browserslist": "^4.24.0",
"chalk": "^4.1.2",
"cli-progress": "^3.9.1",
"core-js": "^3.17.3",
Expand Down
101 changes: 32 additions & 69 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/hadron-build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"lodash": "^4.17.21",
"moment": "^2.29.4",
"mongodb-js-cli": "^0.0.3",
"node-abi": "^3.67.0",
"node-abi": "^3.68.0",
"normalize-package-data": "^2.3.5",
"parse-github-repo-url": "^1.3.0",
"semver": "^7.6.2",
Expand Down
13 changes: 9 additions & 4 deletions scripts/update-electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@ const path = require('path');
const { forEachPackage } = require('@mongodb-js/monorepo-tools');
const { runInDir } = require('./run-in-dir');

async function cleanAndBootstrap(electronVersion) {
async function cleanAndBootstrap(newVersions) {
try {
await runInDir("npx lerna exec 'rm -Rf node_modules'");
await runInDir('rm -Rf node_modules');
const packageJsonBkp = fs.readFileSync('./package.json');
await runInDir('npm i');
// Make sure electron is hoisted on the root
await runInDir(`npm i electron@${electronVersion}`);
// Make sure all new deps are hoisted on the root
const versionsToInstall = Object.entries(newVersions)
.map(([name, version]) => {
return `${name}@${version}`;
})
.join(' ');
await runInDir(`npm i ${versionsToInstall}`);
await runInDir('npm run bootstrap');
fs.writeFileSync('./package.json', packageJsonBkp);
// Run install again to make sure root level electron is removed from
Expand Down Expand Up @@ -122,7 +127,7 @@ async function main() {
});

console.log('Cleaning node_modules and rebootstrapping');
cleanAndBootstrap(latestElectronVersion);
cleanAndBootstrap(newVersions);
}

main();

0 comments on commit f8d79ba

Please sign in to comment.