Skip to content

[FEAT] Update to ES6 Modules #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 34 commits into
base: master
Choose a base branch
from

Conversation

zalo
Copy link

@zalo zalo commented Feb 13, 2021

This PR updates geometry-processing-js to use the ES6 Module Syntax.

ES6 Modules offer several notable benefits. They

  • Eliminate the redundant node codebase by unifying both Browser and Node implementations
  • Significantly Improve VS Code's Intellisense and Type Hinting
  • Simplify the script import front-loading
  • Maintain the "build-less" Library paradigm
  • Maintain support in all (priorly supported) browsers

Changelist:

  1. Switch the library to ES6 Syntax.
  2. Remove the redundant "node" subdirectory.
  3. Update the examples in "Projects" to accept the new ES6 code (also updating Three.js at the same time).
  4. Update the tests, adding a Github Action to automatically run them upon each push.
  5. Moved Documentation Building into a Github Action (run on each push (for now, this can be changed)).
  6. Replaced the libs folder with a three.js CDN.

All of the examples still work:
https://zalo.github.io/geometry-processing-js/
https://zalo.github.io/geometry-processing-js/projects/geometric-flow/index.html
https://zalo.github.io/geometry-processing-js/projects/discrete-curvatures-and-normals/index.html
https://zalo.github.io/geometry-processing-js/projects/geodesic-distance/index.html
https://zalo.github.io/geometry-processing-js/projects/parameterization/index.html
https://zalo.github.io/geometry-processing-js/projects/vector-field-decomposition/index.html
https://zalo.github.io/geometry-processing-js/projects/poisson-problem/index.html
https://zalo.github.io/geometry-processing-js/projects/discrete-exterior-calculus/index.html
https://zalo.github.io/geometry-processing-js/projects/direction-field-design/index.html

The documentation rebuilds properly automatically inside of a Github Action:
https://zalo.github.io/geometry-processing-js/docs/index.html

And commits get a spiffy new checkmark when they pass the unit tests and documentation builds:
image


Note:

You'll see that "use strict"; has been removed from most files. This is because ES6 Modules are always loaded in strict mode, so it became redundant.


I took special care in preserving the overall structure and intent of the code. It is my hope that you will see these changes as an unopinionated attempt towards improving the broader accessibility and maintainability of this library.

I'm a big fan of this library and the work that you guys do. Thank you for putting this all together.
@MarkGillespie @rohan-sawhney @keenancrane @GeometryCollective

@zalo zalo marked this pull request as draft February 13, 2021 05:00
@zalo zalo marked this pull request as ready for review February 14, 2021 23:38
@rohan-sawhney
Copy link
Collaborator

@zalo Thank you for putting in all this effort! This really looks great, the dependencies in the library haven't been updated in a while. We'll test it out soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants