From 25b0124b56caaa93ff1c15fec20c1376ba609280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dandelion=20Man=C3=A9?= Date: Tue, 7 Aug 2018 11:23:00 -0700 Subject: [PATCH] Move PluginAdapter to core (#615) There's no reason for it to be in `app` - the concepts it contains are core concepts, e.g. node types and graphs. For now I'm leaving the `NodeType` and `EdgeType` interfaces with the PluginAdapter. They may move later, but I'm relucant to clutter the graph class more, and all I need for now is that they live in core. Test plan: It's just a move/rename, so `yarn test` is amply sufficient. --- src/app/credExplorer/PagerankTable.js | 2 +- src/app/credExplorer/PagerankTable.test.js | 2 +- src/app/credExplorer/WeightConfig.js | 2 +- src/app/credExplorer/state.js | 2 +- src/{app => core}/pluginAdapter.js | 4 ++-- src/plugins/git/pluginAdapter.js | 4 ++-- src/plugins/github/pluginAdapter.js | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) rename src/{app => core}/pluginAdapter.js (83%) diff --git a/src/app/credExplorer/PagerankTable.js b/src/app/credExplorer/PagerankTable.js index fbea0c7..f82d3da 100644 --- a/src/app/credExplorer/PagerankTable.js +++ b/src/app/credExplorer/PagerankTable.js @@ -14,7 +14,7 @@ import type { ScoredConnection, } from "../../core/attribution/pagerankNodeDecomposition"; import type {Connection} from "../../core/attribution/graphToMarkovChain"; -import type {DynamicPluginAdapter} from "../pluginAdapter"; +import type {DynamicPluginAdapter} from "../../core/pluginAdapter"; import * as NullUtil from "../../util/null"; // TODO: Factor this out and test it (#465) diff --git a/src/app/credExplorer/PagerankTable.test.js b/src/app/credExplorer/PagerankTable.test.js index beeec09..068d184 100644 --- a/src/app/credExplorer/PagerankTable.test.js +++ b/src/app/credExplorer/PagerankTable.test.js @@ -2,7 +2,7 @@ import React from "react"; import {shallow} from "enzyme"; -import type {DynamicPluginAdapter} from "../pluginAdapter"; +import type {DynamicPluginAdapter} from "../../core/pluginAdapter"; import { PagerankTable, diff --git a/src/app/credExplorer/WeightConfig.js b/src/app/credExplorer/WeightConfig.js index 28d9fcf..eff1b62 100644 --- a/src/app/credExplorer/WeightConfig.js +++ b/src/app/credExplorer/WeightConfig.js @@ -15,7 +15,7 @@ import {byEdgeType, byNodeType} from "./edgeWeights"; import * as MapUtil from "../../util/map"; import * as NullUtil from "../../util/null"; -import type {StaticPluginAdapter} from "../pluginAdapter"; +import type {StaticPluginAdapter} from "../../core/pluginAdapter"; import {StaticPluginAdapter as GithubAdapter} from "../../plugins/github/pluginAdapter"; import {StaticPluginAdapter as GitAdapter} from "../../plugins/git/pluginAdapter"; diff --git a/src/app/credExplorer/state.js b/src/app/credExplorer/state.js index 3b78943..9dc720c 100644 --- a/src/app/credExplorer/state.js +++ b/src/app/credExplorer/state.js @@ -12,7 +12,7 @@ import { pagerank, } from "../../core/attribution/pagerank"; -import type {DynamicPluginAdapter} from "../pluginAdapter"; +import type {DynamicPluginAdapter} from "../../core/pluginAdapter"; import {StaticPluginAdapter as GitAdapter} from "../../plugins/git/pluginAdapter"; import {StaticPluginAdapter as GithubAdapter} from "../../plugins/github/pluginAdapter"; diff --git a/src/app/pluginAdapter.js b/src/core/pluginAdapter.js similarity index 83% rename from src/app/pluginAdapter.js rename to src/core/pluginAdapter.js index 36d2bcc..0a67f93 100644 --- a/src/app/pluginAdapter.js +++ b/src/core/pluginAdapter.js @@ -1,7 +1,7 @@ // @flow -import type {Graph, NodeAddressT, EdgeAddressT} from "../core/graph"; -import type {Repo} from "../core/repo"; +import type {Graph, NodeAddressT, EdgeAddressT} from "./graph"; +import type {Repo} from "./repo"; export type EdgeType = {| +forwardName: string, diff --git a/src/plugins/git/pluginAdapter.js b/src/plugins/git/pluginAdapter.js index c907a3a..9e1663e 100644 --- a/src/plugins/git/pluginAdapter.js +++ b/src/plugins/git/pluginAdapter.js @@ -2,7 +2,7 @@ import type { StaticPluginAdapter as IStaticPluginAdapter, DynamicPluginAdapter as IDynamicPluginAdapter, -} from "../../app/pluginAdapter"; +} from "../../core/pluginAdapter"; import {Graph} from "../../core/graph"; import * as N from "./nodes"; import * as E from "./edges"; @@ -64,7 +64,7 @@ export class StaticPluginAdapter implements IStaticPluginAdapter { } const json = await response.json(); const graph = Graph.fromJSON(json); - return new DynamicPluginAdapter(graph); + return (new DynamicPluginAdapter(graph): IDynamicPluginAdapter); } } diff --git a/src/plugins/github/pluginAdapter.js b/src/plugins/github/pluginAdapter.js index 44ca396..10eace9 100644 --- a/src/plugins/github/pluginAdapter.js +++ b/src/plugins/github/pluginAdapter.js @@ -2,7 +2,7 @@ import type { StaticPluginAdapter as IStaticPluginAdapter, DynamicPluginAdapter as IDynamicPluginAdapater, -} from "../../app/pluginAdapter"; +} from "../../core/pluginAdapter"; import {type Graph, NodeAddress} from "../../core/graph"; import {createGraph} from "./createGraph"; import * as N from "./nodes";