@appearhere/bloom
Version:
Appear Here's pattern library and styleguide
38 lines (31 loc) • 1.3 kB
JavaScript
const path = require('path');
// We support resolving modules according to `NODE_PATH`.
// This lets you use absolute paths in imports inside large monorepos:
// https://github.com/facebookincubator/create-react-app/issues/253.
// It works similar to `NODE_PATH` in Node itself:
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
// We will export `nodePaths` as an array of absolute paths.
// It will then be used by Webpack configs.
// Jest doesn’t need this because it already handles `NODE_PATH` out of the box.
const nodePaths = (process.env.NODE_PATH || '')
.split(process.platform === 'win32' ? ';' : ':')
.filter(Boolean)
.map(p => path.resolve(p));
function resolveApp(relativePath) {
return path.resolve(relativePath);
}
// config after eject: we're in ./config/
module.exports = {
appBuild: resolveApp('build'),
appHtml: resolveApp('index.html'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('styleguide'),
componentSrc: resolveApp('components'),
utilsSrc: resolveApp('utils'),
globalsSrc: resolveApp('globals'),
constantsSrc: resolveApp('constants'),
testsSetup: resolveApp('styleguide/setupTests.js'),
appNodeModules: resolveApp('node_modules'),
ownNodeModules: resolveApp('node_modules'),
nodePaths,
};