Skip to content

Commit

Permalink
Remove index.ts files (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored Sep 6, 2023
1 parent b533b33 commit f8e22f9
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 26 deletions.
4 changes: 3 additions & 1 deletion src/components/GraphViewport.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Component } from 'react';

import { renderSvg, TypeGraph, Viewport } from './../graph/';
import { renderSvg } from '../graph/svg-renderer';
import { TypeGraph } from '../graph/type-graph';
import { Viewport } from '../graph/viewport';
import LoadingAnimation from './utils/LoadingAnimation';
import { VoyagerDisplayOptions } from './Voyager';

Expand Down
5 changes: 3 additions & 2 deletions src/components/Voyager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import {
useState,
} from 'react';

import { getTypeGraph } from '../graph/';
import { extractTypeName, getSchema, typeNameToId } from '../introspection';
import { getTypeGraph } from '../graph/type-graph';
import { getSchema } from '../introspection/introspection';
import { extractTypeName, typeNameToId } from '../introspection/utils';
import { MaybePromise, usePromise } from '../utils/usePromise';
import DocExplorer from './doc-explorer/DocExplorer';
import GraphViewport from './GraphViewport';
Expand Down
2 changes: 1 addition & 1 deletion src/components/doc-explorer/DocExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './DocExplorer.css';
import { assertCompositeType, GraphQLNamedType } from 'graphql/type';
import { Component } from 'react';

import { isNode, TypeGraph } from '../../graph';
import { isNode, TypeGraph } from '../../graph/type-graph';
import { extractTypeName, typeObjToId } from '../../introspection/utils';
import SearchBox from '../utils/SearchBox';
import FocusTypeButton from './FocusTypeButton';
Expand Down
3 changes: 2 additions & 1 deletion src/components/doc-explorer/OtherSearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { GraphQLNamedType } from 'graphql/type';

import { TypeGraph } from '../../graph/type-graph';
import { mapFields } from '../../introspection/utils';
import { highlightTerm, isMatch } from '../../utils';
import { highlightTerm } from '../../utils/highlight';
import { isMatch } from '../../utils/is-match';

interface OtherSearchResultsProps {
typeGraph: TypeGraph;
Expand Down
3 changes: 2 additions & 1 deletion src/components/doc-explorer/TypeDoc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
mapInterfaces,
mapPossibleTypes,
} from '../../introspection/utils';
import { highlightTerm, isMatch } from '../../utils';
import { highlightTerm } from '../../utils/highlight';
import { isMatch } from '../../utils/is-match';
import Markdown from '../utils/Markdown';
import Argument from './Argument';
import Description from './Description';
Expand Down
2 changes: 1 addition & 1 deletion src/components/doc-explorer/TypeLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
isSpecifiedScalarType,
} from 'graphql/type';

import { highlightTerm } from '../../utils';
import { highlightTerm } from '../../utils/highlight';

interface TypeLinkProps {
type: GraphQLNamedType;
Expand Down
2 changes: 1 addition & 1 deletion src/components/doc-explorer/TypeList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './TypeList.css';
import { GraphQLNamedType } from 'graphql/type';

import { TypeGraph } from '../../graph/type-graph';
import { isMatch } from '../../utils';
import { isMatch } from '../../utils/is-match';
import Description from './Description';
import FocusTypeButton from './FocusTypeButton';
import TypeLink from './TypeLink';
Expand Down
1 change: 0 additions & 1 deletion src/components/index.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/settings/RootSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import MenuItem from '@mui/material/MenuItem';
import Select from '@mui/material/Select';
import { GraphQLNamedType } from 'graphql/type';

import { isNode, TypeGraph } from '../../graph/';
import { isNode, TypeGraph } from '../../graph/type-graph';

interface RootSelectorProps {
typeGraph: TypeGraph;
Expand Down
2 changes: 1 addition & 1 deletion src/components/settings/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Checkbox from '@mui/material/Checkbox';

import { TypeGraph } from '../../graph';
import { TypeGraph } from '../../graph/type-graph';
import { VoyagerDisplayOptions } from '../Voyager';
import RootSelector from './RootSelector';

Expand Down
4 changes: 0 additions & 4 deletions src/graph/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/graph/svg-renderer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { VoyagerDisplayOptions } from '../components/Voyager';
import { stringToSvg } from '../utils/';
import { stringToSvg } from '../utils/dom-helpers';
import { getDot } from './dot';
import { VizWorker } from './graphviz-worker';
import { TypeGraph } from './type-graph';
Expand Down
4 changes: 2 additions & 2 deletions src/graph/viewport.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as svgPanZoom from 'svg-pan-zoom';

import { typeNameToId } from '../introspection';
import { stringToSvg } from '../utils/';
import { typeNameToId } from '../introspection/utils';
import { stringToSvg } from '../utils/dom-helpers';

// FIXME: we are waiting for this [PR](https://github.com/ariutta/svg-pan-zoom/pull/379), after that this two interfaces might be removed in favor to `import { Instance, Point } from 'svg-pan-zoom'`
interface Point {
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as Voyager, type VoyagerProps } from './components/Voyager';
export { voyagerIntrospectionQuery } from './utils/introspection-query';
2 changes: 0 additions & 2 deletions src/index.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/introspection/index.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/utils/index.ts → src/utils/is-match.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
export * from './dom-helpers';
export * from './highlight';

export function isMatch(sourceText: string, searchValue: string | null) {
if (!searchValue) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function buildWebpackConfig(env: Env): any {
if (env.lib === true) {
return {
...baseConfig,
entry: './src/index.tsx',
entry: './src/index.ts',
externals: NodeExternals(),
output: {
...baseConfig.output,
Expand Down

0 comments on commit f8e22f9

Please sign in to comment.