Skip to content

Commit

Permalink
support for linux, support for building all on linux (#35)
Browse files Browse the repository at this point in the history
* support for linux, support for building all on linux

changes summary:
* better platform recognition for all 3 platforms
* add sample circleci which builds and pushes artifacts for all 3 platforms
* build command tries to build for all 3 platforms (if a platform is unsupported, it just doesn't build it)

* syntax error

* ci fix

* ci tune

* undo circle ci

* Update package.json

* Simplify getPlatformDetails

---------

Co-authored-by: Noisekit <[email protected]>
  • Loading branch information
dbeal-eth and noisekit authored Mar 11, 2024
1 parent ebce230 commit 63bd072
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
Binary file modified assets/icon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"pretty:check": "prettier --check . './**/*.svg'",
"svg": "svgo --recursive . && prettier --write './**/*.svg'",
"svg:check": "npm run svg && git diff --exit-code **/*.svg",
"package": "ts-node ./.erb/scripts/clean.js dist && npm run build && CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder build --publish never",
"package": "ts-node ./.erb/scripts/clean.js dist && npm run build && CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder build --publish never -ml",
"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app",
"start": "ts-node ./.erb/scripts/check-port-in-use.js && npm run start:renderer",
"start:main": "cross-env NODE_ENV=development electronmon -r ts-node/register/transpile-only .",
Expand Down
34 changes: 29 additions & 5 deletions src/main/util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { URL } from 'url';
import path from 'path';
import os from 'os';

export function resolveHtmlPath(htmlFileName: string) {
if (process.env.NODE_ENV === 'development') {
Expand All @@ -13,9 +12,34 @@ export function resolveHtmlPath(htmlFileName: string) {
}

export function getPlatformDetails() {
const arch = os.arch();
const targetArch = arch === 'x64' ? 'amd64' : 'arm64';
const osPlatform = process.platform === 'darwin' ? 'darwin' : 'windows';
const fileExt = osPlatform === 'darwin' ? 'tar.gz' : 'zip';
const targetArch = (() => {
switch (process.arch) {
case 'x64':
return 'amd64';
case 'arm64':
default:
return process.arch;
}
})();
const osPlatform = (() => {
switch (process.platform) {
case 'win32':
return 'windows';
case 'darwin':
case 'linux':
default:
return process.platform;
}
})();
const fileExt = (() => {
switch (process.platform) {
case 'win32':
return 'zip';
case 'darwin':
case 'linux':
default:
return 'tar.gz';
}
})();
return { osPlatform, fileExt, targetArch };
}

0 comments on commit 63bd072

Please sign in to comment.