1 | 'use strict'
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | module.exports = function(routes, srcPath, distPath, opts, next) {
|
13 |
|
14 |
|
15 | const async = require('async')
|
16 | const validate = require('./validate')
|
17 | const clean = require('./clean')
|
18 | const copy = require('./copy')
|
19 | const run = require('./run')
|
20 |
|
21 |
|
22 | const cwdPath = process.cwd()
|
23 |
|
24 |
|
25 |
|
26 | if (next==null) next = opts
|
27 |
|
28 | try {
|
29 |
|
30 | next = validate.next(next)
|
31 | routes = routes.map(validate.route)
|
32 | srcPath = validate.path(srcPath)
|
33 | distPath = validate.path(distPath)
|
34 | opts = validate.opts(opts)
|
35 |
|
36 | } catch (err) {
|
37 |
|
38 | return next(err)
|
39 |
|
40 | }
|
41 |
|
42 |
|
43 | process.on('unhandledRejection', next)
|
44 |
|
45 | async.series([
|
46 |
|
47 | (next) => clean(distPath, cwdPath, opts, next),
|
48 | (next) => copy(routes, srcPath, distPath, opts, next),
|
49 | (next) => run(routes, srcPath, distPath, opts, next)
|
50 |
|
51 | ], next)
|
52 |
|
53 | } |
\ | No newline at end of file |