amazon-sumerian-hosts icon indicating copy to clipboard operation
amazon-sumerian-hosts copied to clipboard

[WIP] Convert to vanilla JavaScript modules (ES Modules)

Open trusktr opened this issue 1 year ago • 3 comments

[!NOTE] This is branched off of the branch for

  • #180

See that PR first. For convenience, here's the diff between the branches, as the Files changed will not be as useful.

Description

Converts examples to JavaScript (ES) modules, and imports all libraries via import syntax (except for AWS which is still a global var from a non-module script).

This is WIP, all examples and integration tests load, but Babylon demos have a break from Babylon 5 (see below). We also need to

  • [x] Ensure unit tests work
  • [x] Delete build tools and associated files like webpack.config.js because we're not building the source anymore (unless we still need them for Karma unit tests)
    • deleted webpack config, it wasn't needed for Karma test runner at all.
  • [x] Update release scripts and package.json fields accordingly
  • [x] Update start-* scripts so they open a particular example's folder (similar to what webpack dev server was doing)
  • [x] Ensure the docs build works
  • [x] Ensure any documentation is updated accordingly
  • [ ] Fix breakage from Babylon upgrade. This pull request relies on Babylon 5+ for its publishing of JavaScript modules so that we can import them, but it breaks the character animations, which we will need to fix:
    • Tracking issue: https://github.com/aws-samples/amazon-sumerian-hosts/issues/155
    • Babylon team has provided clues to solving the issue here: https://forum.babylonjs.com/t/models-broken-when-updating-from-v4-to-v5/43758

Related Issue #

  • Closes #182

Reviewer Testing Instructions

  • npm install
  • then npx live-server . at the root of the repo to start a static web server,
  • this opens your browser tab automatically
  • then navigate to any example and it will work (no more build! Future issues like https://github.com/aws-samples/amazon-sumerian-hosts/pull/181 will never happen! We'll be fully aligned with standards then we can optimize from there. 🎉).

Submission Checklist

I confirm that I have...

  • [x] removed hard-coded Cognito IDs
  • [x] manually smoke-tested the BabylonJS integration tests
  • [x] manually smoke-tested the BabylonJS demos (note breaking change in the TODO list above)
  • [x] manually smoke-tested the Three.js integration tests
  • [x] manually smoke-tested the Three.js demo

This contribution is licensed under the original MIT-0 license of the repository. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

trusktr avatar Sep 06 '23 01:09 trusktr

very interested in this. maybe double check "removed hard-coded Cognito IDs". good work.

theVoiceMouse avatar Oct 02 '23 00:10 theVoiceMouse

At this point, ESM changes are complete, and this is representative of the new repo format in every way. We just need to apply the fix for Babylon's animation API.

trusktr avatar Oct 11 '23 23:10 trusktr

very interested in this. maybe double check "removed hard-coded Cognito IDs". good work.

@theVoiceMouse Thanks! Indeed, I'll squash this, and I'll void that key and make myself a new one. :)

trusktr avatar Oct 11 '23 23:10 trusktr