UNPKG

react-cosmos

Version:

CLI for running React Cosmos inside webpack-powered apps

28 lines (19 loc) 878 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getCosmosConfigAtPath = getCosmosConfigAtPath; var _path = _interopRequireDefault(require("path")); var _createCosmosConfig = require("./createCosmosConfig"); var _shared = require("./shared"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function getCosmosConfigAtPath(cosmosConfigPath) { var cosmosConfigInput = (0, _shared.requireConfigFile)(cosmosConfigPath); var rootDir = deriveRootDir(cosmosConfigPath, cosmosConfigInput); return (0, _createCosmosConfig.createCosmosConfig)(rootDir, cosmosConfigInput); } function deriveRootDir(cosmosConfigPath, _ref) { var rootDir = _ref.rootDir; var configDir = _path.default.dirname(cosmosConfigPath); return rootDir ? _path.default.resolve(configDir, rootDir) : configDir; }