|
1 | | -/* eslint no-process-exit: 0 */ |
2 | | - |
3 | 1 | import 'colors'; |
4 | 2 | import bower from './amd/build'; |
5 | 3 | import lib from './lib/build'; |
6 | | -import docs from '../docs/build'; |
7 | 4 | import dist from './dist/build'; |
8 | 5 | import { copy } from './fs-utils'; |
9 | 6 | import { distRoot, bowerRoot } from './constants'; |
10 | | -import { exec, setExecOptions } from './exec'; |
11 | | - |
12 | | -import yargs from 'yargs'; |
13 | | - |
14 | | -const argv = yargs |
15 | | - .option('docs-only', { |
16 | | - demand: false, |
17 | | - default: false |
18 | | - }) |
19 | | - .option('verbose', { |
20 | | - demand: false, |
21 | | - default: false, |
22 | | - describe: 'Increased debug output' |
23 | | - }) |
24 | | - .argv; |
| 7 | +import { exec } from './exec'; |
25 | 8 |
|
26 | | -setExecOptions(argv); |
27 | | - |
28 | | -function forkAndBuildDocs(fork) { |
| 9 | +function forkAndBuildDocs(verbose) { |
29 | 10 | console.log('Building: '.cyan + 'docs'.green); |
30 | 11 |
|
31 | | - let options = argv.verbose ? ' -- --verbose' : ''; |
| 12 | + let options = verbose ? ' -- --verbose' : ''; |
32 | 13 |
|
33 | 14 | return exec(`npm run docs-build${options}`) |
34 | 15 | .then(() => console.log('Built: '.cyan + 'docs'.green)); |
35 | 16 | } |
36 | 17 |
|
37 | | -export default function Build(noExitOnFailure) { |
38 | | - if (argv.docsOnly) { |
39 | | - return docs(); |
40 | | - } else { |
41 | | - let result = Promise.all([ |
| 18 | +export default function Build(verbose) { |
| 19 | + return Promise.all([ |
42 | 20 | lib(), |
43 | 21 | bower(), |
44 | 22 | dist(), |
45 | | - forkAndBuildDocs() |
| 23 | + forkAndBuildDocs(verbose) |
46 | 24 | ]) |
47 | 25 | .then(() => copy(distRoot, bowerRoot)); |
48 | | - |
49 | | - if (!noExitOnFailure) { |
50 | | - result = result |
51 | | - .catch(err => { |
52 | | - console.error(err.toString().red); |
53 | | - if (err.stack) { |
54 | | - console.error(err.stack.red); |
55 | | - } |
56 | | - process.exit(1); |
57 | | - }); |
58 | | - } |
59 | | - |
60 | | - return result; |
61 | | - } |
62 | 26 | } |
0 commit comments