mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-16 05:38:41 -09:00
Changes
This commit is contained in:
parent
06f040a566
commit
359f2b7600
3 changed files with 26 additions and 8 deletions
13
bin/cp-snapshot.js
vendored
13
bin/cp-snapshot.js
vendored
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const fsPromises = require('fs/promises');
|
const fsPromises = require('fs/promises');
|
||||||
|
|
@ -10,24 +11,30 @@ function copySnapshot(pathToElectron, archToCopy) {
|
||||||
const pathToBlobV8 = path.resolve(__dirname, '..', 'cache', archToCopy, v8ContextFileName);
|
const pathToBlobV8 = path.resolve(__dirname, '..', 'cache', archToCopy, v8ContextFileName);
|
||||||
|
|
||||||
console.log('Copying v8 snapshots from', pathToBlob, 'to', pathToElectron);
|
console.log('Copying v8 snapshots from', pathToBlob, 'to', pathToElectron);
|
||||||
|
fs.mkdirSync(pathToElectron, { recursive: true });
|
||||||
fs.copyFileSync(pathToBlob, path.join(pathToElectron, snapshotFileName));
|
fs.copyFileSync(pathToBlob, path.join(pathToElectron, snapshotFileName));
|
||||||
fs.copyFileSync(pathToBlobV8, path.join(pathToElectron, v8ContextFileName));
|
fs.copyFileSync(pathToBlobV8, path.join(pathToElectron, v8ContextFileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPathToElectron() {
|
function getPathToElectron() {
|
||||||
|
const electronPath = require.resolve('electron');
|
||||||
|
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return path.resolve(
|
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 'win32':
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return path.resolve(__dirname, '..', 'node_modules', 'electron', 'dist');
|
return path.resolve(electronPath, '..', '..', '..', 'dist');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getV8ContextFileName(archToCopy) {
|
function getV8ContextFileName(archToCopy) {
|
||||||
return `snapshot_blob.bin`;
|
return `snapshot_blob.bin`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
16
bin/mk-snapshot.js
vendored
16
bin/mk-snapshot.js
vendored
|
|
@ -4,6 +4,7 @@ const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const electronLink = require('electron-link');
|
const electronLink = require('electron-link');
|
||||||
const {mkdirp} = require('fs-extra');
|
const {mkdirp} = require('fs-extra');
|
||||||
|
const pnp = require("pnpapi");
|
||||||
|
|
||||||
const excludedModules = {};
|
const excludedModules = {};
|
||||||
|
|
||||||
|
|
@ -15,6 +16,12 @@ const archMap = {
|
||||||
};
|
};
|
||||||
|
|
||||||
async function main() {
|
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, '..');
|
const baseDirPath = path.resolve(__dirname, '..');
|
||||||
|
|
||||||
console.log('Creating a linked script..');
|
console.log('Creating a linked script..');
|
||||||
|
|
@ -32,11 +39,14 @@ async function main() {
|
||||||
// Verify if we will be able to use this in `mksnapshot`
|
// Verify if we will be able to use this in `mksnapshot`
|
||||||
vm.runInNewContext(result.snapshotScript, undefined, {filename: snapshotScriptPath, displayErrors: true});
|
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);
|
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') {
|
if (process.platform !== 'darwin') {
|
||||||
const mksnapshotBinPath = `${baseDirPath}/node_modules/electron-mksnapshot/bin`;
|
// TODO non-darwin
|
||||||
const matchingDirs = crossArchDirs.map((dir) => `${mksnapshotBinPath}/${dir}`).filter((dir) => fs.existsSync(dir));
|
const matchingDirs = crossArchDirs.map((dir) => `${mksnapshotBinPath}/${dir}`).filter((dir) => fs.existsSync(dir));
|
||||||
for (const dir of matchingDirs) {
|
for (const dir of matchingDirs) {
|
||||||
if (fs.existsSync(`${mksnapshotBinPath}/gen/v8/embedded.S`)) {
|
if (fs.existsSync(`${mksnapshotBinPath}/gen/v8/embedded.S`)) {
|
||||||
|
|
@ -50,7 +60,7 @@ async function main() {
|
||||||
|
|
||||||
console.log(`Generating startup blob in "${outputBlobPath}"`);
|
console.log(`Generating startup blob in "${outputBlobPath}"`);
|
||||||
const res = childProcess.execFileSync(
|
const res = childProcess.execFileSync(
|
||||||
path.resolve(__dirname, '..', 'node_modules', 'electron-mksnapshot', 'bin', 'mksnapshot' + (process.platform === 'win32' ? '.exe' : '')),
|
require.resolve(`electron-mksnapshot/bin/mksnapshot${process.platform === 'win32' ? '.exe' : ''}`),
|
||||||
[
|
[
|
||||||
'--startup-src=' + snapshotScriptPath,
|
'--startup-src=' + snapshotScriptPath,
|
||||||
'--startup-blob=' + startupBlobPath,
|
'--startup-blob=' + startupBlobPath,
|
||||||
|
|
|
||||||
5
bin/notarize.js
vendored
5
bin/notarize.js
vendored
|
|
@ -1,11 +1,12 @@
|
||||||
const { notarize } = require("@electron/notarize");
|
|
||||||
|
|
||||||
exports.default = async function notarizing(context) {
|
exports.default = async function notarizing(context) {
|
||||||
|
|
||||||
const { electronPlatformName, appOutDir } = context;
|
const { electronPlatformName, appOutDir } = context;
|
||||||
if (electronPlatformName !== "darwin" || !process.env.APPLE_ID || !process.env.APPLE_PASSWORD) {
|
if (electronPlatformName !== "darwin" || !process.env.APPLE_ID || !process.env.APPLE_PASSWORD) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { notarize } = await import('@electron/notarize');
|
||||||
|
|
||||||
const appName = context.packager.appInfo.productFilename;
|
const appName = context.packager.appInfo.productFilename;
|
||||||
return await notarize({
|
return await notarize({
|
||||||
appBundleId: "com.quineglobal.hyper",
|
appBundleId: "com.quineglobal.hyper",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue