1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | var __assign = (this && this.__assign) || function () {
|
7 | __assign = Object.assign || function(t) {
|
8 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
9 | s = arguments[i];
|
10 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
11 | t[p] = s[p];
|
12 | }
|
13 | return t;
|
14 | };
|
15 | return __assign.apply(this, arguments);
|
16 | };
|
17 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
18 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
19 | };
|
20 | Object.defineProperty(exports, "__esModule", { value: true });
|
21 |
|
22 | var path_1 = __importDefault(require("path"));
|
23 | var chalk_1 = __importDefault(require("chalk"));
|
24 | var yargs_1 = __importDefault(require("yargs"));
|
25 | var core_1 = __importDefault(require("@beemo/core"));
|
26 | var checkVersion_1 = __importDefault(require("./checkVersion"));
|
27 | var quoteSpecialOptions_1 = __importDefault(require("./quoteSpecialOptions"));
|
28 |
|
29 | var argv = quoteSpecialOptions_1.default(process.argv.slice(2));
|
30 |
|
31 | var binName = path_1.default.basename(process.argv[1]);
|
32 | var beemo = new core_1.default(argv.slice(1), binName);
|
33 | var app = yargs_1.default(argv);
|
34 | var manualURL = process.env.BEEMO_MANUAL_URL || 'https://milesj.gitbook.io/beemo';
|
35 |
|
36 | beemo.bootstrapConfigModule();
|
37 |
|
38 | beemo.tool.plugins.forEach(function (driver) {
|
39 | var _a = driver, _b = _a.command, command = _b === void 0 ? {} : _b, metadata = _a.metadata;
|
40 | app.command(driver.name, metadata.description || "Run " + metadata.title, __assign({}, command, { concurrency: {
|
41 | description: 'Number of builds to run in parallel',
|
42 | number: true,
|
43 | }, parallel: {
|
44 | array: true,
|
45 | default: [],
|
46 | description: 'Run parallel builds with additional flags or options',
|
47 | }, priority: {
|
48 | boolean: true,
|
49 | default: false,
|
50 | description: 'Prioritize workspace builds based on dependency graph',
|
51 | }, workspaces: {
|
52 | default: '',
|
53 | description: 'Run command in each workspace (supports regex)',
|
54 | string: true,
|
55 | } }), function (args) { return beemo.executeDriver(driver.name, args); });
|
56 | });
|
57 |
|
58 | app.command(['run-script <name>', 'run <name>'], 'Run custom script from configuration module', {}, function (args) { return beemo.executeScript(args.name, args); });
|
59 | app.command(['sync-dotfiles', 'sync'], 'Sync dotfiles from configuration module', {
|
60 | filter: {
|
61 | alias: 'f',
|
62 | default: '',
|
63 | description: 'Filter filenames (supports regex)',
|
64 | string: true,
|
65 | },
|
66 | }, function (args) { return beemo.syncDotfiles(args); });
|
67 | app.command('*', false, {}, function () {
|
68 | console.error(chalk_1.default.red('Please select a command!'));
|
69 | });
|
70 |
|
71 | app
|
72 | .option('debug', {
|
73 | boolean: true,
|
74 | default: false,
|
75 | description: 'Show debug messages',
|
76 | })
|
77 | .option('silent', {
|
78 | boolean: true,
|
79 | default: false,
|
80 | description: "Hide " + binName + " output",
|
81 | })
|
82 | .option('theme', {
|
83 | default: 'default',
|
84 | description: 'Change output colors',
|
85 | string: true,
|
86 | })
|
87 | .option('verbose', {
|
88 | default: 3,
|
89 | description: 'Control output size',
|
90 | number: true,
|
91 | });
|
92 |
|
93 |
|
94 | app
|
95 | .usage(binName + " <command> [args..]")
|
96 | .epilogue(chalk_1.default.gray(["For more information, view the manual: " + manualURL, "Powered by Beemo v" + checkVersion_1.default].join('\n')))
|
97 | .demandCommand(1, chalk_1.default.red('Please select a command!'))
|
98 | .showHelpOnFail(true)
|
99 | .help().argv;
|