UNPKG

1.4 kBJavaScriptView Raw
1var winston = require("winston");
2var _assign = require("lodash/assign");
3var omit = require("lodash/omit");
4var stealTools = require("../../index");
5var _clone = require("lodash/cloneDeep");
6var makeStealConfig = require("./make_steal_config");
7var options = _clone(require("./options"));
8var makeOutputs = require("./make_outputs");
9
10module.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};