Files
flood/client/config/paths.js
John Furrow 92404918a0 Introduce Typescript & CSS Modules (#815)
* Adding typescript support

* Begins configuring webpack builds

* Fix lint warnings

* Updates react-router

* Fixes lint configuration

* Adds missing dependency

* Restores disabled performance hints

* Renames connectStores

* Types connectStores

* Uses correct envvars and fixes missing EOF newline

* Formats files

* Defaults props to empty object

* Ignores type definitions in eslint

* Another newline

* Adjusts script invocation

* Ignore jsdoc output

* Undoes the autoformatting of CSS module types

* Improves lint rules

* Finishes webpack config changes

* Updates deps

* Fixes lint errors and attempts to fix SVG icon generator

* Fixes SVG sprite generator

* Adds type for SVG imports

* Explicitly use babelrc in SVG loader

* Formats files

* Refactors prettier formatter, formats CSS module type defs

* Updates style types

* Uses nicer syntax in typed-css-modules-loader

* Removes unnecessary div

* optional property in package.json

* package-lock

* Fixes upstream lint errors

* Removes unused modules
2019-11-22 22:47:09 -08:00

32 lines
1.1 KiB
JavaScript

const path = require('path');
const fs = require('fs');
const userConfig = require('../../config');
// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
const ensureSlash = (questionablePath, needsSlash) => {
const hasSlash = questionablePath.endsWith('/');
if (hasSlash && !needsSlash) {
return questionablePath.substr(questionablePath, questionablePath.length - 1);
}
if (!hasSlash && needsSlash) {
return `${questionablePath}/`;
}
return questionablePath;
};
module.exports = {
appBuild: resolveApp('server/assets'),
appPublic: resolveApp('client/src/public/'),
appHtml: resolveApp('client/src/index.html'),
appIndex: resolveApp('client/src/javascript/app.tsx'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('./'),
clientSrc: resolveApp('client/src'),
testsSetup: resolveApp('tests/setupTests.js'),
appNodeModules: resolveApp('node_modules'),
servedPath: ensureSlash(userConfig.baseURI || '/', true),
};