diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz index d2bd4dec..f999ce1d 100644 Binary files a/.yarn/install-state.gz and b/.yarn/install-state.gz differ diff --git a/.yarnrc.yml b/.yarnrc.yml index fe7ac650..5eb1835a 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -2,6 +2,8 @@ cacheFolder: .yarn/cache compressionLevel: 0 +checksumBehavior: ignore # necessary on Windows because of https://github.com/yarnpkg/berry/issues/5795 + enableGlobalCache: false nodeLinker: pnp diff --git a/README.md b/README.md index 026c2ee0..41765da6 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,9 @@ Regardless of the platform you are working on, you will need to have Yarn instal 1. Install necessary packages: * Windows - - Be sure to run `yarn global add windows-build-tools` from an elevated prompt (as an administrator) to install `windows-build-tools`. + - Install Visual Studio Build Tools manually. Download: https://aka.ms/vs/17/release/vs_BuildTools.exe + - Open it and choose Desktop development with C++. + - maybe? at command prompt: setx GYP_MSVS_VERSION 2022 * macOS - Once you have installed Yarn, you can skip this section! * Linux (You can see [here](https://en.wikipedia.org/wiki/List_of_Linux_distributions) what your Linux is based on.) diff --git a/app/.yarnrc b/app/.yarnrc deleted file mode 100644 index 45291c13..00000000 --- a/app/.yarnrc +++ /dev/null @@ -1 +0,0 @@ -registry "https://registry.npmjs.org/" diff --git a/bin/cp-snapshot.js b/bin/cp-snapshot.js index fe30e52c..a800117c 100644 --- a/bin/cp-snapshot.js +++ b/bin/cp-snapshot.js @@ -1,3 +1,4 @@ + const path = require('path'); const fs = require('fs'); const fsPromises = require('fs/promises'); @@ -15,19 +16,24 @@ function copySnapshot(pathToElectron, archToCopy) { } function getPathToElectron() { + const electronPath = require.resolve('electron'); + switch (process.platform) { case 'darwin': return path.resolve( - __dirname, + electronPath, '..', - 'node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources' + '..', + '..', + 'dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources' ); case 'win32': case 'linux': - return path.resolve(__dirname, '..', 'node_modules', 'electron', 'dist'); + return path.resolve(electronPath, '..', '..', '..', 'dist'); } } + function getV8ContextFileName(archToCopy) { return `snapshot_blob.bin`; } diff --git a/bin/mk-snapshot.js b/bin/mk-snapshot.js index d1532325..03ece94e 100644 --- a/bin/mk-snapshot.js +++ b/bin/mk-snapshot.js @@ -4,6 +4,7 @@ const path = require('path'); const fs = require('fs'); const electronLink = require('electron-link'); const {mkdirp} = require('fs-extra'); +const pnp = require("pnpapi"); const excludedModules = {}; @@ -15,6 +16,12 @@ const archMap = { }; async function main() { + const npmConfigArch = process.env.npm_config_arch; + if (!npmConfigArch) { + throw new Error('env var npm_config_arch is not specified') + } + + const baseDirPath = path.resolve(__dirname, '..'); console.log('Creating a linked script..'); @@ -32,12 +39,14 @@ async function main() { // Verify if we will be able to use this in `mksnapshot` vm.runInNewContext(result.snapshotScript, undefined, {filename: snapshotScriptPath, displayErrors: true}); - const outputBlobPath = `${baseDirPath}/cache/${process.env.npm_config_arch}`; + const outputBlobPath = `${baseDirPath}/cache/${npmConfigArch}`; await mkdirp(outputBlobPath); + const baseDir = pnp.resolveToUnqualified("electron-mksnapshot", __filename); + const mksnapshotBinPath = path.resolve(baseDir, "bin", "mksnapshot" + (process.platform === "win32" ? ".exe" : "")); + if (process.platform !== 'darwin') { // TODO non-darwin - const mksnapshotBinPath = path.dirname(require.resolve('electron-mksnapshot/bin/mksnapshot')); const matchingDirs = crossArchDirs.map((dir) => `${mksnapshotBinPath}/${dir}`).filter((dir) => fs.existsSync(dir)); for (const dir of matchingDirs) { if (fs.existsSync(`${mksnapshotBinPath}/gen/v8/embedded.S`)) { diff --git a/package.json b/package.json index 9476ca89..aabd184c 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,6 @@ "email": "team@zeit.co" }, "dependencies": { - "@electron/remote": "2.1.2", "@react-icons/all-files": "4.1.0", "@redux-devtools/extension": "^3.3.0", "@xterm/addon-canvas": "0.7.0", @@ -93,6 +92,7 @@ "@babel/preset-react": "7.25.9", "@babel/preset-typescript": "7.26.0", "@electron/rebuild": "^3.7.1", + "@electron/remote": "2.1.2", "@types/args": "5.0.3", "@types/async-retry": "1.4.9", "@types/color": "3.0.6", diff --git a/scripts/mk-snapshot.js b/scripts/mk-snapshot.js index 9d6b006d..ec38597d 100644 --- a/scripts/mk-snapshot.js +++ b/scripts/mk-snapshot.js @@ -15,5 +15,7 @@ process.env.ELECTRON_CUSTOM_VERSION = version; const downloadScript = pnp.resolveToUnqualified("electron-mksnapshot/download-mksnapshot.js", __filename); const mkSnapshotScript = path.resolve(__dirname, "../bin/mk-snapshot.js"); -execSync(`node ${downloadScript}`, { stdio: "inherit" }); +execSync(`node ${downloadScript}`, { + stdio: "inherit", +}); execSync(`node ${mkSnapshotScript}`, { stdio: "inherit" });