This commit is contained in:
Philip Peterson 2025-05-29 01:00:52 -07:00
parent 45461301d0
commit 67a1056042
8 changed files with 29 additions and 9 deletions

Binary file not shown.

View file

@ -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

View file

@ -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.)

View file

@ -1 +0,0 @@
registry "https://registry.npmjs.org/"

12
bin/cp-snapshot.js vendored
View file

@ -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`;
}

13
bin/mk-snapshot.js vendored
View file

@ -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`)) {

View file

@ -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",

View file

@ -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" });