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:
parent
af1d10c941
commit
4322bb13dd
|
@ -1,12 +1,12 @@
|
|||
const notifier = require('node-notifier')
|
||||
|
||||
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')
|
||||
}
|
||||
|
||||
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')
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,10 @@ export async function build (task) {
|
|||
}
|
||||
|
||||
export default async function (task) {
|
||||
await task.clear('dist')
|
||||
await task.start('build')
|
||||
await task.watch('server/**/*.js', 'server')
|
||||
await task.watch('lib/**/*.js', 'lib')
|
||||
await task.watch('server/**/*.+(js|ts)', 'server')
|
||||
await task.watch('lib/**/*.+(js|ts)', 'lib')
|
||||
}
|
||||
|
||||
export async function release (task) {
|
||||
|
|
|
@ -10,33 +10,33 @@ export async function bin (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')
|
||||
}
|
||||
|
||||
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')
|
||||
}
|
||||
|
||||
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')
|
||||
}
|
||||
|
||||
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')
|
||||
}
|
||||
|
||||
// export is a reserved keyword for functions
|
||||
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')
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -44,14 +44,15 @@ export async function build (task) {
|
|||
}
|
||||
|
||||
export default async function (task) {
|
||||
await task.clear('dist')
|
||||
await task.start('build')
|
||||
await task.watch('bin/*', 'bin')
|
||||
await task.watch('pages/**/*.js', 'pages')
|
||||
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')
|
||||
await task.watch('pages/**/*.+(js|ts)', 'pages')
|
||||
await task.watch('server/**/*.+(js|ts)', 'server')
|
||||
await task.watch('build/**/*.+(js|ts)', 'nextbuild')
|
||||
await task.watch('export/**/*.+(js|ts)', 'nextexport')
|
||||
await task.watch('client/**/*.+(js|ts)', 'client')
|
||||
await task.watch('lib/**/*.+(js|ts)', 'lib')
|
||||
}
|
||||
|
||||
export async function release (task) {
|
||||
|
|
Loading…
Reference in a new issue