The adapter-registry does not always use a custom index-adapter
Re: comments on https://github.com/achambers/ember-cli-deploy/pull/47
When installing a custom index-adapter, the adapter-registry will only use the first index-adapter it finds. Depending on the order of dependencies inside an app's package.json, the first index-adapter may be the default ember-cli-deploy-redis-index-adapter.
This makes it difficult to install a custom index-adapter named ember-cli-deploy-***, since npm will usually save dependencies in alphabetical order.
Suggested Solutions
- Skip registering the default
ember-cli-deploy-redis-index-adapterif another index-adapter exists - Remove
ember-cli-deploy-redis-index-adapterfrom theember-cli-deploydependencies
I can create a PR once we decide upon the best solution.
Work around
Move the custom index-adapter above the ember-cli-deploy package in your ember-cli app's package.json.
I may be completely wrong here or misunderstanding the problem so please correct me if I am. And I'm writing this at 4am from my iPhone in Thailand so haven't been able to test my thoughts. But anyway...
The adapter registry first goes through this.project.addons to find any adapter you have installed in your ember-cli project. This will not (and this is where my understanding may be incorrect) find the default adapter that has been installed via the package.json in ember-cli-deploy.
If no adapter is found then it will require the default one installed by ember-cli-deploy.
That was the intention anyway. Please let me know where/if this logic is incorrect.
Thanks for your input mate.
This is based on my understanding that this.project.addons contains the ember-addon packages installed directly in the ember-cli app and not those installed in it's dependencies. Ie, the default adapter installed in node_modules inside ember-cli-deploy
Unfortunately, I believe your assumption is incorrect. From my testing, this.project.addons includes the redis-index-adapter which is only listed inside of ember-cli-deploy. I will try to create an example project later on this week to demonstrate this. I am currently using ember-cli 1.2, so maybe the behaviour is different compared to the latest version.
Ok mate. I'll have a play with it too over the next couple of days. Thanks for bringing this up.
ember-cli-deploy is in the process of merging with ember-deploy. Therefore, no more changes will be made to this repo. Please see the README for more details. /cc @neaket360pi