Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
*.app
*.app
.idea
15 changes: 15 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.idea
node_modules
*.app
src
.idea
tsconfig.*
package-lock.json
yarn.lock
.gitignore
.npmignore
.prettierrc.json
.releaserc.json
.husky
.github
.circleci
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Forked from [@electron/universal](https://github.com/fellowapp/universal.git)

Electron universal but with this PR merged https://github.com/electron/universal/pull/66

# @electron/universal

> Create universal macOS Electron applications
Expand All @@ -17,6 +21,8 @@ await makeUniversalApp({
});
```

Note: There are more useful arguments in the type definitions file

## FAQ

#### The app is twice as big now, why?
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@electron/universal",
"version": "0.0.0-development",
"name": "@fellow/universal",
"version": "1.3.5",
"description": "Utility for creating Universal macOS applications from two x64 and arm64 Electron applications",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand All @@ -12,7 +12,7 @@
],
"repository": {
"type": "git",
"url": "https://github.com/electron/universal.git"
"url": "https://github.com/fellowapp/universal.git"
},
"engines": {
"node": ">=8.6"
Expand All @@ -22,7 +22,6 @@
"entry-asar/*",
"README.md"
],
"author": "Samuel Attard",
"scripts": {
"build": "tsc && tsc -p tsconfig.esm.json",
"lint": "prettier --check \"src/**/*.ts\"",
Expand Down
15 changes: 13 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const makeUniversalApp = async (opts: MakeUniversalOpts): Promise<void> =
);
}
}

const knownMergedMachOFiles = new Set();
for (const machOFile of x64Files.filter((f) => f.type === AppFileType.MACHO)) {
const first = await fs.realpath(path.resolve(tmpApp, machOFile.relativePath));
const second = await fs.realpath(path.resolve(opts.arm64AppPath, machOFile.relativePath));
Expand Down Expand Up @@ -167,6 +167,7 @@ export const makeUniversalApp = async (opts: MakeUniversalOpts): Promise<void> =
'-output',
await fs.realpath(path.resolve(tmpApp, machOFile.relativePath)),
]);
knownMergedMachOFiles.add(machOFile.relativePath);
}

/**
Expand All @@ -182,8 +183,18 @@ export const makeUniversalApp = async (opts: MakeUniversalOpts): Promise<void> =
path.resolve(opts.arm64AppPath, 'Contents', 'Resources', 'app'),
{ compareSize: true, compareContent: true },
);
const differences = comparison.diffSet!.filter((difference) => difference.state !== 'equal');
d(`Found ${differences.length} difference(s) between the x64 and arm64 folders`);
const nonMergedDifferences = differences.filter(
(difference) =>
!difference.name1 ||
!knownMergedMachOFiles.has(
path.join('Contents', 'Resources', 'app', difference.relativePath, difference.name1),
),
);
d(`After discluding MachO files merged with lipo ${nonMergedDifferences.length} remain.`);

if (!comparison.same) {
if (nonMergedDifferences.length > 0) {
d('x64 and arm64 app folders are different, creating dynamic entry ASAR');
await fs.move(
path.resolve(tmpApp, 'Contents', 'Resources', 'app'),
Expand Down