composer/composer — pull request #3078 by nsams (2014-06-27 06:14:05+00:00)
Title: Bower

(copy of post to composer-dev mailing list to reach larger audience)

I want to manage javascript dependencies for my projects.

As far as I can see possible options are:

1. Don't use composer for that, use an external tool eg. bower
- inconvenient install (composer install + bower install is required
- additional dependencies (you need node+bower)
- composer packages can't have bower dependencies (that's the big issue for me)

2. Put javascript dependencies into shim composer packages
- doesn't allow usage of existing bower infrastructure
- requires quite some effort

3. integrate bower into composer
- would re-use the existing composer infrastructure
- would support composer.lock (which is very important for me)

Related Discussion: https://github.com/composer/composer/issues/1121

I implemented a first prototype for (3) where I created a BowerRepository similar
to PearRepository that allows installing bower packages. (This is still work in progress and has many rough edges - I just want to get early feedback)

Example usage:

$ cat composer.json
{
"repositories": [
{
"type": "bower",
"url": "http://bower.herokuapp.com"
}
],
"require": {
"bower/jquery": "1.11.*",
"bower/backbone": "*"
}
}

$ ../composer/bin/composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing bower/jquery (1.11.1)
Loading from cache

- Installing bower/underscore (1.6.0)
Loading from cache

- Installing bower/backbone (1.1.2)
Loading from cache

Writing lock file
Generating autoload files

Now my question is if this is a good idea that you are willing to integrate into composer.
Or any other thoughts you might have about this...