]> Untitled Git - lemmy.git/blob - ui/fuse.js
Adding Favicon.
[lemmy.git] / ui / fuse.js
1 const {
2   FuseBox,
3   Sparky,
4   EnvPlugin,
5   CSSPlugin,
6   WebIndexPlugin,
7   QuantumPlugin
8 } = require('fuse-box');
9 // const transformInferno = require('../../dist').default
10 const transformInferno = require('ts-transform-inferno').default;
11 const transformClasscat = require('ts-transform-classcat').default;
12 let fuse, app;
13 let isProduction = false;
14
15 Sparky.task('config', _ => {
16   fuse = new FuseBox({
17     homeDir: 'src',
18     hash: isProduction,
19     output: 'dist/$name.js',
20     experimentalFeatures: true,
21     cache: !isProduction,
22     sourceMaps: !isProduction,
23     transformers: {
24       before: [transformClasscat(), transformInferno()],
25     },
26     plugins: [
27       EnvPlugin({ NODE_ENV: isProduction ? 'production' : 'development' }),
28       CSSPlugin(),
29       WebIndexPlugin({
30         title: 'Inferno Typescript FuseBox Example',
31         template: 'src/index.html',
32         path: isProduction ? "/static" : "/"
33       }),
34       isProduction &&
35       QuantumPlugin({
36         bakeApiIntoBundle: 'app',
37         treeshake: true,
38         uglify: true,
39       }),
40     ],
41   });
42   app = fuse.bundle('app').instructions('>index.tsx');
43 });
44 Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'));
45 Sparky.task('env', _ => (isProduction = true));
46 Sparky.task('copy-assets', () => Sparky.src('assets/*.svg').dest('dist/'));
47 Sparky.task('dev', ['clean', 'config', 'copy-assets'], _ => {
48   fuse.dev();
49   app.hmr().watch();
50   return fuse.run();
51 });
52 Sparky.task('prod', ['clean', 'env', 'config', 'copy-assets'], _ => {
53   // fuse.dev({ reload: true }); // remove after demo
54   return fuse.run();
55 });