2018-09-30 23:02:10 +00:00
|
|
|
const notifier = require('node-notifier')
|
|
|
|
|
|
|
|
export async function compile (task) {
|
2018-10-02 22:08:57 +00:00
|
|
|
await task.parallel(['bin', 'server', 'nextbuild', 'nextbuildstatic', 'pages', 'lib', 'client'])
|
2018-09-30 23:02:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export async function bin (task, opts) {
|
2018-11-28 14:03:02 +00:00
|
|
|
await task.source(opts.src || 'bin/*').typescript({module: 'commonjs'}).target('dist/bin', {mode: '0755'})
|
2018-09-30 23:02:10 +00:00
|
|
|
notify('Compiled binaries')
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function lib (task, opts) {
|
2018-11-28 14:03:02 +00:00
|
|
|
await task.source(opts.src || 'lib/**/*.js').typescript({module: 'commonjs'}).target('dist/lib')
|
2018-09-30 23:02:10 +00:00
|
|
|
notify('Compiled lib files')
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function server (task, opts) {
|
2018-11-28 14:03:02 +00:00
|
|
|
await task.source(opts.src || 'server/**/*.js').typescript({module: 'commonjs'}).target('dist/server')
|
2018-09-30 23:02:10 +00:00
|
|
|
notify('Compiled server files')
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function nextbuild (task, opts) {
|
2018-11-28 14:03:02 +00:00
|
|
|
await task.source(opts.src || 'build/**/*.js').typescript({module: 'commonjs'}).target('dist/build')
|
2018-09-30 23:02:10 +00:00
|
|
|
notify('Compiled build files')
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function client (task, opts) {
|
2018-11-28 14:03:02 +00:00
|
|
|
await task.source(opts.src || 'client/**/*.js').typescript().target('dist/client')
|
2018-09-30 23:02:10 +00:00
|
|
|
notify('Compiled client files')
|
|
|
|
}
|
|
|
|
|
|
|
|
// export is a reserved keyword for functions
|
|
|
|
export async function nextbuildstatic (task, opts) {
|
2018-11-28 14:03:02 +00:00
|
|
|
await task.source(opts.src || 'export/**/*.js').typescript({module: 'commonjs'}).target('dist/export')
|
2018-09-30 23:02:10 +00:00
|
|
|
notify('Compiled export files')
|
|
|
|
}
|
|
|
|
|
2018-10-02 22:08:57 +00:00
|
|
|
export async function pages (task, opts) {
|
2018-11-28 14:03:02 +00:00
|
|
|
await task.source(opts.src || 'pages/**/*.js').typescript().target('dist/pages')
|
2018-09-30 23:02:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export async function build (task) {
|
2018-10-02 22:08:57 +00:00
|
|
|
await task.serial(['compile'])
|
2018-09-30 23:02:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default async function (task) {
|
|
|
|
await task.start('build')
|
|
|
|
await task.watch('bin/*', 'bin')
|
2018-10-02 22:08:57 +00:00
|
|
|
await task.watch('pages/**/*.js', 'pages')
|
2018-09-30 23:02:10 +00:00
|
|
|
await task.watch('server/**/*.js', 'server')
|
|
|
|
await task.watch('build/**/*.js', 'nextbuild')
|
|
|
|
await task.watch('export/**/*.js', 'nextexport')
|
|
|
|
await task.watch('client/**/*.js', 'client')
|
|
|
|
await task.watch('lib/**/*.js', 'lib')
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function release (task) {
|
|
|
|
await task.clear('dist').start('build')
|
|
|
|
}
|
|
|
|
|
|
|
|
// notification helper
|
|
|
|
function notify (msg) {
|
|
|
|
return notifier.notify({
|
|
|
|
title: '▲ Next',
|
|
|
|
message: msg,
|
|
|
|
icon: false
|
|
|
|
})
|
|
|
|
}
|