sourcecred/config/paths.js
Dandelion Mané f25bc795c6
Fork the frontend to build towards cli2 compat (#1853)
The cli2 ("instance") system has a foundationally different assumption
about how the frontend works: rather than having a unified frontend that
abstracts over many separate SourceCred projects, we'll have a single
frontend entry per instance. This means we no longer need (for example)
to make project IDs available at build time.

Our frontend setup and server side rendering is pretty complex, so
rather than rebuild it from scratch, I'm going to fork it into an
independent copy and then change it to suit our needs.

To start here, I've duplicated the `src/homepage` directory into
`src/homepage2`, duplicated the webpack config to
`config/webpack.config.web2.js`, and duplicated the paths and
package.json scripts.

Test plan:
Run `yarn start2` and it will start an identical frontend, using the
duplicated directory. Run `yarn build2` and it will build a viable
frontend into the `build2` directory. `build2` is gitignored.
2020-06-17 18:44:34 -07:00

50 lines
1.8 KiB
JavaScript

// @flow
const path = require("path");
const fs = require("fs");
// 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);
// config after eject: we're in ./config/
module.exports = {
root: appDirectory,
dotenv: resolveApp(".env"),
favicon: resolveApp("src/assets/logo/rasterized/logo_32.png"),
appBuild: resolveApp("build"),
appBuild2: resolveApp("build2"),
appIndexJs: resolveApp("src/homepage/index.js"),
appIndexJs2: resolveApp("src/homepage2/index.js"),
appServerSideRenderingIndexJs: resolveApp("src/homepage/server.js"),
appServerSideRenderingIndexJs2: resolveApp("src/homepage2/server.js"),
appPackageJson: resolveApp("package.json"),
appSrc: resolveApp("src"),
yarnLockFile: resolveApp("yarn.lock"),
appNodeModules: resolveApp("node_modules"),
apiIndexJs: resolveApp("src/api/index.js"),
apiBuild: resolveApp("dist"),
backendBuild: resolveApp("bin"),
// This object should have one key-value pair per entry point. For
// each key, the value should be the path to the entry point for the
// source file, and the key will be the filename of the bundled entry
// point within the build directory.
backendEntryPoints: {
sourcecred: resolveApp("src/cli/main.js"),
sc2: resolveApp("src/cli2/main.js"),
//
generateGithubGraphqlFlowTypes: resolveApp(
"src/plugins/github/bin/generateGraphqlFlowTypes.js"
),
fetchAndPrintGithubRepo: resolveApp(
"src/plugins/github/bin/fetchAndPrintGithubRepo.js"
),
fetchAndPrintGithubOrg: resolveApp(
"src/plugins/github/bin/fetchAndPrintGithubOrg.js"
),
createExampleRepo: resolveApp("src/plugins/git/bin/createExampleRepo.js"),
},
};