Skip to content

Commit

Permalink
feat: export DMG
Browse files Browse the repository at this point in the history
  • Loading branch information
hrenaud committed Jul 21, 2024
1 parent fd9949b commit 3441ddd
Show file tree
Hide file tree
Showing 6 changed files with 16,040 additions and 15,322 deletions.
47 changes: 28 additions & 19 deletions electron-app/ecoindex-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,34 @@

## Informations

- ElectronJS / Electron Forge with `template=webpack-typescript`
- React
- TailwindCSS
- ElectronJS / Electron Forge with `template=webpack-typescript`
- React
- TailwindCSS

## TODO

- [ ] Set icon
- [ ] Build on other OS
- [ ] Auto build with CI/CD
- [ ] Translate
- [x] Create simple mesure
- [ ] Use path /usr/bin and /usr/bin/which to launch node `/usr/bin/which node` and npm `/usr/bin/which npm` action
- [x] Fix not showing buttons to install plugin
- [ ] handler for install plugin
- [ ] Fix not showing buttons to install Node
- [ ] handler for install Node
- [x] Create complex mesure
- [x] Save JSON on disk
- [x] Fix extra-header not JSON
- [x] Read/Reload JSON from disk (doing)
- [x] Use JSON to display data
- [x] Launch mesure from JSON (save before)
- [ ] Set icon
- [ ] Build on other OS
- [ ] Auto build with CI/CD
- [ ] Translate
- [x] Create simple mesure
- [ ] ~~Use path /usr/bin and /usr/bin/which to launch node `/usr/bin/which node` and npm `/usr/bin/which npm` action~~
- [x] Fix not showing buttons to install plugin
- [x] handler for install plugin
- [ ] Fix not showing buttons to install Node
- [ ] handler for install Node
- [x] Create complex mesure
- [x] Save JSON on disk
- [x] Fix extra-header not JSON
- [x] Read/Reload JSON from disk (doing)
- [x] Use JSON to display data
- [x] Launch mesure from JSON (save before)

# Help links

- https://github.com/electron/forge/issues/3558#issuecomment-2163993613
- https://www.electronforge.io/guides/code-signing/code-signing-macos
- https://support.apple.com/en-us/102654
- https://help.apple.com/xcode/mac/current/#/dev3a05256b8
- https://felixrieseberg.com/codesigning-electron-apps-in-ci/
- https://github.com/electron/osx-sign
20 changes: 20 additions & 0 deletions electron-app/ecoindex-app/assets/default.darwin.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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.device.audio-input</key>
<true/>
<key>com.apple.security.device.bluetooth</key>
<true/>
<key>com.apple.security.device.camera</key>
<true/>
<key>com.apple.security.device.print</key>
<true/>
<key>com.apple.security.device.usb</key>
<true/>
<key>com.apple.security.personal-information.location</key>
<true/>
</dict>
</plist>
161 changes: 107 additions & 54 deletions electron-app/ecoindex-app/forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,119 @@ import { FuseV1Options, FuseVersion } from '@electron/fuses'
import { AutoUnpackNativesPlugin } from '@electron-forge/plugin-auto-unpack-natives'
import type { ForgeConfig } from '@electron-forge/shared-types'
import { FusesPlugin } from '@electron-forge/plugin-fuses'
import { MakerDeb } from '@electron-forge/maker-deb'
import { MakerRpm } from '@electron-forge/maker-rpm'
import { MakerSquirrel } from '@electron-forge/maker-squirrel'
import { MakerZIP } from '@electron-forge/maker-zip'
import { WebpackPlugin } from '@electron-forge/plugin-webpack'
import { mainConfig } from './webpack.main.config'
import { rendererConfig } from './webpack.renderer.config'

const config: ForgeConfig = {
packagerConfig: {
executableName:
process.platform === 'linux'
? 'ecoindex-lighthouse'
: 'EcoindexLighthouse',
appBundleId: 'io.greenit.ecoindex-ligthouse',
appCategoryType: 'public.app-category.developer-tools',
appCopyright: 'Copyright 2024-2030 Green IT',
asar: true,
icon: path.resolve(__dirname, 'assets', 'app-ico'),
extraResource: ['./src/extraResources/scripts'],
},
rebuildConfig: {},
makers: [
new MakerSquirrel({}),
new MakerZIP({}, ['darwin']),
new MakerRpm({}),
new MakerDeb({}),
],
plugins: [
new AutoUnpackNativesPlugin({}),
new WebpackPlugin({
mainConfig,
renderer: {
config: rendererConfig,
entryPoints: [
{
// html: './src/renderer/index.html',
html: './src/renderer/index.html',
// js: './src/renderer/renderer.ts',
js: './src/renderer/renderer.ts',
name: 'main_window',
preload: {
js: './src/main/preload.ts',
packagerConfig: {
executableName:
process.platform === 'linux'
? 'ecoindex-lighthouse'
: 'EcoindexLighthouse',
appBundleId: 'io.greenit.ecoindex-ligthouse',
appCategoryType: 'public.app-category.developer-tools',
appCopyright: 'Copyright 2024-2030 Green IT',
asar: true,
icon: path.resolve(__dirname, 'assets', 'app-ico'),
extraResource: ['./src/extraResources/scripts'],
osxSign: {
// optionsForFile: (filePath) => {
// // Here, we keep it simple and return a single entitlements.plist file.
// // You can use this callback to map different sets of entitlements
// // to specific files in your packaged app.
// return {
// entitlements: './assets/default.darwin.plist',
// }
// },
},
osxNotarize: {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
appleId: process.env.APPLE_ID,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
appleIdPassword: process.env.APPLE_PASSWORD,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
teamId: process.env.APPLE_TEAM_ID,
},
},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-rpm',
config: {},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
config: {},
},
{
name: '@electron-forge/maker-dmg',
platforms: ['darwin'],
config: {
// background: './assets/dmg-background.png',
format: 'ULFO',
},
},
],
},
}),
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
},
{
name: '@electron-forge/maker-wix',
config: {
language: 1033,
manufacturer: 'Green IT',
},
},
{
name: '@electron-forge/maker-squirrel',
config: {
// certificateFile: './cert.pfx',
// certificatePassword: process.env.CERTIFICATE_PASSWORD,
},
},
{
name: '@electron-forge/maker-deb',
config: {
options: {
maintainer: 'Renaud Héluin',
homepage: 'https://asso.greenit.fr',
},
},
},
],
plugins: [
new AutoUnpackNativesPlugin({}),
new WebpackPlugin({
mainConfig,
renderer: {
config: rendererConfig,
entryPoints: [
{
// html: './src/renderer/index.html',
html: './src/renderer/index.html',
// js: './src/renderer/renderer.ts',
js: './src/renderer/renderer.ts',
name: 'main_window',
preload: {
js: './src/main/preload.ts',
},
},
],
},
}),
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
}

export default config
Loading

0 comments on commit 3441ddd

Please sign in to comment.