mirror of
https://github.com/status-im/sourcecred.git
synced 2025-01-10 12:46:16 +00:00
8ed0585bb6
Summary: This re-packages the build for the internal APIs exposed under #1526 to be more browser-friendly. Removing `target: "node"` (and adding an explicit `globalObject: "this"` for best-effort cross-compatibility) is the biggest change from the backend build; removing all the extra loaders and static site generation is the biggest change from the frontend build. This build configuration is forked from `webpack.config.backend.js`. Test Plan: Run `yarn api`, then upload the contents of `dist/api.js` to an Observable notebook and require it as an ES module. Verify that the SourceCred APIs are exposed: e.g., `sourcecred.core.graph.Graph` should be a valid constructor. wchargin-branch: api-build
46 lines
1.6 KiB
JavaScript
46 lines
1.6 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"),
|
|
appIndexJs: resolveApp("src/homepage/index.js"),
|
|
appServerSideRenderingIndexJs: resolveApp("src/homepage/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"),
|
|
//
|
|
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"),
|
|
},
|
|
};
|