ebi-webcomponents / protvista-uniprot

The ProtVista tool for the UniProt website
MIT License
12 stars 6 forks source link

Generate modules #34

Closed xwatkins closed 3 years ago

xwatkins commented 3 years ago

Reference to existing issue

ES modules were not transpiled (and tsconfig file was ignored as transpilation to commonjs was happening in babel).

Description of changes

Added a script to use the TypeScript compiler and transpile the .ts files. Target is es2019 because of the use of flat(), I checked browsers on caniuse and I believe it should be ok

Testing/Styleguide

aurel-l commented 3 years ago

I don't think it's caused by this PR, but now that it's generating definitions it got a previous issue more visible. In the generated index.d.ts we get:

import ProtvistaUniprot from './protvista-uniprot';
export declare const transformDataFeatureAdapter: typeof ProtvistaUniprot;
export declare const transformDataProteomicsAdapter: typeof ProtvistaUniprot;
export declare const transformDataStructureAdapter: typeof ProtvistaUniprot;
export declare const transformDataVariationAdapter: typeof ProtvistaUniprot;
export declare const transformDataInterproAdapter: typeof ProtvistaUniprot;
export default ProtvistaUniprot;

I think there's an issue here as the adapters shouldn't be the same type as component itself.

It might be coming from https://github.com/ebi-webcomponents/protvista-uniprot/blob/master/src/index.ts#L7-L11 , those should probably be named imports, otherwise they pick up the default export from that file