Skip to content

Commit

Permalink
🌵 TSconfig Update (#42)
Browse files Browse the repository at this point in the history
* Export Updates

* Import Update

* TSConfig updates

* Util Import Update

* Move Constants to Package

* Export Const Types
  • Loading branch information
demariadaniel authored Aug 23, 2024
1 parent 2735839 commit c2d3ad7
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 44 deletions.
16 changes: 11 additions & 5 deletions apps/bam.iobio/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@
*/

import clsx from 'clsx';
import IobioComponents from 'iobio-react-components';
import {
BamDisplayNames,
BamKeys,
IobioCoverageDepth,
IobioDataBroker,
IobioHistogram,
IobioPercentBox,
histogramKeys,
percentKeys,
} from 'iobio-react-components';
import type { BamContext, BamKey } from 'iobio-react-components/src/constants';
import { useEffect, useState } from 'react';
import './App.css';
import { defaultBamContext, histogramKeys, iobioURL, isOutlierKey, percentKeys } from './util';

const { IobioCoverageDepth, IobioDataBroker, IobioHistogram, IobioPercentBox, BamDisplayNames, BamKeys } =
IobioComponents;
import { defaultBamContext, iobioURL, isOutlierKey } from './util';

const colors = ['red', 'orange', 'gold', 'aquamarine', 'cornflowerblue', 'purple'];
const secondaryColors = ['lightpink', 'peachpuff', 'lemonchiffon', 'palegreen', 'powderblue', 'lavender'];
Expand Down
23 changes: 1 addition & 22 deletions apps/bam.iobio/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

import type { BamContext, BamKey } from 'components/src/constants';
import type { BamContext, BamKey } from 'iobio-react-components/src/constants';

export const iobioURL = 'https://s3.amazonaws.com/iobio/NA12878/NA12878.autsome.bam';

Expand All @@ -38,27 +38,6 @@ export const defaultBamContext = {
baseq_hist: true,
} as const satisfies BamContext;

export const histogramKeys = [
'coverage_hist',
'frag_hist',
'length_hist',
'mapq_hist',
'baseq_hist',
] as const satisfies Array<BamKey>;

export type BamHistogramKey = (typeof histogramKeys)[number];

export const percentKeys = [
'mapped_reads',
'forward_strands',
'proper_pairs',
'singletons',
'both_mates_mapped',
'duplicates',
] as const satisfies Array<BamKey>;

export type BamPercentKey = (typeof percentKeys)[number];

const ignoreOutlierKeys = ['frag_hist', 'length_hist'] as const satisfies Array<BamKey>;

type outlierKey = (typeof ignoreOutlierKeys)[number];
Expand Down
21 changes: 21 additions & 0 deletions packages/iobio-react-components/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,24 @@ export const BamDisplayNames = {
mapq_hist: 'Mapping Quality',
baseq_hist: 'Base Quality',
} as const satisfies Record<BamKey, string>;

export const histogramKeys = [
'coverage_hist',
'frag_hist',
'length_hist',
'mapq_hist',
'baseq_hist',
] as const satisfies Array<BamKey>;

export type BamHistogramKey = (typeof histogramKeys)[number];

export const percentKeys = [
'mapped_reads',
'forward_strands',
'proper_pairs',
'singletons',
'both_mates_mapped',
'duplicates',
] as const satisfies Array<BamKey>;

export type BamPercentKey = (typeof percentKeys)[number];
2 changes: 2 additions & 0 deletions packages/iobio-react-components/src/coverage_depth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ function IobioCoverageDepth({ label }: { label?: string }) {
}

export default IobioCoverageDepth;

export type IobioCoverageDepthType = typeof IobioCoverageDepth;
2 changes: 2 additions & 0 deletions packages/iobio-react-components/src/data_broker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ function IobioDataBroker({ alignmentUrl }: { alignmentUrl: string }) {
}

export default IobioDataBroker;

export type IobioDataBrokerType = typeof IobioDataBroker;
2 changes: 2 additions & 0 deletions packages/iobio-react-components/src/histogram.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ function IobioHistogram({
}

export default IobioHistogram;

export type IobioHistogramType = typeof IobioHistogram;
27 changes: 12 additions & 15 deletions packages/iobio-react-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,17 @@

import 'iobio-charts';

import { BamDisplayNames, BamKeys } from './constants.ts';
export { default as IobioCoverageDepth, type IobioCoverageDepthType } from './coverage_depth';
export { default as IobioDataBroker, type IobioDataBrokerType } from './data_broker';
export { default as IobioHistogram, type IobioHistogramType } from './histogram';
export { default as IobioPercentBox, type IobioPercentBoxType } from './percent_box';

import IobioCoverageDepth from './coverage_depth.tsx';
import IobioDataBroker from './data_broker.tsx';
import IobioHistogram from './histogram.tsx';
import IobioPercentBox from './percent_box.tsx';

const IobioComponents = {
IobioCoverageDepth,
IobioDataBroker,
IobioHistogram,
IobioPercentBox,
BamKeys,
export {
BamDisplayNames,
};

export default IobioComponents;
BamKeys,
histogramKeys,
percentKeys,
type BamHistogramKey,
type BamKey,
type BamPercentKey,
} from './constants';
2 changes: 2 additions & 0 deletions packages/iobio-react-components/src/percent_box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ function IobioPercentBox({
}

export default IobioPercentBox;

export type IobioPercentBoxType = typeof IobioPercentBox;
4 changes: 2 additions & 2 deletions packages/iobio-react-components/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
"paths": {
"iobio-charts": ["./src/iobio.d.ts"]
},
"outDir": "./dist",

/* Bundler mode */
"allowJs": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"allowImportingTsExtensions": false,
"resolveJsonModule": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
Expand Down

0 comments on commit c2d3ad7

Please sign in to comment.