sourcecred/config/paths.js
Dandelion Mané e3f04c5079
Git plugin serializes the repository and graph (#874)
This modifies the behavior when loading the Git plugin so that it
serializes the Repository as well as the graph. This will allow us to
get extra information, like the commit headline, to the Git plugin in
the frontend.

As an added bonus, we can now refactor `loadRepositoryTest` to depend on
`sourcecred.js load` rather than `loadAndPrintRepository`. As this was
the only use for `loadAndPrintRepository`, we can safely delete it. This
improves our test quality because it means we are also testing the
actual CLI behavior.

Note that the switch from using `stringify` to `json.tool` for
pretty-printing has resulted in a trivial diff in the snapshot.

Test plan: `yarn test --full` passes.
2018-09-20 14:07:58 -07:00

38 lines
1.4 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/sourcecred_32.png"),
appBuild: resolveApp("build"),
appIndexJs: resolveApp("src/app/index.js"),
appServerSideRenderingIndexJs: resolveApp("src/app/server.js"),
appRouteData: resolveApp("src/app/routeData.js"),
appPackageJson: resolveApp("package.json"),
appSrc: resolveApp("src"),
yarnLockFile: resolveApp("yarn.lock"),
appNodeModules: resolveApp("node_modules"),
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"),
//
fetchAndPrintGithubRepo: resolveApp(
"src/plugins/github/bin/fetchAndPrintGithubRepo.js"
),
createExampleRepo: resolveApp("src/plugins/git/bin/createExampleRepo.js"),
},
};