aframevr / aframe-registry

[DISCONTINUED] Curated collection of community A-Frame components.
https://aframe.io/registry/
MIT License
77 stars 39 forks source link

How would I add a JS file that registers multiple components? #2

Closed ngokevin closed 7 years ago

ngokevin commented 8 years ago

https://github.com/ngokevin/aframe-physics-components/blob/master/dist/aframe-physics-components.js

This physics component is bundled up with physics-body and physics-world. They are coupled and are bundled with cannon.js.

cvan commented 8 years ago

I would turn url into urls and make it an array

cvan commented 8 years ago

Also, I think it might be nicer to turn this into an array of objects and have slug be a key. Or at the very least duplicate slug?

donmccurdy commented 7 years ago

Possible syntax:

aframe-physics
  - name: physics-body
    versions:
      0.3.0:
        version: <version>
        path: <path>.min.js
  - name: physics-world
    versions:
      0.3.0:
        version: <version>
        path: <path>.min.js

Array of objects has the advantage that the name of each component is specified.

But just bundling components may not be enough, similar cases could also include a system. leap-hands and aframe-extras.physics, for example.

ngokevin commented 7 years ago

That'd make sense. It'd still allow a one component per file, and we can perhaps in the future allow component packs depending on how things go.

cvan commented 7 years ago

This is the format I used for Holodeck Club's manifest.jsons.

I would suggest using the unpkg (née npmcdn) syntax (e.g., https://unpkg.com/package@version/file). You can read these notes on the syntax.

{
  "components": [
    "/common/assets/js/voice-controls.js",
    "aframe-href-component@0.5.1",
    "annyang",
    "donmccurdy/aframe-extras@master/src/primitives/a-ocean.js"
    "github:bryik/aframe-vive-cursor-component@master/aframe-vive-cursor-component.min.js",
    "github:nylki/aframe-lsystem-component",
    "https://holodeck.club/common/assets/js/lib/voice-nav.js",
    "maxkrieger/aframe-draw-component",
    "npm:mayognaise/aframe-video-shader@20.1.8"
  ]
}

Just some thoughts.

ngokevin commented 7 years ago

@donmccurdy your format looks good, i'm gonna start implementing it

donmccurdy commented 7 years ago

Great! That would be enough for me to pull a few components in from aframe-extras. Maybe three-model and ply-model. Can figure out systems another day. 🙂

ngokevin commented 7 years ago

For like the ocean component, you can either give it its own package.json + directory...or just build a dist within aframe-extras. Either way currently, needs a separate dist. Separate directory is preferred so we can give it its own README/preview image.

Yeah, need to think about systems since your physics isn't 1:1...(physics system <- body, joint, etc). It'd be awesome just to checkbox physics.

donmccurdy commented 7 years ago

👍 i just extended my build script to create dists for whitelisted components, that should fine work for ocean.

Will probably export physics to a repo, but still at least a couple components + a system involved yeah.

ngokevin commented 7 years ago

Need to figure out a way to match a component nested in github repo with a GitHub README hmm

ngokevin commented 7 years ago

@donmccurdy This seems doable:

  aframe-physics:
    names: body, dynamic-body, static-body, joint
    versions:
      0.3.0:
        version: ^1.0.0
        path: dist/aframe-physics.min.js
ngokevin commented 7 years ago

https://github.com/aframevr/aframe-registry/pull/26

donmccurdy commented 7 years ago

@ngokevin I'm late on this but what about changing names to components? Then, if/when we're ready to support systems, primitives, etc., the naming and distinction would be explicit?

ngokevin commented 7 years ago

That sounds good...I'll file an issue.