1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Build / watch .ts core files (#5776)

This commit is contained in:
Tim Neutkens 2018-11-30 13:10:30 +01:00 committed by GitHub
parent af1d10c941
commit 4322bb13dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 16 deletions

View file

@ -1,12 +1,12 @@
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) {
} }
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) {

View file

@ -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) {
} }
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) {