-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuse.js
130 lines (129 loc) · 3.88 KB
/
fuse.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
const { RawPlugin,FuseBox, HTMLPlugin,CSSPlugin, EnvPlugin, TerserPlugin, WebIndexPlugin } = require("fuse-box");
const { src, task } = require("fuse-box/sparky");
var TypeHelper = require('fuse-box-typechecker').TypeHelper
var autoLoadAureliaLoaders =function() {
class loader {
constructor() { }
init(context) { }
bundleEnd(context) {
context.source.addContent(`FuseBox.import("fuse-box-aurelia-loader")`);
context.source.addContent(`FuseBox.import("aurelia-bootstrapper")`);
// context.source.addContent(`FuseBox.import("socket-io-client")`);
}
}
return new loader();
}
task('typechecker', () => {
var testWatch = TypeHelper({
tsConfig: './tsconfig.json',
name: 'Seed',
basePath: './',
tsLint: './tslint.json',
shortenFilenames: true,
yellowOnLint: true,
})
testWatch.runWatch('./src')
return true;
});
let run = (production) => {
let env = {
FB_AU_LOG: !production,
devMode: !production
}
const fuse = FuseBox.init({
homeDir: 'src',
output: 'dist/$name.js',
target:"browser@es6",
runAllMatchedPlugins: true,
plugins: [
autoLoadAureliaLoaders(),
production && TerserPlugin(),
CSSPlugin(),
EnvPlugin(env),
HTMLPlugin(),
RawPlugin(['.css', '.woff','.png']),
WebIndexPlugin({template:'./index.html'})
]
});
fuse.register('aurelia-semantic-ui', {
homeDir: 'node_modules/aurelia-semantic-ui/dist/commonjs',
main: 'index.js',
// TODO: Nead a fix here to reduce bundle size
instructions: `**/*.{html,css}`
});
fuse.register('semantic-ui', {
homeDir: 'semantic/dist',
main: 'semantic.min.js',
instructions: '*.dummy'
});
fuse.register('jquery-nicescroll', {
homeDir: 'node_modules/jquery.nicescroll/dist',
main: 'jquery.nicescroll.min.js',
instructions: '+zoomico.png'
});
fuse.register('socket-io-client', {
homeDir: 'node_modules/socket.io-client/dist',
main: 'socket.io.js',
instructions: '*.dummy'
});
fuse.bundle("vendor")
.cache(true)
.instructions(`
+ @feathersjs/feathers
+ @feathersjs/socketio-client
+ @feathersjs/authentication-client
+ fuse-box-css
+ i18next-xhr-backend
+ aurelia-bootstrapper
+ fuse-box-aurelia-loader
+ aurelia-framework
+ aurelia-i18n
+ aurelia-pal-browser
+ aurelia-logging-console
+ aurelia-templating-binding
+ aurelia-templating-resources
+ aurelia-event-aggregator
+ aurelia-history-browser
+ aurelia-templating-router
+ aurelia-semantic-ui
+ semantic-ui
+ socket-io-client
+ jquery-nicescroll`)
.alias({
'jQuery': 'jquery'
})
.shim({
jquery: {
source: 'node_modules/jquery/dist/jquery.js',
exports: '$'
}
});
if (!production) {
fuse.bundle('app')
.watch().hmr({reload : true})
.instructions(`
> [main.ts]
+ [**/*.{ts,html,css}]
`);
fuse.dev();
} else {
fuse.bundle('app')
//.watch().hmr({reload : true})
.instructions(`
> [main.ts]
+ [**/*.{ts,html,css}]
`);
//fuse.dev();
}
fuse.run();
};
task('clean', async () => await src('dist/*').clean('dist').exec());
task('copy', async () => {
await src('./favicon.ico').dest('./dist').exec();
await src('./semantic/**').dest('./dist').exec();
await src('./static/**').dest('./dist').exec();
});
task("dev", ['clean','copy'
//, 'typechecker'
], () => run(false));
task("prod", ['clean','copy'], () => run(true));