Skip to content

Commit

Permalink
cli2: add skeleton
Browse files Browse the repository at this point in the history
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` and `node ./bin/sc2.js`, which should nicely fail
with a “not yet implemented” message.

wchargin-branch: cli2-skeleton
wchargin-source: a76bc7625c5508b876e471f6c8a8f82363f76a12
  • Loading branch information
wchargin authored and teamdandelion committed May 28, 2020
1 parent 70a4597 commit 3db9b91
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/paths.js
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions src/cli2/command.js
@@ -0,0 +1,3 @@
// @flow

export * from "../cli/command";
23 changes: 23 additions & 0 deletions 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<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();
}
11 changes: 11 additions & 0 deletions src/cli2/sourcecred.js
@@ -0,0 +1,11 @@
// @flow
// Implementation of the root `sourcecred` command.

import type {Command} from "./command";

const sourcecred: Command = async (args, std) => {
std.err("SourceCred CLI v2 not yet implemented");
return 1;
};

export default sourcecred;

0 comments on commit 3db9b91

Please sign in to comment.