fxpio / composer-asset-plugin

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

no-api option does not exclude e.g. `patch` tags #227

Closed schmunk42 closed 7 years ago

schmunk42 commented 8 years ago

When running composer require bower-asset/angular and no-api to set to true the plugin scans all tags (which are thousands in this repo) instead of just the "real" versions, like currently with the GitHub API.

First run no caches filled....

[... 1000s of scans ...]
Executing command (/Users/tobias/.composer/cache/vcs/https---github.com-angular-bower-angular.git/): git log -1 --format=%at 'dac2a9b566c6a33d97326ab626f82f492724b5f9'
Writing /Users/tobias/.composer/cache/repo/https---github.com-angular-bower-angular.git/bower-dac2a9b566c6a33d97326ab626f82f492724b5f9 into cache
Importing tag v1.2.17-patch193 (1.2.17.0-patch193)
Reading bower.json of bower-asset/angular (v1.2.17-patch194)
Executing command (/Users/tobias/.composer/cache/vcs/https---github.com-angular-bower-angular.git/): git show '986aa08df3e218faf2848284e7b591d94515893f':bower.json
Executing command (/Users/tobias/.composer/cache/vcs/https---github.com-angular-bower-angular.git/): git log -1 --format=%at '986aa08df3e218faf2848284e7b591d94515893f'
Writing /Users/tobias/.composer/cache/repo/https---github.com-angular-bower-angular.git/bower-986aa08df3e218faf2848284e7b591d94515893f into cache
Importing tag v1.2.17-patch194 (1.2.17.0-patch194)
Reading bower.json of bower-asset/angular (v1.2.17-patch195)
Executing command (/Users/tobias/.composer/cache/vcs/https---github.com-angular-bower-angular.git/): git show '759dc7fa55de76a849b788e698ed6dec6bd214b5':bower.json
Executing command (/Users/tobias/.composer/cache/vcs/https---github.com-angular-bower-angular.git/): git log -1 --format=%at '759dc7fa55de76a849b788e698ed6dec6bd214b5'
Writing /Users/tobias/.composer/cache/repo/https---github.com-angular-bower-angular.git/bower-759dc7fa55de76a849b788e698ed6dec6bd214b5 into cache
Importing tag v1.2.17-patch195 (1.2.17.0-patch195)
[... 1000s of scans ...]

Expected behavior: Scan only v1.2.17 and not v1.2.17-patchXXX

Related: https://github.com/francoispluchino/composer-asset-plugin/issues/226

francoispluchino commented 8 years ago

Retest without github-no-api, because this is not this feature that cause your problem, but this commit 7f3338b433ca21ae8e8f56d4b5a82f0146242dce.

Now you must add the option asset-pattern-skip-version with (-patch), because the default value is false now

francoispluchino commented 8 years ago

I think we should put the same behavior for this option that the github-no-api option, ie: allow to set this option for each package and / or to all packages.

Because, some packages must use the patched versions.

schmunk42 commented 8 years ago

You're right, I've tested it with this:

    "extra": {
        "asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        },
        "asset-vcs-driver-options": {
            "github-no-api": true
        },
        "asset-pattern-skip-version": "(-patch)"
    }

So it's merely a documentation thing, beside the edge-case you mentioned in https://github.com/francoispluchino/composer-asset-plugin/issues/227#issuecomment-225654639

francoispluchino commented 8 years ago

I will review the documentation by adding this feature.

With the new configuration:

{
    "extra": {
        "asset-pattern-skip-version": "(-patch)"
    }
}

or

{
    "extra": {
        "asset-pattern-skip-version": {
            "default": "(-patch)",
            "packages": {
                "bower-asset/example-asset1": false,
                "bower-asset/example-asset2": "(-build)",
            }
        }
    }
}
francoispluchino commented 7 years ago

@schmunk42 I have trying with the last 1.3.0@dev version of this plugin:

{
  "require": {
    "bower-asset/angular": "^1.6.0"
  },
  "extra": {
    "asset-vcs-driver-options": {
      "github-no-api": true
    },
    "asset-pattern-skip-version": "(-patch)"
  }
}

And the -patch versions are skipped:

D:\Tests\test79>composer install --prefer-dist -v
Loading composer repositories with package information
Updating dependencies (including require-dev)
Adding VCS repository bower-asset/angular
Reading bower.json of bower-asset/angular (v1.6.0)
Importing tag v1.6.0 (1.6.0.0)
Reading bower.json of bower-asset/angular (v1.6.1)
Importing tag v1.6.1 (1.6.1.0)
Reading bower.json of bower-asset/angular (v1.6.2)
Importing tag v1.6.2 (1.6.2.0)
Dependency resolution completed in 0.000 seconds
Analyzed 70 packages to resolve dependencies
Analyzed 71 rules to resolve dependencies
Package operations: 1 install, 0 updates, 0 removals
Installs: bower-asset/angular:v1.6.2
  - Installing bower-asset/angular (v1.6.2) Loading from cache Extracting archive
Writing lock file
Generating autoload files