diff --git a/src/app/routeData.js b/src/app/routeData.js index b9b0e63..dce5f7c 100644 --- a/src/app/routeData.js +++ b/src/app/routeData.js @@ -38,7 +38,7 @@ const routeData /*: $ReadOnlyArray */ = [ path: "/prototype/", contents: { type: "PAGE", - component: () => require("./credExplorer/App").default, + component: () => require("../explorer/App").default, }, title: "SourceCred prototype", navTitle: "Prototype", diff --git a/src/cli/load.js b/src/cli/load.js index 782a8e0..effdba7 100644 --- a/src/cli/load.js +++ b/src/cli/load.js @@ -6,7 +6,7 @@ import stringify from "json-stable-stringify"; import mkdirp from "mkdirp"; import path from "path"; -import * as RepoIdRegistry from "../app/credExplorer/repoIdRegistry"; +import * as RepoIdRegistry from "../explorer/repoIdRegistry"; import {repoIdToString, stringToRepoId, type RepoId} from "../core/repoId"; import dedent from "../util/dedent"; import type {Command} from "./command"; diff --git a/src/cli/load.test.js b/src/cli/load.test.js index 9740b63..d62f146 100644 --- a/src/cli/load.test.js +++ b/src/cli/load.test.js @@ -7,7 +7,7 @@ import tmp from "tmp"; import {run} from "./testUtil"; import load, {help} from "./load"; -import * as RepoIdRegistry from "../app/credExplorer/repoIdRegistry"; +import * as RepoIdRegistry from "../explorer/repoIdRegistry"; import {stringToRepoId} from "../core/repoId"; jest.mock("../tools/execDependencyGraph", () => jest.fn()); diff --git a/src/app/credExplorer/App.js b/src/explorer/App.js similarity index 89% rename from src/app/credExplorer/App.js rename to src/explorer/App.js index 4845dba..e8e1b4c 100644 --- a/src/app/credExplorer/App.js +++ b/src/explorer/App.js @@ -2,25 +2,25 @@ import React from "react"; -import type {Assets} from "../../webutil/assets"; -import type {LocalStore} from "../../webutil/localStore"; -import CheckedLocalStore from "../../webutil/checkedLocalStore"; -import BrowserLocalStore from "../../webutil/browserLocalStore"; -import Link from "../../webutil/Link"; +import type {Assets} from "../webutil/assets"; +import type {LocalStore} from "../webutil/localStore"; +import CheckedLocalStore from "../webutil/checkedLocalStore"; +import BrowserLocalStore from "../webutil/browserLocalStore"; +import Link from "../webutil/Link"; -import {defaultStaticAdapters} from "../adapters/defaultPlugins"; +import {defaultStaticAdapters} from "./adapters/defaultPlugins"; import {PagerankTable} from "./pagerankTable/Table"; -import type {WeightedTypes} from "../../analysis/weights"; +import type {WeightedTypes} from "../analysis/weights"; import {defaultWeightsForAdapterSet} from "./weights/weights"; import RepositorySelect from "./RepositorySelect"; -import {Prefix as GithubPrefix} from "../../plugins/github/nodes"; +import {Prefix as GithubPrefix} from "../plugins/github/nodes"; import { createStateTransitionMachine, type AppState, type StateTransitionMachineInterface, uninitializedState, } from "./state"; -import {StaticAdapterSet} from "../adapters/adapterSet"; +import {StaticAdapterSet} from "./adapters/adapterSet"; export default class AppPage extends React.Component<{|+assets: Assets|}> { static _LOCAL_STORE = new CheckedLocalStore( diff --git a/src/app/credExplorer/App.test.js b/src/explorer/App.test.js similarity index 95% rename from src/app/credExplorer/App.test.js rename to src/explorer/App.test.js index 5239c46..f72d912 100644 --- a/src/app/credExplorer/App.test.js +++ b/src/explorer/App.test.js @@ -3,23 +3,23 @@ import React from "react"; import {shallow} from "enzyme"; -import {Graph} from "../../core/graph"; -import {makeRepoId} from "../../core/repoId"; -import {Assets} from "../../webutil/assets"; -import testLocalStore from "../../webutil/testLocalStore"; -import {DynamicAdapterSet, StaticAdapterSet} from "../adapters/adapterSet"; -import {FactorioStaticAdapter} from "../../plugins/demo/appAdapter"; +import {Graph} from "../core/graph"; +import {makeRepoId} from "../core/repoId"; +import {Assets} from "../webutil/assets"; +import testLocalStore from "../webutil/testLocalStore"; +import {DynamicAdapterSet, StaticAdapterSet} from "./adapters/adapterSet"; +import {FactorioStaticAdapter} from "../plugins/demo/appAdapter"; import {defaultWeightsForAdapter} from "./weights/weights"; import RepositorySelect from "./RepositorySelect"; import {PagerankTable} from "./pagerankTable/Table"; import {createApp, LoadingIndicator} from "./App"; import {uninitializedState} from "./state"; -import {Prefix as GithubPrefix} from "../../plugins/github/nodes"; +import {Prefix as GithubPrefix} from "../plugins/github/nodes"; -require("../../webutil/testUtil").configureEnzyme(); +require("../webutil/testUtil").configureEnzyme(); -describe("app/credExplorer/App", () => { +describe("explorer/App", () => { function example() { let setState, getState; const setRepoId = jest.fn(); diff --git a/src/app/credExplorer/RepositorySelect.js b/src/explorer/RepositorySelect.js similarity index 95% rename from src/app/credExplorer/RepositorySelect.js rename to src/explorer/RepositorySelect.js index f4070af..7893fbc 100644 --- a/src/app/credExplorer/RepositorySelect.js +++ b/src/explorer/RepositorySelect.js @@ -4,12 +4,12 @@ import React, {type Node} from "react"; import sortBy from "lodash.sortby"; import deepEqual from "lodash.isequal"; -import * as NullUtil from "../../util/null"; -import type {LocalStore} from "../../webutil/localStore"; -import type {Assets} from "../../webutil/assets"; +import * as NullUtil from "../util/null"; +import type {LocalStore} from "../webutil/localStore"; +import type {Assets} from "../webutil/assets"; import {fromJSON, REPO_ID_REGISTRY_API} from "./repoIdRegistry"; -import {type RepoId, stringToRepoId, repoIdToString} from "../../core/repoId"; +import {type RepoId, stringToRepoId, repoIdToString} from "../core/repoId"; export const REPO_ID_KEY = "selectedRepository"; export type Status = diff --git a/src/app/credExplorer/RepositorySelect.test.js b/src/explorer/RepositorySelect.test.js similarity index 97% rename from src/app/credExplorer/RepositorySelect.test.js rename to src/explorer/RepositorySelect.test.js index 93c58f4..2438fd3 100644 --- a/src/app/credExplorer/RepositorySelect.test.js +++ b/src/explorer/RepositorySelect.test.js @@ -2,8 +2,8 @@ import React from "react"; import {shallow, mount} from "enzyme"; -import * as NullUtil from "../../util/null"; -import testLocalStore from "../../webutil/testLocalStore"; +import * as NullUtil from "../util/null"; +import testLocalStore from "../webutil/testLocalStore"; import RepositorySelect, { PureRepositorySelect, LocalStoreRepositorySelect, @@ -11,19 +11,19 @@ import RepositorySelect, { type Status, REPO_ID_KEY, } from "./RepositorySelect"; -import {Assets} from "../../webutil/assets"; +import {Assets} from "../webutil/assets"; import { toJSON, type RepoIdRegistry, REPO_ID_REGISTRY_API, } from "./repoIdRegistry"; -import {makeRepoId} from "../../core/repoId"; +import {makeRepoId} from "../core/repoId"; -require("../../webutil/testUtil").configureEnzyme(); -require("../../webutil/testUtil").configureAphrodite(); +require("../webutil/testUtil").configureEnzyme(); +require("../webutil/testUtil").configureAphrodite(); -describe("app/credExplorer/RepositorySelect", () => { +describe("explorer/RepositorySelect", () => { beforeEach(() => { fetch.resetMocks(); }); diff --git a/src/app/adapters/adapterSet.js b/src/explorer/adapters/adapterSet.js similarity index 100% rename from src/app/adapters/adapterSet.js rename to src/explorer/adapters/adapterSet.js diff --git a/src/app/adapters/adapterSet.test.js b/src/explorer/adapters/adapterSet.test.js similarity index 99% rename from src/app/adapters/adapterSet.test.js rename to src/explorer/adapters/adapterSet.test.js index 5eeea71..478d654 100644 --- a/src/app/adapters/adapterSet.test.js +++ b/src/explorer/adapters/adapterSet.test.js @@ -12,7 +12,7 @@ import { import {Assets} from "../../webutil/assets"; import {makeRepoId} from "../../core/repoId"; -describe("app/adapters/adapterSet", () => { +describe("explorer/adapters/adapterSet", () => { describe("StaticAdapterSet", () => { function example() { const x = new FactorioStaticAdapter(); diff --git a/src/app/adapters/appAdapter.js b/src/explorer/adapters/appAdapter.js similarity index 100% rename from src/app/adapters/appAdapter.js rename to src/explorer/adapters/appAdapter.js diff --git a/src/app/adapters/defaultPlugins.js b/src/explorer/adapters/defaultPlugins.js similarity index 100% rename from src/app/adapters/defaultPlugins.js rename to src/explorer/adapters/defaultPlugins.js diff --git a/src/app/adapters/fallbackAdapter.js b/src/explorer/adapters/fallbackAdapter.js similarity index 87% rename from src/app/adapters/fallbackAdapter.js rename to src/explorer/adapters/fallbackAdapter.js index 568e0e6..b9c57a5 100644 --- a/src/app/adapters/fallbackAdapter.js +++ b/src/explorer/adapters/fallbackAdapter.js @@ -1,10 +1,7 @@ // @flow import {fallbackDeclaration} from "../../analysis/fallbackDeclaration"; -import type { - StaticAppAdapter, - DynamicAppAdapter, -} from "../../app/adapters/appAdapter"; +import type {StaticAppAdapter, DynamicAppAdapter} from "./appAdapter"; import {Assets} from "../../webutil/assets"; import {type RepoId} from "../../core/repoId"; import {Graph, NodeAddress, type NodeAddressT} from "../../core/graph"; @@ -28,7 +25,7 @@ export class FallbackDynamicAdapter implements DynamicAppAdapter { return `[fallback]: ${NodeAddress.toString(x)}`; } - static() { + static(): FallbackStaticAdapter { return new FallbackStaticAdapter(); } } diff --git a/src/app/credExplorer/pagerankTable/Aggregation.js b/src/explorer/pagerankTable/Aggregation.js similarity index 96% rename from src/app/credExplorer/pagerankTable/Aggregation.js rename to src/explorer/pagerankTable/Aggregation.js index acad041..81c0cd4 100644 --- a/src/app/credExplorer/pagerankTable/Aggregation.js +++ b/src/explorer/pagerankTable/Aggregation.js @@ -1,9 +1,9 @@ // @flow import React from "react"; -import * as NullUtil from "../../../util/null"; +import * as NullUtil from "../../util/null"; -import type {NodeAddressT} from "../../../core/graph"; +import type {NodeAddressT} from "../../core/graph"; import {ConnectionRowList} from "./Connection"; import {aggregateFlat, type FlatAggregation, aggregationKey} from "./aggregate"; diff --git a/src/app/credExplorer/pagerankTable/Aggregation.test.js b/src/explorer/pagerankTable/Aggregation.test.js similarity index 95% rename from src/app/credExplorer/pagerankTable/Aggregation.test.js rename to src/explorer/pagerankTable/Aggregation.test.js index b8f3e95..c575804 100644 --- a/src/app/credExplorer/pagerankTable/Aggregation.test.js +++ b/src/explorer/pagerankTable/Aggregation.test.js @@ -3,9 +3,9 @@ import React from "react"; import {shallow} from "enzyme"; -import * as NullUtil from "../../../util/null"; -import {NodeAddress, EdgeAddress} from "../../../core/graph"; -import type {EdgeType, NodeType} from "../../../analysis/types"; +import * as NullUtil from "../../util/null"; +import {NodeAddress, EdgeAddress} from "../../core/graph"; +import type {EdgeType, NodeType} from "../../analysis/types"; import { AggregationRowList, AggregationRow, @@ -16,11 +16,11 @@ import {Badge} from "./shared"; import {example} from "./sharedTestUtils"; import {aggregateFlat, type FlatAggregation} from "./aggregate"; import {TableRow} from "./TableRow"; -import {nodes as factorioNodes} from "../../../plugins/demo/graph"; +import {nodes as factorioNodes} from "../../plugins/demo/graph"; -require("../../../webutil/testUtil").configureEnzyme(); +require("../../webutil/testUtil").configureEnzyme(); -describe("app/credExplorer/pagerankTable/Aggregation", () => { +describe("explorer/pagerankTable/Aggregation", () => { describe("AggregationRowList", () => { it("instantiates AggregationRows for each aggregation", async () => { const {adapters, pnd} = await example(); diff --git a/src/app/credExplorer/pagerankTable/Connection.js b/src/explorer/pagerankTable/Connection.js similarity index 90% rename from src/app/credExplorer/pagerankTable/Connection.js rename to src/explorer/pagerankTable/Connection.js index ecedba9..de031cf 100644 --- a/src/app/credExplorer/pagerankTable/Connection.js +++ b/src/explorer/pagerankTable/Connection.js @@ -1,12 +1,12 @@ // @flow import React from "react"; -import * as NullUtil from "../../../util/null"; +import * as NullUtil from "../../util/null"; -import type {NodeAddressT} from "../../../core/graph"; -import type {Connection} from "../../../core/attribution/graphToMarkovChain"; -import type {ScoredConnection} from "../../../analysis/pagerankNodeDecomposition"; -import {DynamicAdapterSet} from "../../adapters/adapterSet"; +import type {NodeAddressT} from "../../core/graph"; +import type {Connection} from "../../core/attribution/graphToMarkovChain"; +import type {ScoredConnection} from "../../analysis/pagerankNodeDecomposition"; +import {DynamicAdapterSet} from "../adapters/adapterSet"; import {TableRow} from "./TableRow"; import {NodeRow} from "./Node"; diff --git a/src/app/credExplorer/pagerankTable/Connection.test.js b/src/explorer/pagerankTable/Connection.test.js similarity index 96% rename from src/app/credExplorer/pagerankTable/Connection.test.js rename to src/explorer/pagerankTable/Connection.test.js index 1994845..55fd1ae 100644 --- a/src/app/credExplorer/pagerankTable/Connection.test.js +++ b/src/explorer/pagerankTable/Connection.test.js @@ -2,18 +2,18 @@ import React from "react"; import {shallow} from "enzyme"; -import * as NullUtil from "../../../util/null"; +import * as NullUtil from "../../util/null"; -import type {Connection} from "../../../core/attribution/graphToMarkovChain"; +import type {Connection} from "../../core/attribution/graphToMarkovChain"; import {ConnectionRowList, ConnectionRow, ConnectionView} from "./Connection"; import {example} from "./sharedTestUtils"; import {TableRow} from "./TableRow"; import {NodeRow} from "./Node"; -import {nodes as factorioNodes} from "../../../plugins/demo/graph"; +import {nodes as factorioNodes} from "../../plugins/demo/graph"; -require("../../../webutil/testUtil").configureEnzyme(); +require("../../webutil/testUtil").configureEnzyme(); -describe("app/credExplorer/pagerankTable/Connection", () => { +describe("explorer/pagerankTable/Connection", () => { describe("ConnectionRowList", () => { async function setup(maxEntriesPerList: number = 100000) { const {adapters, pnd} = await example(); diff --git a/src/app/credExplorer/pagerankTable/Node.js b/src/explorer/pagerankTable/Node.js similarity index 94% rename from src/app/credExplorer/pagerankTable/Node.js rename to src/explorer/pagerankTable/Node.js index b1617f2..ebcf82b 100644 --- a/src/app/credExplorer/pagerankTable/Node.js +++ b/src/explorer/pagerankTable/Node.js @@ -2,9 +2,9 @@ import React from "react"; import sortBy from "lodash.sortby"; -import * as NullUtil from "../../../util/null"; +import * as NullUtil from "../../util/null"; -import {type NodeAddressT} from "../../../core/graph"; +import {type NodeAddressT} from "../../core/graph"; import {TableRow} from "./TableRow"; import {nodeDescription, type SharedProps} from "./shared"; diff --git a/src/app/credExplorer/pagerankTable/Node.test.js b/src/explorer/pagerankTable/Node.test.js similarity index 95% rename from src/app/credExplorer/pagerankTable/Node.test.js rename to src/explorer/pagerankTable/Node.test.js index a25071f..db1c940 100644 --- a/src/app/credExplorer/pagerankTable/Node.test.js +++ b/src/explorer/pagerankTable/Node.test.js @@ -3,20 +3,20 @@ import React from "react"; import {shallow} from "enzyme"; import sortBy from "lodash.sortby"; -import * as NullUtil from "../../../util/null"; +import * as NullUtil from "../../util/null"; import {TableRow} from "./TableRow"; import {AggregationRowList} from "./Aggregation"; -import type {NodeAddressT} from "../../../core/graph"; +import type {NodeAddressT} from "../../core/graph"; import {nodeDescription} from "./shared"; import {example} from "./sharedTestUtils"; import {NodeRowList, NodeRow, type NodeRowProps} from "./Node"; -import {nodes as factorioNodes} from "../../../plugins/demo/graph"; +import {nodes as factorioNodes} from "../../plugins/demo/graph"; -require("../../../webutil/testUtil").configureEnzyme(); +require("../../webutil/testUtil").configureEnzyme(); -describe("app/credExplorer/pagerankTable/Node", () => { +describe("explorer/pagerankTable/Node", () => { describe("NodeRowList", () => { function sortedByScore(nodes: $ReadOnlyArray, pnd) { return sortBy(nodes, (node) => -NullUtil.get(pnd.get(node)).score); diff --git a/src/app/credExplorer/pagerankTable/Table.js b/src/explorer/pagerankTable/Table.js similarity index 90% rename from src/app/credExplorer/pagerankTable/Table.js rename to src/explorer/pagerankTable/Table.js index 5a61f40..4766590 100644 --- a/src/app/credExplorer/pagerankTable/Table.js +++ b/src/explorer/pagerankTable/Table.js @@ -2,14 +2,14 @@ import React from "react"; import sortBy from "lodash.sortby"; -import * as NullUtil from "../../../util/null"; +import * as NullUtil from "../../util/null"; -import {type NodeAddressT, NodeAddress} from "../../../core/graph"; -import type {PagerankNodeDecomposition} from "../../../analysis/pagerankNodeDecomposition"; -import {DynamicAdapterSet} from "../../adapters/adapterSet"; -import type {DynamicAppAdapter} from "../../adapters/appAdapter"; -import {FALLBACK_NAME} from "../../../analysis/fallbackDeclaration"; -import type {WeightedTypes} from "../../../analysis/weights"; +import {type NodeAddressT, NodeAddress} from "../../core/graph"; +import type {PagerankNodeDecomposition} from "../../analysis/pagerankNodeDecomposition"; +import {DynamicAdapterSet} from "../adapters/adapterSet"; +import type {DynamicAppAdapter} from "../adapters/appAdapter"; +import {FALLBACK_NAME} from "../../analysis/fallbackDeclaration"; +import type {WeightedTypes} from "../../analysis/weights"; import {WeightConfig} from "../weights/WeightConfig"; import {NodeRowList} from "./Node"; diff --git a/src/app/credExplorer/pagerankTable/Table.test.js b/src/explorer/pagerankTable/Table.test.js similarity index 96% rename from src/app/credExplorer/pagerankTable/Table.test.js rename to src/explorer/pagerankTable/Table.test.js index 1833d71..71f662f 100644 --- a/src/app/credExplorer/pagerankTable/Table.test.js +++ b/src/explorer/pagerankTable/Table.test.js @@ -3,17 +3,17 @@ import React from "react"; import {shallow} from "enzyme"; -import {NodeAddress, type NodeAddressT} from "../../../core/graph"; +import {NodeAddress, type NodeAddressT} from "../../core/graph"; import {PagerankTable} from "./Table"; import {example, COLUMNS} from "./sharedTestUtils"; import {NodeRowList} from "./Node"; import {WeightConfig} from "../weights/WeightConfig"; import {defaultWeightsForAdapter} from "../weights/weights"; -import {FactorioStaticAdapter} from "../../../plugins/demo/appAdapter"; +import {FactorioStaticAdapter} from "../../plugins/demo/appAdapter"; -require("../../../webutil/testUtil").configureEnzyme(); -describe("app/credExplorer/pagerankTable/Table", () => { +require("../../webutil/testUtil").configureEnzyme(); +describe("explorer/pagerankTable/Table", () => { describe("PagerankTable", () => { async function setup(defaultNodeFilter?: NodeAddressT) { const {pnd, adapters, weightedTypes} = await example(); diff --git a/src/app/credExplorer/pagerankTable/TableRow.js b/src/explorer/pagerankTable/TableRow.js similarity index 100% rename from src/app/credExplorer/pagerankTable/TableRow.js rename to src/explorer/pagerankTable/TableRow.js diff --git a/src/app/credExplorer/pagerankTable/TableRow.test.js b/src/explorer/pagerankTable/TableRow.test.js similarity index 98% rename from src/app/credExplorer/pagerankTable/TableRow.test.js rename to src/explorer/pagerankTable/TableRow.test.js index 0d7335b..a501e42 100644 --- a/src/app/credExplorer/pagerankTable/TableRow.test.js +++ b/src/explorer/pagerankTable/TableRow.test.js @@ -5,9 +5,9 @@ import {shallow} from "enzyme"; import {TableRow, PaddingRow} from "./TableRow"; import {COLUMNS} from "./sharedTestUtils"; -require("../../../webutil/testUtil").configureEnzyme(); +require("../../webutil/testUtil").configureEnzyme(); -describe("app/credExplorer/pagerankTable/TableRow", () => { +describe("explorer/pagerankTable/TableRow", () => { function example() { return shallow( ; diff --git a/src/app/credExplorer/pagerankTable/aggregate.test.js b/src/explorer/pagerankTable/aggregate.test.js similarity index 98% rename from src/app/credExplorer/pagerankTable/aggregate.test.js rename to src/explorer/pagerankTable/aggregate.test.js index 20ca1cc..ab65e92 100644 --- a/src/app/credExplorer/pagerankTable/aggregate.test.js +++ b/src/explorer/pagerankTable/aggregate.test.js @@ -1,7 +1,7 @@ // @flow -import {EdgeAddress, NodeAddress} from "../../../core/graph"; -import * as NullUtil from "../../../util/null"; +import {EdgeAddress, NodeAddress} from "../../core/graph"; +import * as NullUtil from "../../util/null"; import { aggregateByNodeType, aggregateByConnectionType, @@ -10,7 +10,7 @@ import { aggregationKey, } from "./aggregate"; -describe("app/credExplorer/pagerankTable/aggregate", () => { +describe("explorer/pagerankTable/aggregate", () => { // TODO: If making major modifications to these tests, consider switching // from the hand-maintained connections and types, and instead use the demo // adadpters from app/adapters/demoAdapters diff --git a/src/app/credExplorer/pagerankTable/shared.js b/src/explorer/pagerankTable/shared.js similarity index 88% rename from src/app/credExplorer/pagerankTable/shared.js rename to src/explorer/pagerankTable/shared.js index c9c0b97..ee95842 100644 --- a/src/app/credExplorer/pagerankTable/shared.js +++ b/src/explorer/pagerankTable/shared.js @@ -5,11 +5,11 @@ import { type EdgeAddressT, type NodeAddressT, NodeAddress, -} from "../../../core/graph"; +} from "../../core/graph"; -import {DynamicAdapterSet} from "../../adapters/adapterSet"; +import {DynamicAdapterSet} from "../adapters/adapterSet"; -import type {PagerankNodeDecomposition} from "../../../analysis/pagerankNodeDecomposition"; +import type {PagerankNodeDecomposition} from "../../analysis/pagerankNodeDecomposition"; export function nodeDescription( address: NodeAddressT, diff --git a/src/app/credExplorer/pagerankTable/sharedTestUtils.js b/src/explorer/pagerankTable/sharedTestUtils.js similarity index 79% rename from src/app/credExplorer/pagerankTable/sharedTestUtils.js rename to src/explorer/pagerankTable/sharedTestUtils.js index 38ef0cd..b86d078 100644 --- a/src/app/credExplorer/pagerankTable/sharedTestUtils.js +++ b/src/explorer/pagerankTable/sharedTestUtils.js @@ -1,8 +1,8 @@ // @flow -import {pagerank} from "../../../analysis/pagerank"; +import {pagerank} from "../../analysis/pagerank"; import {defaultWeightsForAdapterSet} from "../weights/weights"; -import {dynamicAdapterSet} from "../../../plugins/demo/appAdapter"; +import {dynamicAdapterSet} from "../../plugins/demo/appAdapter"; export const COLUMNS = () => ["Description", "", "Cred"]; diff --git a/src/app/credExplorer/repoIdRegistry.js b/src/explorer/repoIdRegistry.js similarity index 89% rename from src/app/credExplorer/repoIdRegistry.js rename to src/explorer/repoIdRegistry.js index d7565f9..f7edb7e 100644 --- a/src/app/credExplorer/repoIdRegistry.js +++ b/src/explorer/repoIdRegistry.js @@ -4,8 +4,8 @@ // and is read by the RepositorySelect component // (src/app/credExplorer/RepositorySelect.js) import deepEqual from "lodash.isequal"; -import {toCompat, fromCompat, type Compatible} from "../../util/compat"; -import type {RepoId} from "../../core/repoId"; +import {toCompat, fromCompat, type Compatible} from "../util/compat"; +import type {RepoId} from "../core/repoId"; export const REPO_ID_REGISTRY_FILE = "repositoryRegistry.json"; export const REPO_ID_REGISTRY_API = "/api/v1/data/repositoryRegistry.json"; diff --git a/src/app/credExplorer/repoIdRegistry.test.js b/src/explorer/repoIdRegistry.test.js similarity index 91% rename from src/app/credExplorer/repoIdRegistry.test.js rename to src/explorer/repoIdRegistry.test.js index 2d4a8dc..dd21564 100644 --- a/src/app/credExplorer/repoIdRegistry.test.js +++ b/src/explorer/repoIdRegistry.test.js @@ -8,10 +8,10 @@ import { type RepoIdRegistry, } from "./repoIdRegistry"; -import {makeRepoId} from "../../core/repoId"; +import {makeRepoId} from "../core/repoId"; -describe("app/credExplorer/repoIdRegistry", () => { - describe("to/fromJSON compose on", () => { +describe("explorer/repoIdRegistry", () => { + describe("fromJSON compose on", () => { function checkExample(x: RepoIdRegistry) { expect(fromJSON(toJSON(x))).toEqual(x); expect(toJSON(fromJSON(toJSON(x)))).toEqual(toJSON(x)); diff --git a/src/app/credExplorer/state.js b/src/explorer/state.js similarity index 93% rename from src/app/credExplorer/state.js rename to src/explorer/state.js index cefdc36..f7477bc 100644 --- a/src/app/credExplorer/state.js +++ b/src/explorer/state.js @@ -2,19 +2,19 @@ import deepEqual from "lodash.isequal"; -import {Graph, type NodeAddressT} from "../../core/graph"; -import type {Assets} from "../../webutil/assets"; -import type {RepoId} from "../../core/repoId"; -import {type EdgeEvaluator} from "../../analysis/pagerank"; +import {Graph, type NodeAddressT} from "../core/graph"; +import type {Assets} from "../webutil/assets"; +import type {RepoId} from "../core/repoId"; +import {type EdgeEvaluator} from "../analysis/pagerank"; import { type PagerankNodeDecomposition, type PagerankOptions, pagerank, -} from "../../analysis/pagerank"; +} from "../analysis/pagerank"; -import {StaticAdapterSet, DynamicAdapterSet} from "../adapters/adapterSet"; -import type {WeightedTypes} from "../../analysis/weights"; -import {weightsToEdgeEvaluator} from "../../analysis/weightsToEdgeEvaluator"; +import {StaticAdapterSet, DynamicAdapterSet} from "./adapters/adapterSet"; +import type {WeightedTypes} from "../analysis/weights"; +import {weightsToEdgeEvaluator} from "../analysis/weightsToEdgeEvaluator"; /* This models the UI states of the credExplorer/App as a state machine. diff --git a/src/app/credExplorer/state.test.js b/src/explorer/state.test.js similarity index 96% rename from src/app/credExplorer/state.test.js rename to src/explorer/state.test.js index 1e71981..93b0e92 100644 --- a/src/app/credExplorer/state.test.js +++ b/src/explorer/state.test.js @@ -7,20 +7,20 @@ import { type GraphWithAdapters, } from "./state"; -import {Graph, NodeAddress} from "../../core/graph"; -import {Assets} from "../../webutil/assets"; -import {makeRepoId, type RepoId} from "../../core/repoId"; -import {type EdgeEvaluator} from "../../analysis/pagerank"; -import type {WeightedTypes} from "../../analysis/weights"; +import {Graph, NodeAddress} from "../core/graph"; +import {Assets} from "../webutil/assets"; +import {makeRepoId, type RepoId} from "../core/repoId"; +import {type EdgeEvaluator} from "../analysis/pagerank"; +import type {WeightedTypes} from "../analysis/weights"; import {defaultWeightsForAdapterSet} from "./weights/weights"; -import {StaticAdapterSet, DynamicAdapterSet} from "../adapters/adapterSet"; +import {StaticAdapterSet, DynamicAdapterSet} from "./adapters/adapterSet"; import type { PagerankNodeDecomposition, PagerankOptions, -} from "../../analysis/pagerank"; -import {staticAdapterSet} from "../../plugins/demo/appAdapter"; +} from "../analysis/pagerank"; +import {staticAdapterSet} from "../plugins/demo/appAdapter"; -describe("app/credExplorer/state", () => { +describe("explorer/state", () => { function example(startingState: AppState) { const stateContainer = {appState: startingState}; const getState = () => stateContainer.appState; diff --git a/src/app/credExplorer/weights/EdgeTypeConfig.js b/src/explorer/weights/EdgeTypeConfig.js similarity index 96% rename from src/app/credExplorer/weights/EdgeTypeConfig.js rename to src/explorer/weights/EdgeTypeConfig.js index e0a279e..1490afb 100644 --- a/src/app/credExplorer/weights/EdgeTypeConfig.js +++ b/src/explorer/weights/EdgeTypeConfig.js @@ -3,7 +3,7 @@ import React from "react"; import {WeightSlider, type Props as WeightSliderProps} from "./WeightSlider"; -import type {WeightedEdgeType} from "../../../analysis/weights"; +import type {WeightedEdgeType} from "../../analysis/weights"; export class EdgeTypeConfig extends React.Component<{ +weightedType: WeightedEdgeType, diff --git a/src/app/credExplorer/weights/EdgeTypeConfig.test.js b/src/explorer/weights/EdgeTypeConfig.test.js similarity index 93% rename from src/app/credExplorer/weights/EdgeTypeConfig.test.js rename to src/explorer/weights/EdgeTypeConfig.test.js index 21ea86d..f9e5401 100644 --- a/src/app/credExplorer/weights/EdgeTypeConfig.test.js +++ b/src/explorer/weights/EdgeTypeConfig.test.js @@ -5,11 +5,11 @@ import {shallow} from "enzyme"; import {WeightSlider} from "./WeightSlider"; import {EdgeTypeConfig, EdgeWeightSlider} from "./EdgeTypeConfig"; -import {assemblesEdgeType} from "../../../plugins/demo/declaration"; +import {assemblesEdgeType} from "../../plugins/demo/declaration"; -require("../../../webutil/testUtil").configureEnzyme(); +require("../../webutil/testUtil").configureEnzyme(); -describe("app/credExplorer/weights/EdgeTypeConfig", () => { +describe("explorer/weights/EdgeTypeConfig", () => { describe("EdgeTypeConfig", () => { function example() { const onChange = jest.fn(); diff --git a/src/app/credExplorer/weights/NodeTypeConfig.js b/src/explorer/weights/NodeTypeConfig.js similarity index 89% rename from src/app/credExplorer/weights/NodeTypeConfig.js rename to src/explorer/weights/NodeTypeConfig.js index 6a22c7f..4ebba5c 100644 --- a/src/app/credExplorer/weights/NodeTypeConfig.js +++ b/src/explorer/weights/NodeTypeConfig.js @@ -2,7 +2,7 @@ import React from "react"; import {WeightSlider} from "./WeightSlider"; -import type {WeightedNodeType} from "../../../analysis/weights"; +import type {WeightedNodeType} from "../../analysis/weights"; export class NodeTypeConfig extends React.Component<{ +weightedType: WeightedNodeType, diff --git a/src/app/credExplorer/weights/NodeTypeConfig.test.js b/src/explorer/weights/NodeTypeConfig.test.js similarity index 85% rename from src/app/credExplorer/weights/NodeTypeConfig.test.js rename to src/explorer/weights/NodeTypeConfig.test.js index 71e5d3e..f288f61 100644 --- a/src/app/credExplorer/weights/NodeTypeConfig.test.js +++ b/src/explorer/weights/NodeTypeConfig.test.js @@ -5,11 +5,11 @@ import {shallow} from "enzyme"; import {WeightSlider} from "./WeightSlider"; import {NodeTypeConfig} from "./NodeTypeConfig"; -import {inserterNodeType} from "../../../plugins/demo/declaration"; +import {inserterNodeType} from "../../plugins/demo/declaration"; -require("../../../webutil/testUtil").configureEnzyme(); +require("../../webutil/testUtil").configureEnzyme(); -describe("app/credExplorer/weights/NodeTypeConfig", () => { +describe("explorer/weights/NodeTypeConfig", () => { describe("NodeTypeConfig", () => { function example() { const onChange = jest.fn(); diff --git a/src/app/credExplorer/weights/PluginWeightConfig.js b/src/explorer/weights/PluginWeightConfig.js similarity index 95% rename from src/app/credExplorer/weights/PluginWeightConfig.js rename to src/explorer/weights/PluginWeightConfig.js index df4ddd2..aa413c5 100644 --- a/src/app/credExplorer/weights/PluginWeightConfig.js +++ b/src/explorer/weights/PluginWeightConfig.js @@ -2,16 +2,16 @@ import React from "react"; import deepEqual from "lodash.isequal"; -import * as MapUtil from "../../../util/map"; +import * as MapUtil from "../../util/map"; import {NodeTypeConfig} from "./NodeTypeConfig"; import {EdgeTypeConfig} from "./EdgeTypeConfig"; -import {StaticAppAdapter} from "../../adapters/appAdapter"; +import {StaticAppAdapter} from "../adapters/appAdapter"; import {styledVariable} from "./EdgeTypeConfig"; import type { WeightedTypes, WeightedEdgeType, WeightedNodeType, -} from "../../../analysis/weights"; +} from "../../analysis/weights"; export type Props = {| +adapter: StaticAppAdapter, diff --git a/src/app/credExplorer/weights/PluginWeightConfig.test.js b/src/explorer/weights/PluginWeightConfig.test.js similarity index 93% rename from src/app/credExplorer/weights/PluginWeightConfig.test.js rename to src/explorer/weights/PluginWeightConfig.test.js index 94f5916..392f603 100644 --- a/src/app/credExplorer/weights/PluginWeightConfig.test.js +++ b/src/explorer/weights/PluginWeightConfig.test.js @@ -6,24 +6,24 @@ import {PluginWeightConfig} from "./PluginWeightConfig"; import { inserterNodeType, assemblesEdgeType, -} from "../../../plugins/demo/declaration"; -import {FactorioStaticAdapter} from "../../../plugins/demo/appAdapter"; +} from "../../plugins/demo/declaration"; +import {FactorioStaticAdapter} from "../../plugins/demo/appAdapter"; import { fallbackNodeType, fallbackEdgeType, -} from "../../../analysis/fallbackDeclaration"; +} from "../../analysis/fallbackDeclaration"; import {NodeTypeConfig} from "./NodeTypeConfig"; import {EdgeTypeConfig} from "./EdgeTypeConfig"; import { type WeightedTypes, defaultWeightedNodeType, defaultWeightedEdgeType, -} from "../../../analysis/weights"; +} from "../../analysis/weights"; import {defaultWeightsForAdapter} from "./weights"; -require("../../../webutil/testUtil").configureEnzyme(); +require("../../webutil/testUtil").configureEnzyme(); -describe("app/credExplorer/weights/PluginWeightConfig", () => { +describe("explorer/weights/PluginWeightConfig", () => { describe("PluginWeightConfig", () => { function example() { const onChange = jest.fn(); diff --git a/src/app/credExplorer/weights/WeightConfig.js b/src/explorer/weights/WeightConfig.js similarity index 88% rename from src/app/credExplorer/weights/WeightConfig.js rename to src/explorer/weights/WeightConfig.js index fd400a6..6381284 100644 --- a/src/app/credExplorer/weights/WeightConfig.js +++ b/src/explorer/weights/WeightConfig.js @@ -1,13 +1,13 @@ // @flow import React from "react"; -import * as NullUtil from "../../../util/null"; -import * as MapUtil from "../../../util/map"; +import * as NullUtil from "../../util/null"; +import * as MapUtil from "../../util/map"; -import type {StaticAdapterSet} from "../../adapters/adapterSet"; -import type {WeightedTypes} from "../../../analysis/weights"; +import type {StaticAdapterSet} from "../adapters/adapterSet"; +import type {WeightedTypes} from "../../analysis/weights"; import {PluginWeightConfig} from "./PluginWeightConfig"; -import {FALLBACK_NAME} from "../../../analysis/fallbackDeclaration"; +import {FALLBACK_NAME} from "../../analysis/fallbackDeclaration"; type Props = {| +adapters: StaticAdapterSet, diff --git a/src/app/credExplorer/weights/WeightConfig.test.js b/src/explorer/weights/WeightConfig.test.js similarity index 91% rename from src/app/credExplorer/weights/WeightConfig.test.js rename to src/explorer/weights/WeightConfig.test.js index 80d509f..79a8126 100644 --- a/src/app/credExplorer/weights/WeightConfig.test.js +++ b/src/explorer/weights/WeightConfig.test.js @@ -6,15 +6,15 @@ import {PluginWeightConfig} from "./PluginWeightConfig"; import { FactorioStaticAdapter, staticAdapterSet, -} from "../../../plugins/demo/appAdapter"; -import {inserterNodeType} from "../../../plugins/demo/declaration"; -import {FALLBACK_NAME} from "../../../analysis/fallbackDeclaration"; +} from "../../plugins/demo/appAdapter"; +import {inserterNodeType} from "../../plugins/demo/declaration"; +import {FALLBACK_NAME} from "../../analysis/fallbackDeclaration"; import {defaultWeightsForAdapterSet, defaultWeightsForAdapter} from "./weights"; import {WeightConfig} from "./WeightConfig"; -require("../../../webutil/testUtil").configureEnzyme(); +require("../../webutil/testUtil").configureEnzyme(); -describe("app/credExplorer/weights/WeightConfig", () => { +describe("explorer/weights/WeightConfig", () => { describe("WeightConfig", () => { function example() { const onChange = jest.fn(); diff --git a/src/app/credExplorer/weights/WeightSlider.js b/src/explorer/weights/WeightSlider.js similarity index 100% rename from src/app/credExplorer/weights/WeightSlider.js rename to src/explorer/weights/WeightSlider.js diff --git a/src/app/credExplorer/weights/WeightSlider.test.js b/src/explorer/weights/WeightSlider.test.js similarity index 94% rename from src/app/credExplorer/weights/WeightSlider.test.js rename to src/explorer/weights/WeightSlider.test.js index 01fd5b1..a44e36b 100644 --- a/src/app/credExplorer/weights/WeightSlider.test.js +++ b/src/explorer/weights/WeightSlider.test.js @@ -5,9 +5,9 @@ import {shallow} from "enzyme"; import {WeightSlider, formatWeight} from "./WeightSlider"; -require("../../../webutil/testUtil").configureEnzyme(); +require("../../webutil/testUtil").configureEnzyme(); -describe("app/credExplorer/weights/WeightSlider", () => { +describe("explorer/weights/WeightSlider", () => { describe("WeightSlider", () => { function example() { const onChange = jest.fn(); diff --git a/src/app/credExplorer/weights/__snapshots__/EdgeTypeConfig.test.js.snap b/src/explorer/weights/__snapshots__/EdgeTypeConfig.test.js.snap similarity index 77% rename from src/app/credExplorer/weights/__snapshots__/EdgeTypeConfig.test.js.snap rename to src/explorer/weights/__snapshots__/EdgeTypeConfig.test.js.snap index 5d68057..6836344 100644 --- a/src/app/credExplorer/weights/__snapshots__/EdgeTypeConfig.test.js.snap +++ b/src/explorer/weights/__snapshots__/EdgeTypeConfig.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`app/credExplorer/weights/EdgeTypeConfig EdgeWeightSlider renders the name along with some Greek characters 1`] = ` +exports[`explorer/weights/EdgeTypeConfig EdgeWeightSlider renders the name along with some Greek characters 1`] = ` { +describe("explorer/weights/weights", () => { describe("defaultWeightsForAdapter", () => { it("works on the demo adapter", () => { const adapter = new FactorioStaticAdapter(); diff --git a/src/plugins/demo/appAdapter.js b/src/plugins/demo/appAdapter.js index 32ba6da..ce64d58 100644 --- a/src/plugins/demo/appAdapter.js +++ b/src/plugins/demo/appAdapter.js @@ -5,8 +5,8 @@ import {declaration} from "./declaration"; import type { StaticAppAdapter, DynamicAppAdapter, -} from "../../app/adapters/appAdapter"; -import {StaticAdapterSet} from "../../app/adapters/adapterSet"; +} from "../../explorer/adapters/appAdapter"; +import {StaticAdapterSet} from "../../explorer/adapters/adapterSet"; import {Assets} from "../../webutil/assets"; import {type RepoId, makeRepoId} from "../../core/repoId"; import {NodeAddress, type NodeAddressT} from "../../core/graph"; @@ -17,7 +17,7 @@ export class FactorioStaticAdapter implements StaticAppAdapter { declaration(): PluginDeclaration { return declaration; } - async load(assets: Assets, repoId: RepoId): Promise { + async load(assets: Assets, repoId: RepoId) { const result: FactorioDynamicAdapter = new FactorioDynamicAdapter(); if (this.loadingMock) { return this.loadingMock(assets, repoId).then(() => result); @@ -33,7 +33,7 @@ export class FactorioDynamicAdapter implements DynamicAppAdapter { nodeDescription(x: NodeAddressT) { return `[factorio]: ${NodeAddress.toString(x)}`; } - static() { + static(): FactorioStaticAdapter { return new FactorioStaticAdapter(); } } diff --git a/src/plugins/git/appAdapter.js b/src/plugins/git/appAdapter.js index 81ce0ab..4c9ce8a 100644 --- a/src/plugins/git/appAdapter.js +++ b/src/plugins/git/appAdapter.js @@ -2,7 +2,7 @@ import type { StaticAppAdapter as IStaticAppAdapter, DynamicAppAdapter as IDynamicAppAdapter, -} from "../../app/adapters/appAdapter"; +} from "../../explorer/adapters/appAdapter"; import {Graph} from "../../core/graph"; import * as N from "./nodes"; import {description} from "./render"; diff --git a/src/plugins/github/appAdapter.js b/src/plugins/github/appAdapter.js index 74d470f..1577822 100644 --- a/src/plugins/github/appAdapter.js +++ b/src/plugins/github/appAdapter.js @@ -4,7 +4,7 @@ import pako from "pako"; import type { StaticAppAdapter as IStaticAppAdapter, DynamicAppAdapter as IDynamicAppAdapter, -} from "../../app/adapters/appAdapter"; +} from "../../explorer/adapters/appAdapter"; import {type Graph, NodeAddress} from "../../core/graph"; import {createGraph} from "./createGraph"; import * as N from "./nodes";