feat: electron build for mac

This commit is contained in:
Anoop M D 2022-10-17 21:04:05 +05:30
parent 075e9162c2
commit c258bc1590
23 changed files with 73 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
assets/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -16,6 +16,7 @@
"dev:web": "npm run dev --workspace=packages/bruno-app",
"build:web": "npm run build --workspace=packages/bruno-app",
"dev:electron": "npm run dev --workspace=packages/bruno-electron",
"build:chrome-extension": "./scripts/create-chrome-extension.sh"
"build:chrome-extension": "./scripts/build-chrome-extension.sh",
"build:electron": "./scripts/build-electron.sh"
}
}

3
packages/bruno-electron/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
node_modules
web
out

View File

@ -1 +0,0 @@
{"type": "commonjs"}

View File

@ -0,0 +1,24 @@
appId: com.usebruno.app
productName: Bruno
electronVersion: 21.1.1
directories:
buildResources: resources
output: out
files:
- "**/*"
mac:
artifactName: ${name}_${version}_${arch}_${os}.${ext}
category: public.app-category.developer-tools
target:
- target: dmg
arch:
- x64
- arm64
- target: zip
arch:
- x64
- arm64
icon: resources/icons/mac/icon.icns
hardenedRuntime: true
entitlements: resources/entitlements.mac.plist
entitlementsInherit: resources/entitlements.mac.plist

View File

@ -1,24 +1,20 @@
{
"name": "@usebruno/bruno-electron",
"version": "0.1.0",
"name": "bruno",
"description": "Opensource API Client",
"private": true,
"main": "src/index.js",
"author": "Anoop M D <anoop.md1421@gmail.com> (https://helloanoop.com/)",
"scripts": {
"clean": "rimraf dist",
"dev": "electron .",
"build": "next build renderer && next export renderer",
"pack-app": "npm run build && electron-builder --dir",
"dist": "npm run build && electron-builder"
},
"build": {
"asar": true,
"files": [
"main",
"renderer/out"
]
"dist": "electron-builder",
"pack-app": "electron-builder --dir"
},
"dependencies": {
"axios": "^0.26.0",
"chokidar": "^3.5.3",
"dmg-license": "^1.0.11",
"electron-is-dev": "^2.0.0",
"electron-store": "^8.1.0",
"electron-util": "^0.17.2",
@ -29,7 +25,8 @@
"nanoid": "3.3.4"
},
"devDependencies": {
"electron": "^17.1.0",
"electron-builder": "^22.14.13"
"electron": "^21.1.1",
"electron-builder": "23.0.2",
"electron-icon-maker": "^0.0.5"
}
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
</dict>
</plist>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 795 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 KiB

View File

@ -1,6 +1,5 @@
const fs = require('fs');
const path = require('path');
const yaml = require('js-yaml');
const chokidar = require('chokidar');
const { hasJsonExtension } = require('../utils/filesystem');

View File

@ -18,7 +18,7 @@ setContentSecurityPolicy(`
connect-src * 'unsafe-inline';
base-uri 'none';
form-action 'none';
frame-ancestors 'none';
frame-ancestors ghbtns.com;
`);
const menu = Menu.buildFromTemplate(menuTemplate);
@ -42,7 +42,7 @@ app.on('ready', async () => {
const url = isDev
? 'http://localhost:3000'
: format({
pathname: path.join(__dirname, '../packages/bruno-app/out/index.html'),
pathname: path.join(__dirname, '../web/index.html'),
protocol: 'file:',
slashes: true
});

22
scripts/build-electron.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
# Remove out directory
rm -rf packages/bruno-electron/out
# Remove web directory
rm -rf packages/bruno-electron/web
# Create a new web directory
mkdir packages/bruno-electron/web
# Copy build
cp -r packages/bruno-app/out/* packages/bruno-electron/web
# Change paths in next
sed -i'' -e 's@/_next/@_next/@g' packages/bruno-electron/web/**.html
# Remove sourcemaps
find packages/bruno-electron/web -name '*.map' -type f -delete
npm run pack-app --workspace=packages/bruno-electron