1 | var winston = require("winston");
|
2 | var assign = require("lodash/assign");
|
3 | var clone = require("lodash/cloneDeep");
|
4 | var stealTools = require("../../index");
|
5 | var makeStealConfig = require("./make_steal_config");
|
6 | var makeBuildOptions = require("./make_build_options");
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | var options = assign(clone(require("./options")), {
|
14 | minify: {
|
15 | type: "boolean",
|
16 | default: undefined,
|
17 | describe: "Minify the output. Defaults to true except when used with --watch"
|
18 | },
|
19 | quiet: {
|
20 | type: "boolean",
|
21 | describe: "Quiet output",
|
22 | default: undefined
|
23 | }
|
24 | });
|
25 |
|
26 | module.exports = {
|
27 | command: ["build", "*"],
|
28 |
|
29 | describe: "Build a module and all of its dependencies",
|
30 |
|
31 | builder: options,
|
32 |
|
33 | handler: function(argv) {
|
34 | var promise = stealTools.build(
|
35 | makeStealConfig(argv),
|
36 | makeBuildOptions(argv)
|
37 | );
|
38 |
|
39 |
|
40 | if (promise.then) {
|
41 | return promise.then(function() {
|
42 | winston.info("\nBuild completed successfully".green);
|
43 | }, function(e) {
|
44 |
|
45 |
|
46 |
|
47 | if (typeof e === "string") { e = new Error(e); }
|
48 | winston.error(e.message.red);
|
49 | winston.error("\nBuild failed".red);
|
50 |
|
51 | process.exit(1);
|
52 | });
|
53 | }
|
54 | }
|
55 | };
|