fxpio / composer-asset-plugin

NPM/Bower Dependency Manager for Composer
MIT License
893 stars 156 forks source link

Asset package cache #215

Closed pelmennoteam closed 7 years ago

pelmennoteam commented 8 years ago

Due to the fact that I have to work with a large number of projects using Yii, and use of this plugin is a part of the deployment of the platform, waiting for the end of downloading all packages may take up to 40 minutes (bower uses github api and each time requests all pages with tags, eg package "bower-asset/angular" requests approximately 30 pages).

This service caches information about the packages and gives the already formed json file that accelerates project update.

You can specify your own cache server (http://source.0daysolution.ru/open-source/assagist) for each package type (npm or bower) using the config (default: http://assagist.0daysolution.ru/packages/{bower,npm}/%package%):

{
    "config": {
        "assagist-cache-bower-url": "http://example.com/packages/bower/%package%",
        "assagist-cache-npm-url" "http://example.com/packages/npm/%package%"
    }
}

Also you can enable/disable use of cache server (default: false):

{
    "config": {
        "assagist-cache-use": false
    }
}
francoispluchino commented 8 years ago

Please make tests (with 100% coverage) and respect the coding format with php-cs-fixer.

francoispluchino commented 8 years ago

After I see that this is a specific server using a non-secure URL, which is a problem. Furthermore, it is better to have a generic system. As it stands, I cannot merge this PR.

pelmennoteam commented 8 years ago

You mean that this plugin can't use an external cache server?

francoispluchino commented 8 years ago

No, I say that the implementation in the plugin should be generic, allowing to configure a cache (with composer.phar global config --editor), and adding a dependency to this cache (with composer.phar global require assagist/composer-asset-plugin-cache). Currently, your proposal to add a 'hard coding' cache directly in in the plugin is not correct.

I think we should have an interface in the plugin allowing to implement any type of cache.

pelmennoteam commented 8 years ago

Use of a cache server can be enabled or disabled via composer config --global --editor

{
    "config": {
        "assagist-cache-use": false
    }
}

It is not necessary for creating another plugin only for a cache (as i can understand you). But i agree with you. I'll try to implement 'a more generic system' soon.

pelmennoteam commented 8 years ago

I've made some changes. Can you merge this PR?

francoispluchino commented 8 years ago

I will see this PR tomorrow.

pelmennoteam commented 8 years ago

Ok. Thanks!

francoispluchino commented 8 years ago

Can you create a new PR for the doc, thanks.

francoispluchino commented 8 years ago

Thanks to rebase your PR for keep only one commit.

pelmennoteam commented 8 years ago

Ok. I'll do it tonight.

pelmennoteam commented 8 years ago

Done

francoispluchino commented 8 years ago

Thanks to create the doc for build a package cache in a new PR. I will do some modification to comply to PSR-1 and PSR-2. Otherwise, at first glance, it's ok for me.

francoispluchino commented 8 years ago

Do you think to have the time to make changes quickly? I will soon freeze the features for the version 1.2.

pelmennoteam commented 8 years ago

What changes I need to do?

schmunk42 commented 8 years ago

Concerning downloads (not API requests and dependency resolution) we use this plugin with great success: https://github.com/hirak/prestissimo

francoispluchino commented 7 years ago

@pelmennoteam I close this PR because the changes are still not present, and the use of the Prestissimo Composer plugin allows a non-negligible gain of performance.