ember-cli-deploy-original icon indicating copy to clipboard operation
ember-cli-deploy-original copied to clipboard

The adapter-registry does not always use a custom index-adapter

Open ghost opened this issue 11 years ago • 5 comments

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
  1. Skip registering the default ember-cli-deploy-redis-index-adapter if another index-adapter exists
  2. Remove ember-cli-deploy-redis-index-adapter from the ember-cli-deploy dependencies

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.

ghost avatar Dec 15 '14 17:12 ghost

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.

achambers avatar Dec 15 '14 21:12 achambers

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

achambers avatar Dec 15 '14 21:12 achambers

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.

ghost avatar Dec 16 '14 01:12 ghost

Ok mate. I'll have a play with it too over the next couple of days. Thanks for bringing this up.

achambers avatar Dec 16 '14 02:12 achambers

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

achambers avatar Feb 27 '15 09:02 achambers