feat: bump minimum node version to 16 and add tests (#86)
BREAKING CHANGE: Minimum node version is now 16
This commit is contained in:
committed by
Samuel Attard
parent
bb304ce10b
commit
b6f0c88db4
@@ -3,7 +3,7 @@ import { execFileSync } from 'child_process';
|
||||
import crypto from 'crypto';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import minimatch from 'minimatch';
|
||||
import { minimatch } from 'minimatch';
|
||||
import os from 'os';
|
||||
import { d } from './debug';
|
||||
|
||||
@@ -25,18 +25,15 @@ export type MergeASARsOptions = {
|
||||
// See: https://github.com/apple-opensource-mirror/llvmCore/blob/0c60489d96c87140db9a6a14c6e82b15f5e5d252/include/llvm/Object/MachOFormat.h#L108-L112
|
||||
const MACHO_MAGIC = new Set([
|
||||
// 32-bit Mach-O
|
||||
0xfeedface,
|
||||
0xcefaedfe,
|
||||
0xfeedface, 0xcefaedfe,
|
||||
|
||||
// 64-bit Mach-O
|
||||
0xfeedfacf,
|
||||
0xcffaedfe,
|
||||
0xfeedfacf, 0xcffaedfe,
|
||||
]);
|
||||
|
||||
const MACHO_UNIVERSAL_MAGIC = new Set([
|
||||
// universal
|
||||
0xcafebabe,
|
||||
0xbebafeca,
|
||||
0xcafebabe, 0xbebafeca,
|
||||
]);
|
||||
|
||||
export const detectAsarMode = async (appPath: string) => {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { spawn } from '@malept/cross-spawn-promise';
|
||||
import * as asar from '@electron/asar';
|
||||
import * as crypto from 'crypto';
|
||||
import * as fs from 'fs-extra';
|
||||
import minimatch from 'minimatch';
|
||||
import { minimatch } from 'minimatch';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as plist from 'plist';
|
||||
@@ -31,7 +30,7 @@ export type MakeUniversalOpts = {
|
||||
/**
|
||||
* Forcefully overwrite any existing files that are in the way of generating the universal application
|
||||
*/
|
||||
force: boolean;
|
||||
force?: boolean;
|
||||
/**
|
||||
* Merge x64 and arm64 ASARs into one.
|
||||
*/
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
import * as fs from 'fs-extra';
|
||||
import * as crypto from 'crypto';
|
||||
import { pipeline } from 'stream/promises';
|
||||
|
||||
import { d } from './debug';
|
||||
|
||||
export const sha = async (filePath: string) => {
|
||||
d('hashing', filePath);
|
||||
const hash = crypto.createHash('sha256');
|
||||
hash.setEncoding('hex');
|
||||
const fileStream = fs.createReadStream(filePath);
|
||||
fileStream.pipe(hash);
|
||||
await new Promise((resolve, reject) => {
|
||||
fileStream.on('end', () => resolve());
|
||||
fileStream.on('error', (err) => reject(err));
|
||||
});
|
||||
await pipeline(fs.createReadStream(filePath), hash);
|
||||
return hash.read();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user