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