hawksley / eleVR-Web-Player

A Web Player for 360 Video on the Oculus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Offer some type of distributable bundle

cvan opened this issue · comments

Though I'd be hesitant to introduce a Node + npm + Browserify stack to such a simple, straightforward project, it might be the best step forward to allow people to integrate the eleVR Web Player in their projects with minimal friction.

There could be

  • a watcher for development: every time a file is changed, the bundle would be regenerated.
  • tagged versions: whenever there are changes that are significant enough to warrant a new version of the player, a git tag (and npm version) could be published.
  • modules referenced by npm: instead of having to manually integrate third-party libraries (such as glMatrix), it'd be nice if dependencies were managed via npm (the dependencies would be referenced from the project's package.json), which would make versioning easier (and shrink the codebase in this repo).
  • a downloadable/referenceable bundle: many OSS projects have a dist/ directory, which contains the combined JS bundles, concatenated and all. every time a commit is made or a PR is merged, the dist/ directory isn't touched. only when a major version (i.e., a tag) is made is there a new version of the dist/ files created. lots of projects have like dist/bundle.js and dist/bundle.min.js. it's easier for folks to just grab these files and get up and running. (and even better would be to have some service like cdnjs.com actually host the files too, so folks can just link directly to the scripts.) a good example of this practice that comes to mind: https://github.com/jakearchibald/es6-promise

Hmm. My first intuition is that this seems kind of overkill for what is really a pretty simple project. Although, it does seem like it is slowly gravitating towards getting bigger and more complicated over time.

I guess it's also worth noting that I don't know how popular this project actually is, and what most users want. Is your intuition that this is something that most people would want?

After some discussion, I'm good with going for this. Obviously, showing up on the issues page means that it's something that at least some people want and there are definite benefits to making the player easier for people to use. :)

Was just thinking about this, and I think a good first step (or compromise) would be to introduce a basic module import system like AMD. So the <script>s in the index.html would remain as is; the only changes required that come to mind:

  1. the addition of a loader file called like amd.js
  2. js/elevr-player.js would become the main "runtime" file that loads all the necessary dependencies
  3. wrap each JS file's contents in a define(…) function call (every file except lib/gl-matrix.js which can continue to be a global)

This would help reduce exposed globals, improve circular dependency issues.

Could use something like Require.js, but it seems like overkill for this project atm. Examples of a simple AMD solution I was thinking: