Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fddff57c15 | ||
|
|
b02ce7697f | ||
|
|
85b1f90f2c | ||
|
|
3ecbbd5710 | ||
|
|
8bff0b7579 | ||
|
|
283773eb45 | ||
|
|
a99ae94fc2 | ||
|
|
0d70c1c39f | ||
|
|
ba587f0a08 | ||
|
|
580002844b |
@@ -1,13 +1,10 @@
|
|||||||
step-restore-cache: &step-restore-cache
|
|
||||||
restore_cache:
|
|
||||||
keys:
|
|
||||||
- v1-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}
|
|
||||||
- v1-dependencies-{{ arch }}
|
|
||||||
|
|
||||||
steps-test: &steps-test
|
steps-test: &steps-test
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- *step-restore-cache
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- v1-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}
|
||||||
|
- v1-dependencies-{{ arch }}
|
||||||
- run: yarn --frozen-lockfile
|
- run: yarn --frozen-lockfile
|
||||||
- save_cache:
|
- save_cache:
|
||||||
paths:
|
paths:
|
||||||
@@ -17,27 +14,23 @@ steps-test: &steps-test
|
|||||||
- run: yarn test
|
- run: yarn test
|
||||||
|
|
||||||
version: 2.1
|
version: 2.1
|
||||||
|
|
||||||
|
orbs:
|
||||||
|
cfa: continuousauth/npm@1.0.2
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
macos:
|
macos:
|
||||||
xcode: "13.4.1"
|
xcode: "13.4.1"
|
||||||
|
resource_class: macos.x86.medium.gen2
|
||||||
<<: *steps-test
|
<<: *steps-test
|
||||||
|
|
||||||
release:
|
|
||||||
docker:
|
|
||||||
- image: circleci/node:14.15
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- *step-restore-cache
|
|
||||||
- run: yarn --frozen-lockfile
|
|
||||||
- run: npx @continuous-auth/circleci-oidc-github-auth@1.0.5
|
|
||||||
- run: npx semantic-release
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
test_and_release:
|
test_and_release:
|
||||||
jobs:
|
jobs:
|
||||||
- test
|
- test
|
||||||
- release:
|
- cfa/release:
|
||||||
requires:
|
requires:
|
||||||
- test
|
- test
|
||||||
filters:
|
filters:
|
||||||
|
|||||||
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* @electron/wg-ecosystem
|
||||||
26
.github/workflows/semantic.yml
vendored
Normal file
26
.github/workflows/semantic.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: "Check Semantic Commit"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- edited
|
||||||
|
- synchronize
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
main:
|
||||||
|
permissions:
|
||||||
|
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
|
||||||
|
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
|
||||||
|
name: Validate PR Title
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: semantic-pull-request
|
||||||
|
uses: amannn/action-semantic-pull-request@c3cd5d1ea3580753008872425915e343e351ab54 # v5.2.0
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
validateSingleCommit: false
|
||||||
4
.husky/pre-commit
Executable file
4
.husky/pre-commit
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
yarn lint-staged
|
||||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Contributors to the Electron project
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
> Create universal macOS Electron applications
|
> Create universal macOS Electron applications
|
||||||
|
|
||||||
[](https://circleci.com/gh/electron/universal)
|
[](https://circleci.com/gh/electron/universal)
|
||||||
|
[](https://npm.im/@electron/universal)
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|||||||
13
package.json
13
package.json
@@ -27,19 +27,19 @@
|
|||||||
"build": "tsc && tsc -p tsconfig.esm.json",
|
"build": "tsc && tsc -p tsconfig.esm.json",
|
||||||
"lint": "prettier --check \"src/**/*.ts\"",
|
"lint": "prettier --check \"src/**/*.ts\"",
|
||||||
"prepublishOnly": "npm run build",
|
"prepublishOnly": "npm run build",
|
||||||
"test": "exit 0"
|
"test": "exit 0",
|
||||||
|
"prepare": "husky install"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@continuous-auth/semantic-release-npm": "^2.0.0",
|
"@continuous-auth/semantic-release-npm": "^3.0.0",
|
||||||
"@types/debug": "^4.1.5",
|
"@types/debug": "^4.1.5",
|
||||||
"@types/fs-extra": "^9.0.4",
|
"@types/fs-extra": "^9.0.4",
|
||||||
"@types/minimatch": "^3.0.5",
|
"@types/minimatch": "^3.0.5",
|
||||||
"@types/node": "^14.14.7",
|
"@types/node": "^14.14.7",
|
||||||
"@types/plist": "^3.0.2",
|
"@types/plist": "^3.0.2",
|
||||||
"husky": "^4.3.0",
|
"husky": "^8.0.0",
|
||||||
"lint-staged": "^10.5.1",
|
"lint-staged": "^10.5.1",
|
||||||
"prettier": "^2.1.2",
|
"prettier": "^2.1.2",
|
||||||
"semantic-release": "^17.2.2",
|
|
||||||
"typescript": "^4.0.5"
|
"typescript": "^4.0.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -51,11 +51,6 @@
|
|||||||
"minimatch": "^3.0.4",
|
"minimatch": "^3.0.4",
|
||||||
"plist": "^3.0.4"
|
"plist": "^3.0.4"
|
||||||
},
|
},
|
||||||
"husky": {
|
|
||||||
"hooks": {
|
|
||||||
"pre-commit": "lint-staged"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.ts": [
|
"*.ts": [
|
||||||
"prettier --write"
|
"prettier --write"
|
||||||
|
|||||||
@@ -33,6 +33,12 @@ const MACHO_MAGIC = new Set([
|
|||||||
0xcffaedfe,
|
0xcffaedfe,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const MACHO_UNIVERSAL_MAGIC = new Set([
|
||||||
|
// universal
|
||||||
|
0xcafebabe,
|
||||||
|
0xbebafeca,
|
||||||
|
]);
|
||||||
|
|
||||||
export const detectAsarMode = async (appPath: string) => {
|
export const detectAsarMode = async (appPath: string) => {
|
||||||
d('checking asar mode of', appPath);
|
d('checking asar mode of', appPath);
|
||||||
const asarPath = path.resolve(appPath, 'Contents', 'Resources', 'app.asar');
|
const asarPath = path.resolve(appPath, 'Contents', 'Resources', 'app.asar');
|
||||||
@@ -147,6 +153,10 @@ export const mergeASARs = async ({
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MACHO_UNIVERSAL_MAGIC.has(x64Content.readUInt32LE(0)) && MACHO_UNIVERSAL_MAGIC.has(arm64Content.readUInt32LE(0))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!MACHO_MAGIC.has(x64Content.readUInt32LE(0))) {
|
if (!MACHO_MAGIC.has(x64Content.readUInt32LE(0))) {
|
||||||
throw new Error(`Can't reconcile two non-macho files ${file}`);
|
throw new Error(`Can't reconcile two non-macho files ${file}`);
|
||||||
}
|
}
|
||||||
|
|||||||
11
src/index.ts
11
src/index.ts
@@ -44,6 +44,10 @@ export type MakeUniversalOpts = {
|
|||||||
* Minimatch pattern of binaries that are expected to be the same x64 binary in both of the ASAR files.
|
* Minimatch pattern of binaries that are expected to be the same x64 binary in both of the ASAR files.
|
||||||
*/
|
*/
|
||||||
x64ArchFiles?: string;
|
x64ArchFiles?: string;
|
||||||
|
/**
|
||||||
|
* Minimatch pattern of paths that should not receive an injected ElectronAsarIntegrity value
|
||||||
|
*/
|
||||||
|
infoPlistsToIgnore?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const dupedFiles = (files: AppFile[]) =>
|
const dupedFiles = (files: AppFile[]) =>
|
||||||
@@ -321,7 +325,12 @@ export const makeUniversalApp = async (opts: MakeUniversalOpts): Promise<void> =
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const mergedPlist = { ...x64Plist, ElectronAsarIntegrity: generatedIntegrity };
|
const injectAsarIntegrity =
|
||||||
|
!opts.infoPlistsToIgnore ||
|
||||||
|
minimatch(plistFile.relativePath, opts.infoPlistsToIgnore, { matchBase: true });
|
||||||
|
const mergedPlist = injectAsarIntegrity
|
||||||
|
? { ...x64Plist, ElectronAsarIntegrity: generatedIntegrity }
|
||||||
|
: { ...x64Plist };
|
||||||
|
|
||||||
await fs.writeFile(path.resolve(tmpApp, plistFile.relativePath), plist.build(mergedPlist));
|
await fs.writeFile(path.resolve(tmpApp, plistFile.relativePath), plist.build(mergedPlist));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user