Skip to content

Commit

Permalink
CredEquate: expose core code in library (#3310)
Browse files Browse the repository at this point in the history
  • Loading branch information
blueridger committed Jan 31, 2022
1 parent d77bf0e commit 505d5da
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/sourcecred/scripts/shell.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// @no-flow
var repl = require("repl");
var context = repl.start("$ ").context;
const repl = require("repl");
const context = repl.start("$ ").context;

try {
context.sc = require("../dist/server/api.js").sourcecred;
context.scClient = require("../dist/client/api.js");
} catch (e) {
throw "Run `yarn build` before opening the shell.";
console.log(
"\nAn error occurred. Try running `yarn build` before opening the shell.\n"
);
throw e;
}
14 changes: 14 additions & 0 deletions packages/sourcecred/src/api/lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@ import * as ledger from "../../core/ledger/ledger";
import * as ledgerUtils from "../../core/ledger/utils";
import * as grain from "../../core/ledger/grain";
import * as identity from "../../core/identity";
import * as contribution from "../../core/credequate/contribution";
import * as scoredContribution from "../../core/credequate/scoredContribution";
import * as operator from "../../core/credequate/operator";
import * as config from "../../core/credequate/config";

import * as manager from "../ledgerManager";
import * as storage from "../../core/storage/github";
import * as credrank from "../main/credrank";
import * as contributions from "../main/contributions";
import * as credequate from "../main/credequate";
import * as graphApi from "../main/graph";
import * as grainApi from "../main/grain";
import * as analysis from "../main/analysis";
Expand All @@ -46,6 +52,8 @@ const api = {
api: {
graph: graphApi,
credrank,
contributions,
credequate,
grain: grainApi,
analysis,
},
Expand All @@ -64,6 +72,12 @@ const api = {
credGraph,
CredGrainView,
},
credequate: {
scoredContribution,
contribution,
config,
operator,
},
ledger: {
ledger,
identity,
Expand Down

0 comments on commit 505d5da

Please sign in to comment.