Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Composer install .git or .hg directories with package files?

I'm trying to publish composer package. I saved composer.json in my package directory:

{
    "name": "vendor_name/my_bundle",
    "type": "symfony-bundle",
    "autoload": {
        "psr-0": {
            "VendorName\\MyBundle": ""
        }
    },
    "target-dir": "VendorName/MyBundle"
}

But when I install it (composer update), with package files will added .hg directory.

Similar behaviour can be seen in this package: https://packagist.org/packages/tom32i/file-bundle (with package files will added .git directory: http://joxi.ru/uploads/prod/20130201/560/53a/136c5290b3c0f4c6f6318445f358d1d8cf30fe13.png)

like image 283
F_Z_14 Avatar asked Feb 01 '13 10:02

F_Z_14


People also ask

Where does Composer get packages from?

Composer will look in all your repositories to find the packages your project requires. By default, only the Packagist.org repository is registered in Composer. You can add more repositories to your project by declaring them in composer. json .

Where are Composer dependencies defined?

To start using Composer in your project, all you need is a composer. json file. This file describes the dependencies of your project and may contain other metadata as well. It typically should go in the top-most directory of your project/VCS repository.


1 Answers

Quote from the documentation:

There are two ways of downloading a package: source and dist. For stable versions composer will use the dist by default. The source is a version control repository.

The package you mentioned has no stable version, so composer downloads the source from git. Use --prefer-dist if you'd like composer to download package files (only happens if possible).

like image 183
Jakub Zalas Avatar answered Oct 28 '22 02:10

Jakub Zalas