mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Updates to scripts (#180)
This commit is contained in:
parent
47ff892422
commit
40cece79ba
4 changed files with 38 additions and 10 deletions
13
bin/cp-snapshot.js
vendored
13
bin/cp-snapshot.js
vendored
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const fsPromises = require('fs/promises');
|
||||
|
|
@ -10,24 +11,30 @@ function copySnapshot(pathToElectron, archToCopy) {
|
|||
const pathToBlobV8 = path.resolve(__dirname, '..', 'cache', archToCopy, v8ContextFileName);
|
||||
|
||||
console.log('Copying v8 snapshots from', pathToBlob, 'to', pathToElectron);
|
||||
fs.mkdirSync(pathToElectron, { recursive: true });
|
||||
fs.copyFileSync(pathToBlob, path.join(pathToElectron, snapshotFileName));
|
||||
fs.copyFileSync(pathToBlobV8, path.join(pathToElectron, v8ContextFileName));
|
||||
}
|
||||
|
||||
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`;
|
||||
}
|
||||
|
|
|
|||
26
bin/mk-snapshot.js
vendored
26
bin/mk-snapshot.js
vendored
|
|
@ -15,6 +15,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,11 +38,25 @@ 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);
|
||||
|
||||
let mksnapshotBinPath
|
||||
if (process.platform === 'win32') {
|
||||
mksnapshotBinPath =
|
||||
require.resolve(
|
||||
path.join("electron-mksnapshot", "bin", "mksnapshot.exe")
|
||||
);
|
||||
} else {
|
||||
mksnapshotBinPath =
|
||||
require.resolve(
|
||||
path.join("electron-mksnapshot", "bin", "mksnapshot")
|
||||
);
|
||||
}
|
||||
|
||||
mksnapshotBinPath = path.dirname(mksnapshotBinPath);
|
||||
|
||||
if (process.platform !== 'darwin') {
|
||||
const mksnapshotBinPath = `${baseDirPath}/node_modules/electron-mksnapshot/bin`;
|
||||
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`)) {
|
||||
|
|
@ -50,7 +70,7 @@ async function main() {
|
|||
|
||||
console.log(`Generating startup blob in "${outputBlobPath}"`);
|
||||
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-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) {
|
||||
|
||||
const { electronPlatformName, appOutDir } = context;
|
||||
if (electronPlatformName !== "darwin" || !process.env.APPLE_ID || !process.env.APPLE_PASSWORD) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { notarize } = await import('@electron/notarize');
|
||||
|
||||
const appName = context.packager.appInfo.productFilename;
|
||||
return await notarize({
|
||||
appBundleId: "com.quineglobal.hyper",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "hyper",
|
||||
"name": "hyper-root",
|
||||
"version": "4.0.0-q-canary.8",
|
||||
"repository": "quine-global/hyper",
|
||||
"engines": {
|
||||
|
|
|
|||
Loading…
Reference in a new issue