Move core plugin adapter code to its own directory (#632)
This commit creates the directory `src/app/adapters` and moves the following three files into it: - `src/app/pluginAdapter.js` - `src/app/pluginAdapter.test.js` - `src/app/defaultPlugins.js` This is in preparation for a principled fix for #631, which will add a base plugin and some logic that ensures it's always included.
This commit is contained in:
parent
3eb2b6eec6
commit
d8db763257
|
@ -1,8 +1,8 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import type {StaticPluginAdapter} from "./pluginAdapter";
|
import type {StaticPluginAdapter} from "./pluginAdapter";
|
||||||
import {StaticPluginAdapter as GitAdapter} from "../plugins/git/pluginAdapter";
|
import {StaticPluginAdapter as GitAdapter} from "../../plugins/git/pluginAdapter";
|
||||||
import {StaticPluginAdapter as GithubAdapter} from "../plugins/github/pluginAdapter";
|
import {StaticPluginAdapter as GithubAdapter} from "../../plugins/github/pluginAdapter";
|
||||||
|
|
||||||
export function defaultStaticAdapters(): $ReadOnlyArray<StaticPluginAdapter> {
|
export function defaultStaticAdapters(): $ReadOnlyArray<StaticPluginAdapter> {
|
||||||
return [new GitAdapter(), new GithubAdapter()];
|
return [new GitAdapter(), new GithubAdapter()];
|
|
@ -6,8 +6,8 @@ import {
|
||||||
EdgeAddress,
|
EdgeAddress,
|
||||||
type NodeAddressT,
|
type NodeAddressT,
|
||||||
type EdgeAddressT,
|
type EdgeAddressT,
|
||||||
} from "../core/graph";
|
} from "../../core/graph";
|
||||||
import type {Repo} from "../core/repo";
|
import type {Repo} from "../../core/repo";
|
||||||
|
|
||||||
export type EdgeType = {|
|
export type EdgeType = {|
|
||||||
+forwardName: string,
|
+forwardName: string,
|
|
@ -5,7 +5,7 @@ import {
|
||||||
NodeAddress,
|
NodeAddress,
|
||||||
EdgeAddress,
|
EdgeAddress,
|
||||||
type NodeAddressT,
|
type NodeAddressT,
|
||||||
} from "../core/graph";
|
} from "../../core/graph";
|
||||||
import {
|
import {
|
||||||
type StaticPluginAdapter,
|
type StaticPluginAdapter,
|
||||||
type DynamicPluginAdapter,
|
type DynamicPluginAdapter,
|
||||||
|
@ -17,7 +17,7 @@ import {
|
||||||
findEdgeType,
|
findEdgeType,
|
||||||
} from "./pluginAdapter";
|
} from "./pluginAdapter";
|
||||||
|
|
||||||
describe("app/pluginAdapter", () => {
|
describe("app/adapters/pluginAdapter", () => {
|
||||||
function example() {
|
function example() {
|
||||||
const staticFooAdapter: StaticPluginAdapter = {
|
const staticFooAdapter: StaticPluginAdapter = {
|
||||||
name: () => "foo",
|
name: () => "foo",
|
|
@ -14,7 +14,7 @@ import {type EdgeEvaluator} from "../../core/attribution/pagerank";
|
||||||
import {byEdgeType, byNodeType} from "./edgeWeights";
|
import {byEdgeType, byNodeType} from "./edgeWeights";
|
||||||
import * as MapUtil from "../../util/map";
|
import * as MapUtil from "../../util/map";
|
||||||
import * as NullUtil from "../../util/null";
|
import * as NullUtil from "../../util/null";
|
||||||
import {defaultStaticAdapters} from "../defaultPlugins";
|
import {defaultStaticAdapters} from "../adapters/defaultPlugins";
|
||||||
|
|
||||||
type Props = {|
|
type Props = {|
|
||||||
+localStore: LocalStore,
|
+localStore: LocalStore,
|
||||||
|
|
|
@ -6,7 +6,7 @@ import * as NullUtil from "../../../util/null";
|
||||||
import type {NodeAddressT} from "../../../core/graph";
|
import type {NodeAddressT} from "../../../core/graph";
|
||||||
import type {Connection} from "../../../core/attribution/graphToMarkovChain";
|
import type {Connection} from "../../../core/attribution/graphToMarkovChain";
|
||||||
import type {ScoredConnection} from "../../../core/attribution/pagerankNodeDecomposition";
|
import type {ScoredConnection} from "../../../core/attribution/pagerankNodeDecomposition";
|
||||||
import type {DynamicPluginAdapter} from "../../pluginAdapter";
|
import type {DynamicPluginAdapter} from "../../adapters/pluginAdapter";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
edgeVerb,
|
edgeVerb,
|
||||||
|
|
|
@ -5,7 +5,7 @@ import sortBy from "lodash.sortby";
|
||||||
|
|
||||||
import {type NodeAddressT, NodeAddress} from "../../../core/graph";
|
import {type NodeAddressT, NodeAddress} from "../../../core/graph";
|
||||||
import type {PagerankNodeDecomposition} from "../../../core/attribution/pagerankNodeDecomposition";
|
import type {PagerankNodeDecomposition} from "../../../core/attribution/pagerankNodeDecomposition";
|
||||||
import type {DynamicPluginAdapter} from "../../pluginAdapter";
|
import type {DynamicPluginAdapter} from "../../adapters/pluginAdapter";
|
||||||
|
|
||||||
import {NodeRowList} from "./Node";
|
import {NodeRowList} from "./Node";
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import sortBy from "lodash.sortby";
|
import sortBy from "lodash.sortby";
|
||||||
import {NodeAddress, edgeToString} from "../../../core/graph";
|
import {NodeAddress, edgeToString} from "../../../core/graph";
|
||||||
import {NodeTrie, EdgeTrie} from "../../../core/trie";
|
import {NodeTrie, EdgeTrie} from "../../../core/trie";
|
||||||
import type {NodeType, EdgeType} from "../../pluginAdapter";
|
import type {NodeType, EdgeType} from "../../adapters/pluginAdapter";
|
||||||
import type {ScoredConnection} from "../../../core/attribution/pagerankNodeDecomposition";
|
import type {ScoredConnection} from "../../../core/attribution/pagerankNodeDecomposition";
|
||||||
|
|
||||||
// Sorted by descending `summary.score`
|
// Sorted by descending `summary.score`
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
dynamicDispatchByNode,
|
dynamicDispatchByNode,
|
||||||
dynamicDispatchByEdge,
|
dynamicDispatchByEdge,
|
||||||
findEdgeType,
|
findEdgeType,
|
||||||
} from "../../pluginAdapter";
|
} from "../../adapters/pluginAdapter";
|
||||||
|
|
||||||
export function nodeDescription(
|
export function nodeDescription(
|
||||||
address: NodeAddressT,
|
address: NodeAddressT,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import {Graph, NodeAddress, EdgeAddress} from "../../../core/graph";
|
import {Graph, NodeAddress, EdgeAddress} from "../../../core/graph";
|
||||||
|
|
||||||
import type {DynamicPluginAdapter} from "../../pluginAdapter";
|
import type {DynamicPluginAdapter} from "../../adapters/pluginAdapter";
|
||||||
import {pagerank} from "../../../core/attribution/pagerank";
|
import {pagerank} from "../../../core/attribution/pagerank";
|
||||||
|
|
||||||
export const COLUMNS = () => ["Description", "Connection", "Score"];
|
export const COLUMNS = () => ["Description", "Connection", "Score"];
|
||||||
|
|
|
@ -12,9 +12,9 @@ import {
|
||||||
pagerank,
|
pagerank,
|
||||||
} from "../../core/attribution/pagerank";
|
} from "../../core/attribution/pagerank";
|
||||||
|
|
||||||
import type {DynamicPluginAdapter} from "../pluginAdapter";
|
import type {DynamicPluginAdapter} from "../adapters/pluginAdapter";
|
||||||
|
|
||||||
import {defaultStaticAdapters} from "../defaultPlugins";
|
import {defaultStaticAdapters} from "../adapters/defaultPlugins";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This models the UI states of the credExplorer/App as a state machine.
|
This models the UI states of the credExplorer/App as a state machine.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import type {
|
import type {
|
||||||
StaticPluginAdapter as IStaticPluginAdapter,
|
StaticPluginAdapter as IStaticPluginAdapter,
|
||||||
DynamicPluginAdapter as IDynamicPluginAdapter,
|
DynamicPluginAdapter as IDynamicPluginAdapter,
|
||||||
} from "../../app/pluginAdapter";
|
} from "../../app/adapters/pluginAdapter";
|
||||||
import {Graph} from "../../core/graph";
|
import {Graph} from "../../core/graph";
|
||||||
import * as N from "./nodes";
|
import * as N from "./nodes";
|
||||||
import * as E from "./edges";
|
import * as E from "./edges";
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import type {
|
import type {
|
||||||
StaticPluginAdapter as IStaticPluginAdapter,
|
StaticPluginAdapter as IStaticPluginAdapter,
|
||||||
DynamicPluginAdapter as IDynamicPluginAdapater,
|
DynamicPluginAdapter as IDynamicPluginAdapater,
|
||||||
} from "../../app/pluginAdapter";
|
} from "../../app/adapters/pluginAdapter";
|
||||||
import {type Graph, NodeAddress} from "../../core/graph";
|
import {type Graph, NodeAddress} from "../../core/graph";
|
||||||
import {createGraph} from "./createGraph";
|
import {createGraph} from "./createGraph";
|
||||||
import * as N from "./nodes";
|
import * as N from "./nodes";
|
||||||
|
|
Loading…
Reference in New Issue