Easy way to toggle isDevelopingAddon


#1

I often do this, https://github.com/ember-cli/ember-cli-eslint/issues/14. Forgot to set isDevelopingAddon to false before publishing. Is there any easy way to make isDevelopingAddon to true only when I do npm link to test it in the host app and false in all other situation (CI, publish etc.,)


#2

No, not that I know of, though we could probably make that a really nice experience out of the box. Either by detecting that the addon is linked or via a specific environment variable. Seems like a fun project to hack on if someone wants to pick it up … :smiley_cat:


#3

Yeah, this API is on my hitlist.

It doesn’t really make sense to ask every addon “do you want to be in development mode?”. That’s not really up to each addon, it’s up to the person setting up the application.


#4

Thanks @rwjblue and @ef4

it’s up to the person setting up the application

if we want to live-reload addon changes, then we have to make it as developing in host app?

or is it fine if we just make this property true internally when npm linked?


#5

I think both are acceptable designs for a new API.

I like using npm link best because the intent expressed by doing that is almost exactly the right intent anyway. I can’t think of a common use case where someone would either NPM-link without wanting dev or want dev without NPM linking (monorepos tend to use links internally, so they would be covered).


#6

Are you talking about in-repo addons? Is ember-cli really using npm link to integrate them internally? Otherwise that might be an use case where you don’t use npm link but need to toggle isDevelopingAddon sometimes.


#7

In-repo-addons definitely should always be in development mode regardless.

But I was talking about projects that use something like https://lernajs.io/ to have one (or many) apps and also a collection of addons all in one repo.


#8

oh my g.o.s.h. that would be amazing. +100 to this idea.


#9

Or add an .isDevelopingAddon file in the project we can gitignore.