-
Notifications
You must be signed in to change notification settings - Fork 8
/
flyfile.js
59 lines (50 loc) · 1.35 KB
/
flyfile.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
const notifier = require('node-notifier')
export async function compile (fly) {
await fly.parallel(['bin', 'libs', 'components'])
}
export async function bin (fly, opts) {
await fly
.source(opts.src || 'bin/*')
.babel()
.target('dist/bin', { mode: '0755' })
notify('Compiled binaries')
}
export async function components (fly, opts) {
await fly
.source(opts.src || 'components/*')
.babel({ babelrc: true })
.target('dist/components')
notify('Compiled components')
}
export async function libs (fly, opts) {
await fly.source(opts.src || 'libs/**/*.js').babel().target('dist/libs')
notify('Compiled lib files')
}
export async function copy (fly) {
await fly
.source('pages/**/*.js')
.babel({ babelrc: true })
.target('dist/pages')
notify('Compiled page files and Copied package.json')
}
export async function build (fly) {
await fly.serial(['copy', 'compile'])
}
export default async function (fly) {
await fly.start('build')
await fly.watch('bin/*', 'bin')
await fly.watch('components/*', 'components')
await fly.watch('libs/**/*.js', ['libs'])
await fly.watch('pages/**/*.js', 'copy')
}
export async function release (fly) {
await fly.clear('dist').start('build')
}
// notification helper
function notify (msg) {
return notifier.notify({
title: 'Next-Book',
message: msg,
icon: false
})
}