diff --git a/config/paths.js b/config/paths.js index 3322c22..edf89b9 100644 --- a/config/paths.js +++ b/config/paths.js @@ -30,6 +30,7 @@ module.exports = { // 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" diff --git a/src/cli2/command.js b/src/cli2/command.js new file mode 100644 index 0000000..ab8b59f --- /dev/null +++ b/src/cli2/command.js @@ -0,0 +1,3 @@ +// @flow + +export * from "../cli/command"; diff --git a/src/cli2/main.js b/src/cli2/main.js new file mode 100644 index 0000000..48d58b6 --- /dev/null +++ b/src/cli2/main.js @@ -0,0 +1,23 @@ +// @flow + +import {handlingErrors} from "./command"; +import sourcecred from "./sourcecred"; + +require("../tools/entry"); + +export default function main(): Promise { + return handlingErrors(sourcecred)(process.argv.slice(2), { + out: (x) => console.log(x), + err: (x) => console.error(x), + }).then((exitCode) => { + process.exitCode = exitCode; + }); +} + +// Only run in the Webpack bundle, not as a Node module (during tests). +/* istanbul ignore next */ +/*:: declare var __webpack_require__: mixed; */ +// eslint-disable-next-line camelcase +if (typeof __webpack_require__ !== "undefined") { + main(); +} diff --git a/src/cli2/sourcecred.js b/src/cli2/sourcecred.js new file mode 100644 index 0000000..04e9f7e --- /dev/null +++ b/src/cli2/sourcecred.js @@ -0,0 +1,10 @@ +// @flow + +import type {Command} from "./command"; + +const sourcecred: Command = async (args, std) => { + std.err("SourceCred CLI v2 not yet implemented"); + return 1; +}; + +export default sourcecred;