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

95 lines (72 loc) 2.66 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.PackCmd = 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; } function _ink() { const data = require("ink"); _ink = function () { return data; }; return data; } // eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars class PackCmd { constructor(packer) { this.packer = packer; (0, _defineProperty2().default)(this, "name", 'pack <componentId> [scopePath]'); (0, _defineProperty2().default)(this, "description", 'Create tar for npm publish'); (0, _defineProperty2().default)(this, "options", [['d', 'out-dir <out-dir>', 'directory to put the result tar file'], ['o', 'override [boolean]', 'override existing pack file'], ['k', 'keep [boolean]', 'should keep isolated environment [default = false]'], ['p', 'prefix [boolean]', 'keep custom (binding) prefix'], ['c', 'use-capsule [boolean]', 'isolate using the capsule and pack on the capsule'], ['j', 'json [boolean]', 'return the output as JSON']]); (0, _defineProperty2().default)(this, "shortDescription", ''); (0, _defineProperty2().default)(this, "alias", ''); (0, _defineProperty2().default)(this, "group", 'collaborate'); } render(args, options) { var _this = this; return (0, _bluebird().coroutine)(function* () { const packResult = yield _this.json(args, options); return /*#__PURE__*/_react().default.createElement(_ink().Color, { green: true }, "tar path: ", packResult.data.tarPath); })(); } json([componentId, scopePath], options) { var _this2 = this; return (0, _bluebird().coroutine)(function* () { const compId = typeof componentId === 'string' ? componentId : componentId[0]; let scopePathStr; if (scopePath) { scopePathStr = typeof scopePath !== 'string' ? scopePath[0] : scopePath; } const packResult = yield _this2.packer.packComponent(compId, scopePathStr, options); return { data: packResult, code: 0 }; })(); } } exports.PackCmd = PackCmd;