5

I want to put https://github.com/timrwood/moment into my composer.json for easy maintenance.

It's not an official packagist project (of course, as it's not PHP), but it contains a packages.json for nodejs. Can I use this in my composer.json?

I tried this, but it didn't work:

{
    "repositories": {
        "timrwood/moment": {
           "type": "git",
           "url": "git://github.com/timrwood/moment.git"
        }
    }
}

It throws an error message saying "No valid composer.json was found in any branch or tag of git://github.com/timrwood/moment.git, could not load a package from it."

And it is lacking the version string to define the version I want to use...

Can anyone help here?

Or shouldn't I use composer here at all cause I'm mixing JS and PHP?

Phill Pafford
  • 83,471
  • 91
  • 263
  • 383
acme
  • 14,654
  • 7
  • 75
  • 109
  • Hav you looked into Satis? https://github.com/composer/satis and http://getcomposer.org/doc/articles/handling-private-packages-with-satis.md – Phill Pafford Nov 03 '12 at 13:54
  • Haven't tried it yet, thanks for the hint! I'll give it a try. – acme Nov 07 '12 at 07:47
  • Current composer version allows adding a `composer.json` by hand: http://getcomposer.org/doc/04-schema.md#repositories – Tgr Jun 27 '13 at 17:13

2 Answers2

3

Composer only manages composer packages. It does not know how to parse a package.json file. There are different approaches to this problem. Composer may be able to deal with frontend dependencies in the future.

For the time being I'd recommend using a separate dependency manager for your JavaScript dependencies. Either NPM or something like jam or ender.

igorw
  • 27,759
  • 5
  • 78
  • 90
  • 1
    Thanks for your answer. I tried jam, but had the problem that the repositories of jam had an old version of my needed library. So I ended up using [Bower](https://github.com/twitter/bower). – acme Sep 25 '12 at 09:44
0

Check out composer plugin to handle components via bower, nodejs and git repositories: fxpio/composer-asset-plugin.

kenorb
  • 155,785
  • 88
  • 678
  • 743
ksn135
  • 1,412
  • 1
  • 11
  • 14