Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(scripts): make sure that update-electron script hoists all electron and electron related deps #6279

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
Loading