ember-cli: ember install doesn't correctly update bower.json when using multiple addBowerPackageToProject calls in afterInstall hook in addon blueprint

I discovered a bug related to the afterInstall hook in the blueprint for an addon. If there are multiple addBowerPackageToProject calls, all dependencies will be installed, but only one will be added to bower.json. As a result, after installing an addon and committing the dependency update, another developer will not receive the required dependencies when working on a shared repository.

Using addBowerPackagesToProject, and adding them all in a single call does work as expected, but I would also expect separate individual calls to have the same behavior, and there can be use cases where calling them separately would be preferred.

I prepared a simple addon which attempts to add two bower dependencies to demonstrate the bug.

Steps to reproduce:

ember new foo
cd foo
ember install https://github.com/eliasdawson/ember-cli-bower-bug-demo.git
ember g ember-cli-bower-bug-demo

Expected:

lodash and moment are installed in bower_components and bower.json is updated to list both lodash and moment as dependencies.

Actual:

Both dependencies are installed but only one is added to bower.json

This bug was discovered using ember-cli 2.5.0, but reproduced with 2.11.0


Output from ember version --verbose && npm --version:

ember-cli: 2.11.0
http_parser: 2.7.0
node: 6.9.5
v8: 5.1.281.89
uv: 1.9.1
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 57.1
modules: 48
openssl: 1.0.2k
os: darwin x64
3.10.10

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (13 by maintainers)

Most upvoted comments

we also have addBowerPackagesToProject that can do multiple for you FYI