UNPKG

bit-bin

Version:

<a href="https://opensource.org/licenses/Apache-2.0"><img alt="apache" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a> <a href="https://github.com/teambit/bit/blob/master/CONTRIBUTING.md"><img alt="prs" src="https://img.shields.io/b

93 lines (74 loc) 2.41 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.CompileCmd = void 0; function _bluebird() { const data = require("bluebird"); _bluebird = function () { return data; }; return data; } function _defineProperty2() { const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); _defineProperty2 = function () { return data; }; return data; } function _react() { const data = _interopRequireDefault(require("react")); _react = function () { return data; }; return data; } class CompileCmd { constructor(compile) { this.compile = compile; (0, _defineProperty2().default)(this, "name", 'compile [component...]'); (0, _defineProperty2().default)(this, "description", 'compile components'); (0, _defineProperty2().default)(this, "shortDescription", ''); (0, _defineProperty2().default)(this, "alias", ''); (0, _defineProperty2().default)(this, "group", 'development'); (0, _defineProperty2().default)(this, "private", true); (0, _defineProperty2().default)(this, "options", [['v', 'verbose', 'showing npm verbose output for inspection'], ['c', 'no-cache', 'ignore component cache when creating dist file'], ['j', 'json', 'return the compile results in json format']]); } render([components], { verbose, noCache }) { var _this = this; return (0, _bluebird().coroutine)(function* () { // @ts-ignore const compileResults = yield _this.compile.compileOnWorkspace(components, { verbose, noCache }); // eslint-disable-next-line no-console console.log('compileResults', compileResults); const output = `${compileResults.length} components have been compiled successfully`; return /*#__PURE__*/_react().default.createElement("div", null, output); })(); } json([components], { verbose, noCache }) { var _this2 = this; return (0, _bluebird().coroutine)(function* () { // @ts-ignore const compileResults = yield _this2.compile.compileOnWorkspace(components, { verbose, noCache }); return { data: compileResults, // @todo: fix the code once compile is ready. code: 0 }; })(); } } exports.CompileCmd = CompileCmd;