Skip to content

Commit

Permalink
feat: v4 version
Browse files Browse the repository at this point in the history
  • Loading branch information
nchanged committed Aug 6, 2019
1 parent a16db06 commit 5e3325a
Show file tree
Hide file tree
Showing 32 changed files with 7,684 additions and 4,259 deletions.
Binary file added .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ jspm_packages


app/
release/
.cache
release/
53 changes: 8 additions & 45 deletions README.md
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
117 changes: 0 additions & 117 deletions fuse.js

This file was deleted.

73 changes: 73 additions & 0 deletions fuse.ts
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)
});
});
Loading

0 comments on commit 5e3325a

Please sign in to comment.