UC-Davis-molecular-computing / scadnano

Web application for designing DNA structures such as DNA origami.
https://scadnano.org
MIT License
21 stars 13 forks source link

use npm/yarn/something more modern for using Javascript libraries #346

Open dave-doty opened 4 years ago

dave-doty commented 4 years ago

Currently, all third-party Javascript libraries are in web/external-libs and are imported in web/index.html:

<script src="external-libs/simpledrag.js"></script>
<script src="splitpane.js"></script>

<script src="packages/react/react.js"></script>
<script src="packages/react/react_dom.js"></script>

<script src="external-libs/svg-pan-zoom.js"></script>
<script src="external-libs/hammer.min.js"></script>

<script src="external-libs/react-bootstrap.js"></script>

Each of these is a single file that creates global variables. This works but is not current recommended practice for Javascript.

There's a more modern way of installing and importing Javascript libraries, using npm, or yarn. (or both? I don't really understand them very well.) For instance, the react-svg-pan-zoom has them as two options for installing.

This will give a simpler way to update packages and avoid namespace collisions, and also some libraries (such as react-svg-pan-zoom) don't even have the option to include one giant file with global variables.

UnHumbleBen commented 3 years ago

I had difficulty finding resources for how to incorporate npm packages into dart applications. Many answers I found seem to suggest that there is no way to do this and it is not recommended.

dave-doty commented 3 years ago

I had difficulty finding resources for how to incorporate npm packages into dart applications. Many answers I found seem to suggest that there is no way to do this and it is not recommended.

That's disappointing. I'm surprised the Dart team is so behind on that.