UNPKG

1.65 kBJavaScriptView Raw
1"use strict";
2
3require("core-js/modules/es6.object.define-property");
4
5Object.defineProperty(exports, "__esModule", {
6 value: true
7});
8exports["default"] = void 0;
9
10var _moment = _interopRequireDefault(require("moment"));
11
12var _debug = _interopRequireDefault(require("debug"));
13
14var _emptyFunction = _interopRequireDefault(require("fbjs/lib/emptyFunction"));
15
16var _configs = _interopRequireDefault(require("./utils/configs"));
17
18var _worker = _interopRequireDefault(require("./utils/worker"));
19
20function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
22/**
23 * fixme-flow-file-annotation
24 *
25 * Flow not support @babel/plugin-proposal-pipeline-operator
26 * https://github.com/facebook/flow/issues/5443
27 */
28
29/* eslint-disable flowtype/no-types-missing-file-annotation, flowtype/require-valid-file-annotation */
30var debugLog = (0, _debug["default"])('configs:config');
31/**
32 * @example
33 * config('cli', '/file-path')
34 *
35 * @param {string} cliName - cli name
36 * @param {string} filePath - file path
37 *
38 * @return {object} - cli config
39 */
40
41var _default = function _default(cliName, filePath) {
42 var _ref, _ref2, _ref3;
43
44 debugLog("cliName: ".concat(cliName));
45 debugLog("filePath: ".concat(filePath));
46
47 _worker["default"].writeCache({
48 filePath: filePath,
49 using: (0, _moment["default"])().format()
50 });
51
52 return _ref = (_ref2 = (_ref3 = {}, _configs["default"].addConfigsEnv(_ref3)), (_configs["default"].store[cliName].config || _emptyFunction["default"].thatReturnsArgument)(_ref2)), _configs["default"].removeConfigsEnv(_ref);
53};
54
55exports["default"] = _default;
56module.exports = exports.default;
\No newline at end of file