GMOD / jbrowse-components

Source code for JBrowse 2, a modern React-based genome browser
https://jbrowse.org/jb2
Apache License 2.0
211 stars 63 forks source link

Published npm packages .d.ts files referring to src dir #4678

Open cmdcolin opened 4 days ago

cmdcolin commented 4 days ago

see https://www.npmjs.com/package/@jbrowse/react-linear-genome-view/v/2.17.0?activeTab=code

downloading the zip is better cause viewing the code on page is slow but @jbrowse/react-linear-genome-view/dist/createViewState.d.ts

            highlight: import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType>> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType>>, [undefined]>>;

this causes confusion in the typescript compilation of embedded components

i don't know exactly why it's behaving this way

strategies to fix

possibly multiple could be investigated

strategy 1: publish src dir

one strategy to fix this is to include src dir in our published releases

pros: could fix this, can enable source maps cons: sometimes leads people to import from the src dir which is not intended usage

stategy 2: investigate why it's doing this

e.g. git bisect to see how long this has been happening?

pros: systematically uncover issue cons: hard to do

strategy 3: investigate alternative monorepo setups

our codebase alternately refers to src at dev time and dist at prod time. my hypothesis is that there is a confusion in this case

possible systems include nx and turborepo. i'm not super into nx. don't know much about turborepo. maybe there is a better usage of lerna also

pros: more 'industry standard' maybe, reduced weirdness from our src/dist swapping cons: more complexity of build tooling

cmdcolin commented 4 days ago

note that we used to publish src dirs but it was removed after overture (https://www.overture.bio/) team said it caused them trouble

cmdcolin commented 4 days ago

i think turning on skipLibCheck:true fixes this, so maybe low priority. similar skipLibCheck issue hre https://github.com/GMOD/bam-js/issues/97