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

112 lines (86 loc) 3.12 kB
"use strict"; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; function _defineProperty2() { const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); _defineProperty2 = function () { return data; }; return data; } function path() { const data = _interopRequireWildcard(require("path")); path = function () { return data; }; return data; } function _os() { const data = _interopRequireDefault(require("os")); _os = function () { return data; }; return data; } function _fsExtra() { const data = _interopRequireDefault(require("fs-extra")); _fsExtra = function () { return data; }; return data; } function _utils() { const data = require("../utils"); _utils = function () { return data; }; return data; } // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! class ScopesData { // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! constructor(scopesOptions) { (0, _defineProperty2().default)(this, "e2eDir", void 0); (0, _defineProperty2().default)(this, "local", void 0); (0, _defineProperty2().default)(this, "localPath", void 0); (0, _defineProperty2().default)(this, "remote", void 0); (0, _defineProperty2().default)(this, "remotePath", void 0); (0, _defineProperty2().default)(this, "env", void 0); (0, _defineProperty2().default)(this, "envPath", void 0); (0, _defineProperty2().default)(this, "globalRemote", void 0); (0, _defineProperty2().default)(this, "globalRemotePath", void 0); this.e2eDir = path().join(_os().default.tmpdir(), 'bit', 'e2e'); this.setLocalScope(); this.setRemoteScope(scopesOptions === null || scopesOptions === void 0 ? void 0 : scopesOptions.remoteScopeWithDot); this.setEnvScope(); this.globalRemote = 'global-remote'; this.globalRemotePath = path().join(this.e2eDir, this.globalRemote); } setLocalScope(localScope) { this.local = localScope || `${(0, _utils().generateRandomStr)()}-local`; this.localPath = path().join(this.e2eDir, this.local); _fsExtra().default.ensureDirSync(this.localPath); } setRemoteScope(remoteScopeWithDot = false) { if (remoteScopeWithDot) { this.remote = `${(0, _utils().generateRandomStr)()}.${(0, _utils().generateRandomStr)()}-remote`; } else { this.remote = `${(0, _utils().generateRandomStr)()}-remote`; } this.remotePath = path().join(this.e2eDir, this.remote); } setEnvScope() { this.env = `${(0, _utils().generateRandomStr)()}-env`; this.envPath = path().join(this.e2eDir, this.env); } } exports.default = ScopesData;