Skip to content

Commit

Permalink
fix: remove old dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
BelfordZ committed May 16, 2019
1 parent 123aa9c commit 61c995e
Showing 1 changed file with 7 additions and 30 deletions.
37 changes: 7 additions & 30 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ import { Server } from "./";
import { parseOpenRPCDocument } from "@open-rpc/schema-utils-js";
import { inspect } from "util";
import * as fs from "fs";
import * as util from "util";
import { keyBy, flatten, chain } from "lodash";
import { IMethodMapping } from "./router";
import { resolve } from "path";

const readDir = util.promisify(fs.readdir);
const basePath = "./src/method-handlers";
import loadMethodHandlerMapping from "./load-method-handler-mapping";

const cwd = process.cwd();

Expand All @@ -24,33 +18,16 @@ const init = async () => {
console.log("no method mapping"); // tslint:disable-line
console.log(e); // tslint:disable-line
}
program
.option("-d, --document <documentLocation>", "JSON string or a Path/Url pointing to an OpenROC document");

program
.version(version, "-v, --version")
.command("start")
.action(async (env, options) => {
const methodFilenames = await readDir(basePath);

const baba = `${process.cwd()}/src/method-handlers`;
// const methodMapping = await import(baba);

// const readMethodsPromises = methodFilenames.map(async (methodFilename) => {
// const methodPath = `./method-handlers/${methodFilename}`.replace(".ts", "");
// const name = methodFilename.replace(".ts", "");
// const methodHandler = await import(methodPath);

// return { name, fn: methodHandler.default };
// });

// const allMethodHandlers = flatten(await Promise.all(readMethodsPromises));

// const methodHandlerMap = chain(allMethodHandlers)
// .keyBy("name")
// .mapValues("fn")
// .value();
.option("-d, --document <string>", "JSON string or a Path/Url pointing to an OpenROC document")
.option("-m, --methodHandlersDirectory <string>", "directory containing method handlers")

.command("start")
.action(async (env, options) => {
const methodHandlerMapping = loadMethodHandlerMapping(cwd);
console.log('wip'); // tslint:disable-line
});
};

Expand Down

0 comments on commit 61c995e

Please sign in to comment.