Unverified Commit 4322bb13 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Build / watch .ts core files (#5776)

parent af1d10c9
const notifier = require('node-notifier') const notifier = require('node-notifier')
export async function lib (task, opts) { export async function lib (task, opts) {
await task.source(opts.src || 'lib/**/*.js').typescript({module: 'commonjs'}).target('dist/lib') await task.source(opts.src || 'lib/**/*.+(js|ts)').typescript({module: 'commonjs'}).target('dist/lib')
notify('Compiled lib files') notify('Compiled lib files')
} }
export async function server (task, opts) { export async function server (task, opts) {
await task.source(opts.src || 'server/**/*.js').typescript({module: 'commonjs'}).target('dist/server') await task.source(opts.src || 'server/**/*.+(js|ts)').typescript({module: 'commonjs'}).target('dist/server')
notify('Compiled server files') notify('Compiled server files')
} }
...@@ -15,9 +15,10 @@ export async function build (task) { ...@@ -15,9 +15,10 @@ export async function build (task) {
} }
export default async function (task) { export default async function (task) {
await task.clear('dist')
await task.start('build') await task.start('build')
await task.watch('server/**/*.js', 'server') await task.watch('server/**/*.+(js|ts)', 'server')
await task.watch('lib/**/*.js', 'lib') await task.watch('lib/**/*.+(js|ts)', 'lib')
} }
export async function release (task) { export async function release (task) {
......
...@@ -10,33 +10,33 @@ export async function bin (task, opts) { ...@@ -10,33 +10,33 @@ export async function bin (task, opts) {
} }
export async function lib (task, opts) { export async function lib (task, opts) {
await task.source(opts.src || 'lib/**/*.js').typescript({module: 'commonjs'}).target('dist/lib') await task.source(opts.src || 'lib/**/*.+(js|ts)').typescript({module: 'commonjs'}).target('dist/lib')
notify('Compiled lib files') notify('Compiled lib files')
} }
export async function server (task, opts) { export async function server (task, opts) {
await task.source(opts.src || 'server/**/*.js').typescript({module: 'commonjs'}).target('dist/server') await task.source(opts.src || 'server/**/*.+(js|ts)').typescript({module: 'commonjs'}).target('dist/server')
notify('Compiled server files') notify('Compiled server files')
} }
export async function nextbuild (task, opts) { export async function nextbuild (task, opts) {
await task.source(opts.src || 'build/**/*.js').typescript({module: 'commonjs'}).target('dist/build') await task.source(opts.src || 'build/**/*.+(js|ts)').typescript({module: 'commonjs'}).target('dist/build')
notify('Compiled build files') notify('Compiled build files')
} }
export async function client (task, opts) { export async function client (task, opts) {
await task.source(opts.src || 'client/**/*.js').typescript().target('dist/client') await task.source(opts.src || 'client/**/*.+(js|ts)').typescript().target('dist/client')
notify('Compiled client files') notify('Compiled client files')
} }
// export is a reserved keyword for functions // export is a reserved keyword for functions
export async function nextbuildstatic (task, opts) { export async function nextbuildstatic (task, opts) {
await task.source(opts.src || 'export/**/*.js').typescript({module: 'commonjs'}).target('dist/export') await task.source(opts.src || 'export/**/*.+(js|ts)').typescript({module: 'commonjs'}).target('dist/export')
notify('Compiled export files') notify('Compiled export files')
} }
export async function pages (task, opts) { export async function pages (task, opts) {
await task.source(opts.src || 'pages/**/*.js').typescript().target('dist/pages') await task.source(opts.src || 'pages/**/*.+(js|ts)').typescript().target('dist/pages')
} }
export async function build (task) { export async function build (task) {
...@@ -44,14 +44,15 @@ export async function build (task) { ...@@ -44,14 +44,15 @@ export async function build (task) {
} }
export default async function (task) { export default async function (task) {
await task.clear('dist')
await task.start('build') await task.start('build')
await task.watch('bin/*', 'bin') await task.watch('bin/*', 'bin')
await task.watch('pages/**/*.js', 'pages') await task.watch('pages/**/*.+(js|ts)', 'pages')
await task.watch('server/**/*.js', 'server') await task.watch('server/**/*.+(js|ts)', 'server')
await task.watch('build/**/*.js', 'nextbuild') await task.watch('build/**/*.+(js|ts)', 'nextbuild')
await task.watch('export/**/*.js', 'nextexport') await task.watch('export/**/*.+(js|ts)', 'nextexport')
await task.watch('client/**/*.js', 'client') await task.watch('client/**/*.+(js|ts)', 'client')
await task.watch('lib/**/*.js', 'lib') await task.watch('lib/**/*.+(js|ts)', 'lib')
} }
export async function release (task) { export async function release (task) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment