Pregunta

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?

¿Fue útil?

Solución

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.

Otros consejos

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top