5
votes

I've created my first Ember CLI addon by following the instructions from the Ember CLI homepage. The addon works fine and it already has a couple of stars on Github: https://github.com/lolmaus/ember-cli-stained-by-children

The problem is that it's impossible to use the addon without Ember CLI, for example, on http://emberjs.jsbin.com/ .

I've seen other addons that don't have such a limitation: the library is implemented as a Bower package that can be used with or without Ember CLI, and also an Ember CLI addon wrapper is provided.

An example of such an addon is Simple Auth.

It has three repositories:

But it's hard to take example from those because Simple Auth is a huge library.

The questions are:

  1. How do i organize the main source code so that i can build different library types from it (global and Ember CLI-friendly AMD)?
  2. How do i organize the Ember CLI wrapper code? What should i do in it in order to leverage the library?
  3. How do i automate releases?
1
this blog post talks some at the bottom how to create an ember cli package that also can be used without ember cli also pixelhandler.com/posts/…flylib

1 Answers

1
votes

There are multiple approaches to your problem so how your code should be organized is up to you. Right now, there's no simple build pipeline to generate a globals-based version, AMD version and addon in a single go. If you really want to achieve all of the above I'd say start by writing a (simple) globals-based version, then make a build script which wraps that in a AMD wrapper. Then wrap that AMD version in an addon.