]> Untitled Git - lemmy.git/blob - ui/fuse.js
Still not working
[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     alias: {
28       'react': 'inferno-compat',
29       'react-dom': 'inferno-compat',
30       'react-redux': 'inferno-compat',
31                 },
32     plugins: [
33       EnvPlugin({ NODE_ENV: isProduction ? 'production' : 'development' }),
34       CSSPlugin(),
35       WebIndexPlugin({
36         title: 'Inferno Typescript FuseBox Example',
37         template: 'src/index.html',
38         path: isProduction ? "/static" : "/"
39       }),
40       isProduction &&
41       QuantumPlugin({
42         bakeApiIntoBundle: 'app',
43         treeshake: true,
44         uglify: true,
45       }),
46     ],
47   });
48   app = fuse.bundle('app').instructions('>index.tsx');
49 });
50 // Sparky.task('version', _ => setVersion());
51 Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'));
52 Sparky.task('env', _ => (isProduction = true));
53 Sparky.task('copy-assets', () => Sparky.src('assets/**/**.*').dest('dist/'));
54 Sparky.task('dev', ['clean', 'config', 'copy-assets'], _ => {
55   fuse.dev();
56   app.hmr().watch();
57   return fuse.run();
58 });
59 Sparky.task('prod', ['clean', 'env', 'config', 'copy-assets'], _ => {
60   // fuse.dev({ reload: true }); // remove after demo
61   return fuse.run();
62 });