1 | var winston = require("winston");
|
2 | var _assign = require("lodash/assign");
|
3 | var omit = require("lodash/omit");
|
4 | var stealTools = require("../../index");
|
5 | var _clone = require("lodash/cloneDeep");
|
6 | var makeStealConfig = require("./make_steal_config");
|
7 | var options = _clone(require("./options"));
|
8 | var makeOutputs = require("./make_outputs");
|
9 |
|
10 | module.exports = {
|
11 | command: "export",
|
12 |
|
13 | builder: _assign({}, omit(options, ["tree-shaking", "no-tree-shaking"]), {
|
14 | cjs: {
|
15 | type: "boolean",
|
16 | describe: "Sets default +cjs output"
|
17 | },
|
18 | amd: {
|
19 | type: "boolean",
|
20 | describe: "Sets default +amd output"
|
21 | },
|
22 | global: {
|
23 | type: "boolean",
|
24 | describe: "Sets default +global-js and +global-css outputs"
|
25 | },
|
26 | standalone: {
|
27 | type: "boolean",
|
28 | describe: "Sets default +standalone output"
|
29 | },
|
30 | all: {
|
31 | type: "boolean",
|
32 | describe: "Sets outputs to +cjs, +amd, +global-js, and +global-css"
|
33 | },
|
34 | dest: {
|
35 | type: "string",
|
36 | describe: "Set the destination for the created file"
|
37 | }
|
38 | }),
|
39 |
|
40 | describe: "Export a project's modules to other forms and formats declaratively",
|
41 |
|
42 | handler: function(argv) {
|
43 | var options = argv;
|
44 | var steal = makeStealConfig(argv);
|
45 | var outputs = makeOutputs(options);
|
46 |
|
47 | var promise = stealTools.export({
|
48 | steal: steal,
|
49 | options: options,
|
50 | outputs: outputs
|
51 | });
|
52 |
|
53 | return promise.then(function() {
|
54 | winston.info("\nExport completed successfully".green);
|
55 | });
|
56 | }
|
57 | };
|