Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a808beecc | ||
|
|
381ca1a748 | ||
|
|
0d2b974dcc | ||
|
|
0cfaddcc77 | ||
|
|
fddff57c15 |
@@ -1,35 +1,32 @@
|
||||
steps-test: &steps-test
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}
|
||||
- v1-dependencies-{{ arch }}
|
||||
- run: yarn --frozen-lockfile
|
||||
- save_cache:
|
||||
paths:
|
||||
- node_modules
|
||||
key: v1-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}
|
||||
- run: yarn build
|
||||
- run: yarn test
|
||||
|
||||
version: 2.1
|
||||
|
||||
orbs:
|
||||
cfa: continuousauth/npm@1.0.2
|
||||
|
||||
jobs:
|
||||
test:
|
||||
macos:
|
||||
xcode: "13.4.1"
|
||||
resource_class: macos.x86.medium.gen2
|
||||
<<: *steps-test
|
||||
node: electronjs/node@1.4.1
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
test_and_release:
|
||||
# Run the test jobs first, then the release only when all the test jobs are successful
|
||||
jobs:
|
||||
- test
|
||||
- node/test:
|
||||
executor: node/macos
|
||||
name: test-mac-<< matrix.node-version >>
|
||||
override-ci-command: yarn install --frozen-lockfile --ignore-engines
|
||||
test-steps:
|
||||
- run: yarn build
|
||||
- run: yarn lint
|
||||
- run: yarn test
|
||||
use-test-steps: true
|
||||
matrix:
|
||||
alias: test
|
||||
parameters:
|
||||
node-version:
|
||||
- 20.5.0
|
||||
- 18.17.0
|
||||
- 16.20.1
|
||||
- 14.21.3
|
||||
- 12.22.12
|
||||
- 10.24.1
|
||||
- cfa/release:
|
||||
requires:
|
||||
- test
|
||||
@@ -38,4 +35,3 @@ workflows:
|
||||
only:
|
||||
- main
|
||||
context: cfa-release
|
||||
|
||||
|
||||
@@ -1,7 +1,26 @@
|
||||
const path = require('path');
|
||||
|
||||
if (process.arch === 'arm64') {
|
||||
process._archPath = require.resolve('../app-arm64.asar');
|
||||
setPaths('arm64');
|
||||
} else {
|
||||
process._archPath = require.resolve('../app-x64.asar');
|
||||
setPaths('x64');
|
||||
}
|
||||
|
||||
function setPaths(platform) {
|
||||
// This should return the full path, ending in something like
|
||||
// Notion.app/Contents/Resources/app.asar
|
||||
const appPath = app.getAppPath();
|
||||
const asarFile = `app-${platform}.asar`;
|
||||
|
||||
// Maybe we'll handle this in Electron one day
|
||||
if (path.basename(appPath) === 'app.asar') {
|
||||
const platformAppPath = path.join(path.dirname(appPath), asarFile);
|
||||
|
||||
// This is an undocumented API. It exists.
|
||||
app.setAppPath(platformAppPath);
|
||||
}
|
||||
|
||||
process._archPath = require.resolve(`../${asarFile}`);
|
||||
}
|
||||
|
||||
require(process._archPath);
|
||||
|
||||
@@ -1,7 +1,24 @@
|
||||
if (process.arch === 'arm64') {
|
||||
process._archPath = require.resolve('../app-arm64');
|
||||
setPaths('arm64');
|
||||
} else {
|
||||
process._archPath = require.resolve('../app-x64');
|
||||
setPaths('x64');
|
||||
}
|
||||
|
||||
function setPaths(platform) {
|
||||
// This should return the full path, ending in something like
|
||||
// Notion.app/Contents/Resources/app
|
||||
const appPath = app.getAppPath();
|
||||
const appFolder = `app-${platform}`;
|
||||
|
||||
// Maybe we'll handle this in Electron one day
|
||||
if (path.basename(appPath) === 'app') {
|
||||
const platformAppPath = path.join(path.dirname(appPath), appFolder);
|
||||
|
||||
// This is an undocumented private API. It exists.
|
||||
app.setAppPath(platformAppPath);
|
||||
}
|
||||
|
||||
process._archPath = require.resolve(`../${appFolder}`);
|
||||
}
|
||||
|
||||
require(process._archPath);
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
"author": "Samuel Attard",
|
||||
"scripts": {
|
||||
"build": "tsc && tsc -p tsconfig.esm.json",
|
||||
"lint": "prettier --check \"src/**/*.ts\"",
|
||||
"lint": "prettier --check \"{src,entry-asar}/**/*.{js,ts}\"",
|
||||
"prettier:write": "prettier --write \"{src,entry-asar}/**/*.{js,ts}\"",
|
||||
"prepublishOnly": "npm run build",
|
||||
"test": "exit 0",
|
||||
"prepare": "husky install"
|
||||
@@ -56,4 +57,4 @@
|
||||
"prettier --write"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,12 @@ const MACHO_MAGIC = new Set([
|
||||
0xcffaedfe,
|
||||
]);
|
||||
|
||||
const MACHO_UNIVERSAL_MAGIC = new Set([
|
||||
// universal
|
||||
0xcafebabe,
|
||||
0xbebafeca,
|
||||
]);
|
||||
|
||||
export const detectAsarMode = async (appPath: string) => {
|
||||
d('checking asar mode of', appPath);
|
||||
const asarPath = path.resolve(appPath, 'Contents', 'Resources', 'app.asar');
|
||||
@@ -147,6 +153,13 @@ export const mergeASARs = async ({
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
MACHO_UNIVERSAL_MAGIC.has(x64Content.readUInt32LE(0)) &&
|
||||
MACHO_UNIVERSAL_MAGIC.has(arm64Content.readUInt32LE(0))
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!MACHO_MAGIC.has(x64Content.readUInt32LE(0))) {
|
||||
throw new Error(`Can't reconcile two non-macho files ${file}`);
|
||||
}
|
||||
|
||||
19
yarn.lock
19
yarn.lock
@@ -2309,22 +2309,17 @@ semver-compare@^1.0.0:
|
||||
integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w=
|
||||
|
||||
"semver@2 || 3 || 4 || 5":
|
||||
version "5.7.1"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
|
||||
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
|
||||
version "5.7.2"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8"
|
||||
integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==
|
||||
|
||||
semver@^7.0.0, semver@^7.1.1, semver@^7.3.5, semver@^7.3.7:
|
||||
version "7.3.8"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798"
|
||||
integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==
|
||||
semver@^7.0.0, semver@^7.1.1, semver@^7.1.2, semver@^7.3.5, semver@^7.3.7:
|
||||
version "7.5.4"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
|
||||
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
|
||||
dependencies:
|
||||
lru-cache "^6.0.0"
|
||||
|
||||
semver@^7.1.2:
|
||||
version "7.3.2"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938"
|
||||
integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==
|
||||
|
||||
set-blocking@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
|
||||
|
||||
Reference in New Issue
Block a user