Skip to content

Commit

Permalink
builds working for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
Galkon committed Nov 13, 2023
1 parent 902b47d commit a43fcc0
Show file tree
Hide file tree
Showing 11 changed files with 504 additions and 15 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ on:

jobs:
build-and-package:
runs-on: windows-latest # Use a Windows runner to build the .exe
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]

steps:
- name: Check out code
Expand All @@ -23,10 +26,7 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Build app
run: pnpm run build

- name: Package app
- name: Build and package app
run: pnpm run dist
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist/
rollup/
node_modules/
.idea/
.DS_Store
Expand Down
Binary file modified build/icon.icns
Binary file not shown.
Binary file modified build/icon.ico
Binary file not shown.
15 changes: 10 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const path = require('path')
const http = require('http')
const fs = require('fs-extra')

const isDevelopment = process.env.NODE_ENV === 'development'

function pollServer(url) {
return new Promise(resolve => {
const request = http.get(url, () => {
Expand Down Expand Up @@ -30,17 +32,20 @@ const createWindow = async () => {
minWidth: 700,
minHeight: 400,
backgroundColor: '#000',
icon: path.resolve(path.join(__dirname, 'build', 'icon.png')),
webPreferences: {
preload: path.join(__dirname, 'preload.js')
contextIsolation: true,
sandbox: false,
preload: isDevelopment
? path.resolve('src/main/preload.js')
: path.join(__dirname, 'preload.js')
}
})
const startUrl =
process.env.NODE_ENV === 'development'
isDevelopment
? 'http://localhost:8080' // URL where webpack-dev-server runs
: `file://${path.join(__dirname, 'dist/index.html')}`;
: `file://${path.join(__dirname, 'index.html')}`;

if (process.env.NODE_ENV === 'development') {
if (isDevelopment) {
await pollServer(startUrl); // Wait for server to be ready
}

Expand Down
29 changes: 28 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,29 @@
"start": "electron .",
"dev": "concurrently \"cross-env NODE_ENV=development webpack serve --mode development\" \"cross-env NODE_ENV=development electron .\"",
"build": "webpack --mode production",
"build:all": "pnpm run build:main && pnpm run build:renderer",
"build:main": "rollup -c rollup.main.config.mjs",
"build:renderer": "rollup -c rollup.renderer.config.mjs",
"pack": "electron-builder --dir",
"dist": "electron-builder"
"dist": "pnpm run build:all && electron-builder"
},
"build": {
"appId": "com.pokepocket.save.recovery",
"asar": false,
"files": [
"package.json",
{
"from": "rollup/",
"to": "./",
"filter": ["**/*"]
}
],
"extraResources": [
{
"from": "src/main/preload.js",
"to": "app/preload.js"
}
],
"win": {
"target": "nsis"
},
Expand All @@ -32,6 +50,10 @@
"@babel/core": "^7.23.3",
"@babel/preset-env": "^7.23.3",
"@babel/preset-react": "^7.23.3",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"babel-loader": "^9.1.3",
"concurrently": "^8.2.2",
"copy-webpack-plugin": "^11.0.0",
Expand All @@ -40,6 +62,11 @@
"electron": "^27.0.4",
"electron-builder": "^24.6.4",
"html-webpack-plugin": "^5.5.3",
"rollup": "^4.4.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-terser": "^7.0.2",
"style-loader": "^3.3.3",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
Expand Down
Loading

0 comments on commit a43fcc0

Please sign in to comment.