简体   繁体   中英

Which package service provides the repository for Bower?

Behind the dependency manager for PHP Composer works with the PHP package archive service Packagist . So when I want to defind Zend Framework 2 as a package, my project depends on, I use the syntax developer/package :

composer.json

{
    "name": "Project Name",
    "description": "Project Description",
    "require": {
        "php": ">=5.3.23",
        "zendframework/zendframework": ">=2.3.2,<3.0.0",
        ...
    }
    ...
}

Then I run composer install and looks in the Packagist archive for the packges, I defined as dependencies.

Now the Bower :

I can define the dependencies in the bower.json and get them with bower init or load them directly with bower install <package> . In both cases the package can be defined as a GitHub address or any URL ( http://sld.tld/file.js ), but also in form of developer/package ( bower install angular/angular.js ) or even just package ( bower install jquery ).

What is Bower's "Packagist"? Which package service provides the package repository for Bower?

The mapping between the package name and the repository holding the package content is done by the Bower registry .
By default the Bower client will use the public Bower registry - http://bower.herokuapp.com .
To register a new package in the registry you need to use the bower register command as described here .

You create the package in GitHub by going into your GitHub repo and creating a release. This release number will be the number that will show up in the bower.json file when you do bower install --save . Bower expects you to use semver http://semver.org/ and will interpret your release numbers appropriately.

When you do bower register it will look for a match in the number between the GitHub repo and your bower.json file and warn you if they do not match.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM