-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
7,684 additions
and
4,259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,4 +43,5 @@ jspm_packages | |
|
||
|
||
app/ | ||
release/ | ||
.cache | ||
release/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,17 @@ | ||
# fuse-box-electron-seed | ||
# Electron seed | ||
|
||
This version works with `FuseBox 2.2.31` `Electron 1.7.5` | ||
Here is an example how to configure Electron application with FuseBox `v4` | ||
|
||
What's inside: | ||
Read the documentation [here](https://github.com/fuse-box/fuse-box/blob/v4/docs/electron.md) | ||
|
||
* FuseBox respects electron environment without shimming | ||
* Typescript in renderer and main process | ||
* HMR for renderer without pain | ||
* Livereload of main process | ||
* Sass (grouping into 1 file) | ||
* Base build process with electron-builder | ||
* Auto saving app boudries (x, y width, height) with electron-settings | ||
|
||
|
||
## Usage | ||
|
||
### Run development version | ||
To launch the application in development mode; | ||
|
||
``` | ||
npm install | ||
npm start | ||
```bash | ||
npm run | ||
``` | ||
|
||
### Build production version of renderer and main process | ||
build with QuantumPlugin | ||
To launch the application in production mode | ||
|
||
``` | ||
```bash | ||
npm run dist | ||
``` | ||
|
||
### Build and show production version | ||
|
||
``` | ||
npm run prod | ||
``` | ||
|
||
### Package app with electron-packager | ||
tested on MacOS, linux Ubuntu, Windows 7 | ||
``` | ||
npm run package | ||
``` | ||
|
||
### Package and publish to github app with electron-packager | ||
|
||
``` | ||
export GH_TOKEN=YOUR_TOKEN && npm run pack-and-publish | ||
``` | ||
more info: [here](https://www.electron.build/publishing-artifacts) | ||
|
||
## TODO | ||
|
||
* add some UI framework/s | ||
* add test examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { fusebox, sparky } from "fuse-box"; | ||
|
||
class Context { | ||
isProduction; | ||
runServer; | ||
getMainConfig() { | ||
return fusebox({ | ||
output: "dist/main/$name-$hash", | ||
target: "electron", | ||
homeDir: "src/main", | ||
entry: "main.ts", | ||
useSingleBundle: true, | ||
dependencies: { ignoreAllExternal: true }, | ||
logging: { level: "succinct" }, | ||
cache: { | ||
enabled: true, | ||
root: ".cache/main" | ||
} | ||
}); | ||
} | ||
launch(handler) { | ||
handler.onComplete(output => { | ||
output.electron.handleMainProcess(); | ||
}); | ||
} | ||
getRendererConfig() { | ||
return fusebox({ | ||
output: "dist/renderer/$name-$hash", | ||
target: "electron", | ||
homeDir: "src/renderer", | ||
entry: "index.ts", | ||
dependencies: { include: ["tslib"] }, | ||
logging: { level: "succinct" }, | ||
webIndex: { | ||
publicPath: "./", | ||
template: "src/renderer/index.html" | ||
}, | ||
cache: { | ||
enabled: false, | ||
root: ".cache/renderere" | ||
}, | ||
devServer: { | ||
httpServer: false, | ||
hmrServer: { port: 7878 } | ||
} | ||
}); | ||
} | ||
} | ||
const { task, rm } = sparky<Context>(Context); | ||
|
||
task("default", async ctx => { | ||
await rm("./dist"); | ||
|
||
const rendererConfig = ctx.getRendererConfig(); | ||
await rendererConfig.runDev(); | ||
|
||
const electronMain = ctx.getMainConfig(); | ||
await electronMain.runDev(handler => ctx.launch(handler)); | ||
}); | ||
|
||
task("dist", async ctx => { | ||
await rm("./dist"); | ||
|
||
const rendererConfig = ctx.getRendererConfig(); | ||
await rendererConfig.runProd({ uglify: false }); | ||
|
||
const electronMain = ctx.getMainConfig(); | ||
await electronMain.runProd({ | ||
uglify: true, | ||
manifest: true, | ||
handler: handler => ctx.launch(handler) | ||
}); | ||
}); |
Oops, something went wrong.