summaryrefslogtreecommitdiffstats
path: root/ui/fuse.js
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2019-03-20 18:22:31 -0700
committerDessalines <tyhou13@gmx.com>2019-03-20 18:22:31 -0700
commit816aa0b15f3766e340d8722f03e8b3a7633ab6fb (patch)
tree23dd0fc329e8f08c71dc6f10dd398b35d92c047c /ui/fuse.js
parent064d7f84b25236195eeb33a8671935bc9df37e57 (diff)
Adding initial UI and Websocket server.
Diffstat (limited to 'ui/fuse.js')
-rw-r--r--ui/fuse.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/ui/fuse.js b/ui/fuse.js
new file mode 100644
index 00000000..ff1e6d15
--- /dev/null
+++ b/ui/fuse.js
@@ -0,0 +1,55 @@
+const {
+ FuseBox,
+ Sparky,
+ EnvPlugin,
+ CSSPlugin,
+ WebIndexPlugin,
+ QuantumPlugin
+} = require('fuse-box');
+// const transformInferno = require('../../dist').default
+const transformInferno = require('ts-transform-inferno').default;
+const transformClasscat = require('ts-transform-classcat').default;
+let fuse, app;
+let isProduction = false;
+
+Sparky.task('config', _ => {
+ fuse = new FuseBox({
+ homeDir: 'src',
+ hash: isProduction,
+ output: 'dist/$name.js',
+ experimentalFeatures: true,
+ cache: !isProduction,
+ sourceMaps: !isProduction,
+ transformers: {
+ before: [transformClasscat(), transformInferno()],
+ },
+ plugins: [
+ EnvPlugin({ NODE_ENV: isProduction ? 'production' : 'development' }),
+ CSSPlugin(),
+ WebIndexPlugin({
+ title: 'Inferno Typescript FuseBox Example',
+ template: 'src/index.html',
+ path: isProduction ? "/static" : "/"
+ }),
+ isProduction &&
+ QuantumPlugin({
+ bakeApiIntoBundle: 'app',
+ treeshake: true,
+ uglify: true,
+ }),
+ ],
+ });
+ app = fuse.bundle('app').instructions('>index.tsx');
+});
+Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'));
+Sparky.task('env', _ => (isProduction = true));
+Sparky.task('copy-assets', () => Sparky.src('assets/*.ico').dest('dist/'));
+Sparky.task('dev', ['clean', 'config', 'copy-assets'], _ => {
+ fuse.dev();
+ app.hmr().watch();
+ return fuse.run();
+});
+Sparky.task('prod', ['clean', 'env', 'config', 'copy-assets'], _ => {
+ // fuse.dev({ reload: true }); // remove after demo
+ return fuse.run();
+});