]> Untitled Git - lemmy.git/blob - ui/fuse.js
Adding emoji support
[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 // var setVersion = require('./set_version.js').setVersion;
15
16 Sparky.task('config', _ => {
17   fuse = new FuseBox({
18     homeDir: 'src',
19     hash: isProduction,
20     output: 'dist/$name.js',
21     experimentalFeatures: true,
22     cache: !isProduction,
23     sourceMaps: !isProduction,
24     transformers: {
25       before: [transformClasscat(), transformInferno()],
26     },
27     plugins: [
28       EnvPlugin({ NODE_ENV: isProduction ? 'production' : 'development' }),
29       CSSPlugin(),
30       WebIndexPlugin({
31         title: 'Inferno Typescript FuseBox Example',
32         template: 'src/index.html',
33         path: isProduction ? "/static" : "/"
34       }),
35       isProduction &&
36       QuantumPlugin({
37         bakeApiIntoBundle: 'app',
38         treeshake: true,
39         uglify: true,
40       }),
41     ],
42   });
43   app = fuse.bundle('app').instructions('>index.tsx');
44 });
45 // Sparky.task('version', _ => setVersion());
46 Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'));
47 Sparky.task('env', _ => (isProduction = true));
48 Sparky.task('copy-assets', () => Sparky.src('assets/**/**.*').dest('dist/'));
49 Sparky.task('dev', ['clean', 'config', 'copy-assets'], _ => {
50   fuse.dev();
51   app.hmr().watch();
52   return fuse.run();
53 });
54 Sparky.task('prod', ['clean', 'env', 'config', 'copy-assets'], _ => {
55   // fuse.dev({ reload: true }); // remove after demo
56   return fuse.run();
57 });