cli2: add skeleton of new CLI (#1809)
Summary: This patch creates a new binary, `./bin/sc2`, which will be the home for a rewrite of the CLI intended to implement an instance system. See: <https://discourse.sourcecred.io/t/sourcecred-instance-system/244> Paired with @decentralion. Test Plan: Run `yarn backend && node ./bin/sc2.js`, which should nicely fail with a “not yet implemented” message. wchargin-branch: cli2-skeleton
This commit is contained in:
parent
97da2ae077
commit
0449c9ea37
|
@ -30,6 +30,7 @@ module.exports = {
|
||||||
// point within the build directory.
|
// point within the build directory.
|
||||||
backendEntryPoints: {
|
backendEntryPoints: {
|
||||||
sourcecred: resolveApp("src/cli/main.js"),
|
sourcecred: resolveApp("src/cli/main.js"),
|
||||||
|
sc2: resolveApp("src/cli2/main.js"),
|
||||||
//
|
//
|
||||||
generateGithubGraphqlFlowTypes: resolveApp(
|
generateGithubGraphqlFlowTypes: resolveApp(
|
||||||
"src/plugins/github/bin/generateGraphqlFlowTypes.js"
|
"src/plugins/github/bin/generateGraphqlFlowTypes.js"
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
export * from "../cli/command";
|
|
@ -0,0 +1,23 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
import {handlingErrors} from "./command";
|
||||||
|
import sourcecred from "./sourcecred";
|
||||||
|
|
||||||
|
require("../tools/entry");
|
||||||
|
|
||||||
|
export default function main(): Promise<void> {
|
||||||
|
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();
|
||||||
|
}
|
|
@ -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;
|
Loading…
Reference in New Issue