UNPKG

@zohodesk/client_build_tool

Version:

A CLI tool to build web applications and client libraries

48 lines (36 loc) 2.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.cliRootPath = exports.cliNodeModulesPath = exports.babelrcPath = exports.appPath = exports.appNodeModules = exports.CONFIG_ROOT = exports.BASE_CONFIG_KEY = void 0; exports.getTemplatePath = getTemplatePath; exports.joinWithAppPath = joinWithAppPath; exports.templatesPath = void 0; var _path = _interopRequireWildcard(require("path")); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } const BASE_CONFIG_KEY = 'react-cli'; exports.BASE_CONFIG_KEY = BASE_CONFIG_KEY; const cliRootPath = _path.default.resolve(__dirname, '..', '..'); exports.cliRootPath = cliRootPath; const CONFIG_ROOT = 'client-build-config'; exports.CONFIG_ROOT = CONFIG_ROOT; const cliNodeModulesPath = _path.default.resolve(cliRootPath, 'node_modules'); exports.cliNodeModulesPath = cliNodeModulesPath; const babelrcPath = (0, _path.join)(cliRootPath, '.babelrc'); exports.babelrcPath = babelrcPath; const appPath = process.cwd(); exports.appPath = appPath; function joinWithAppPath(filePath) { // TODO: test in windows return (0, _path.join)(appPath, filePath); } ; const appNodeModules = joinWithAppPath('node_modules'); exports.appNodeModules = appNodeModules; const templatesPath = (0, _path.join)(__dirname, '..', '..', 'templates'); exports.templatesPath = templatesPath; function getTemplatePath(...filePath) { // TODO: test in windows return (0, _path.join)(templatesPath, ...filePath); }