Skip to content

Commit

Permalink
fix: Revert "feat: bump minimum node version to 16 and add tests (#86)"
Browse files Browse the repository at this point in the history
This reverts commit 8e2842b.
  • Loading branch information
MarshallOfSound committed Nov 9, 2023
1 parent 8e2842b commit bb304ce
Show file tree
Hide file tree
Showing 18 changed files with 1,463 additions and 3,622 deletions.
8 changes: 5 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: 2.1

orbs:
cfa: continuousauth/npm@2.0.0
node: electronjs/node@2.1.0
cfa: continuousauth/npm@1.0.2
node: electronjs/node@1.4.1

workflows:
test_and_release:
Expand All @@ -13,7 +13,6 @@ workflows:
name: test-mac-<< matrix.node-version >>
override-ci-command: yarn install --frozen-lockfile --ignore-engines
test-steps:
- node/install-rosetta
- run: yarn build
- run: yarn lint
- run: yarn test
Expand All @@ -25,6 +24,9 @@ workflows:
- 20.5.0
- 18.17.0
- 16.20.1
- 14.21.3
- 12.22.12
- 10.24.1
- cfa/release:
requires:
- test
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ dist
entry-asar/*.js*
entry-asar/*.ts
*.app
test/fixtures/apps
coverage
14 changes: 0 additions & 14 deletions jest.config.js

This file was deleted.

57 changes: 0 additions & 57 deletions jest.setup.ts

This file was deleted.

49 changes: 20 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"url": "https://github.com/electron/universal.git"
},
"engines": {
"node": ">=16.4"
"node": ">=8.6"
},
"files": [
"dist/*",
Expand All @@ -26,45 +26,36 @@
"author": "Samuel Attard",
"scripts": {
"build": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && tsc -p tsconfig.entry-asar.json",
"lint": "prettier --check \"{src,entry-asar,test}/**/*.ts\" \"*.ts\"",
"prettier:write": "prettier --write \"{src,entry-asar,test}/**/*.ts\" \"*.ts\"",
"lint": "prettier --check \"{src,entry-asar}/**/*.ts\"",
"prettier:write": "prettier --write \"{src,entry-asar}/**/*.ts\"",
"prepublishOnly": "npm run build",
"test": "jest",
"test": "exit 0",
"prepare": "husky install"
},
"devDependencies": {
"@continuous-auth/semantic-release-npm": "^4.0.0",
"@electron/get": "^3.0.0",
"@types/cross-zip": "^4.0.1",
"@types/debug": "^4.1.10",
"@types/fs-extra": "^11.0.3",
"@types/jest": "^29.5.7",
"@types/minimatch": "^5.1.2",
"@types/node": "^20.8.10",
"@types/plist": "^3.0.4",
"cross-zip": "^4.0.0",
"husky": "^8.0.3",
"jest": "^29.7.0",
"lint-staged": "^15.0.2",
"prettier": "^3.0.3",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
"@continuous-auth/semantic-release-npm": "^3.0.0",
"@types/debug": "^4.1.5",
"@types/fs-extra": "^9.0.4",
"@types/minimatch": "^3.0.5",
"@types/node": "^14.14.7",
"@types/plist": "^3.0.2",
"husky": "^8.0.0",
"lint-staged": "^10.5.1",
"prettier": "^2.1.2",
"typescript": "^4.0.5"
},
"dependencies": {
"@electron/asar": "^3.2.7",
"@malept/cross-spawn-promise": "^2.0.0",
"@electron/asar": "^3.2.1",
"@malept/cross-spawn-promise": "^1.1.0",
"debug": "^4.3.1",
"dir-compare": "^4.2.0",
"fs-extra": "^11.1.1",
"minimatch": "^9.0.3",
"plist": "^3.1.0"
"dir-compare": "^3.0.0",
"fs-extra": "^9.0.1",
"minimatch": "^3.0.4",
"plist": "^3.0.4"
},
"lint-staged": {
"*.ts": [
"prettier --write"
]
},
"resolutions": {
"jackspeak": "2.1.1"
}
}
11 changes: 7 additions & 4 deletions src/asar-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -25,15 +25,18 @@ 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) => {
Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
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';
Expand Down Expand Up @@ -30,7 +31,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.
*/
Expand Down
9 changes: 6 additions & 3 deletions src/sha.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
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');
await pipeline(fs.createReadStream(filePath), hash);
const fileStream = fs.createReadStream(filePath);
fileStream.pipe(hash);
await new Promise((resolve, reject) => {
fileStream.on('end', () => resolve());
fileStream.on('error', (err) => reject(err));
});
return hash.read();
};
26 changes: 0 additions & 26 deletions test/asar-utils.spec.ts

This file was deleted.

61 changes: 0 additions & 61 deletions test/file-utils.spec.ts

This file was deleted.

Binary file removed test/fixtures/asars/app.asar
Binary file not shown.
2 changes: 0 additions & 2 deletions test/fixtures/asars/app/index.js

This file was deleted.

4 changes: 0 additions & 4 deletions test/fixtures/asars/app/package.json

This file was deleted.

1 change: 0 additions & 1 deletion test/fixtures/tohash

This file was deleted.

40 changes: 0 additions & 40 deletions test/index.spec.ts

This file was deleted.

0 comments on commit bb304ce

Please sign in to comment.