Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bower not picking up versioned dependency #312

Open
MrPetovan opened this issue Jan 27, 2018 · 10 comments
Open

Bower not picking up versioned dependency #312

MrPetovan opened this issue Jan 27, 2018 · 10 comments

Comments

@MrPetovan
Copy link

Related to #311

Since https://github.com/friendica/friendica already has the npm-asset/jquery:^1.11.4 dependency and we are using the same asset directory for both repositories, I tried importing bower-asset/jquery-2.x to satisfy a new Bower dependency.

However, Bower went on and still installed bower-asset/jquery:^3.3 which overwrote /vendor/asset-folder/jquery.

How can I direct bower to use the versioned dependency for subsequent imports?

It could look something like:

{
    "config": {
        "fxp-asset": {
            "satisfies": {
                "bower-asset/jquery-2.x": "bower-asset/jquery"
            }
        }
    }
}
@francoispluchino
Copy link
Member

This is not possible because it's the Solver SAT of the Composer that is responsible to resolve the dependencies, and that the bower-asset/ and npm-asset/ are 2 different vendors.

@MrPetovan
Copy link
Author

I believe this is a different question, here the vendors are the same for both sides of the satisfy config clause.

@francoispluchino
Copy link
Member

Did you try the resolution section?

@MrPetovan
Copy link
Author

MrPetovan commented Feb 19, 2018

I saw it but I don't think it is relevant to my problem.

Expanded explanation:

  • I already required npm-asset/jquery:^1 and it is sitting in vendor/asset/jquery.
  • If I want to require a bower-asset package with a dependency on jQuery 2, a simple require will import bower-asset:jquery:^2 and overwrite vendor/asset/jquery.
  • My intention was to manually require bower-asset/jquery-2.x as it is possible. The library is correctly copied in vendor/asset/jquery-2.x.
  • However, any subsequent bower-asset package depending on bower-asset/jquery:^2 won't recognize bower-asset/jquery-2.x as a met dependency and carry on with importing bower-asset/jquery:^2 with the above side-effect.

@francoispluchino
Copy link
Member

Ok, I understand better now. I think this may be possible to turn each dependency into another dependency with a map for the conversion. But this map will only be available for the Composer root package.

@MrPetovan
Copy link
Author

MrPetovan commented Feb 19, 2018

But this map will only be available for the Composer root package.

What does this mean? Let's take an example:

composer.json:

{
    "require": {
        "fxp/composer-asset-plugin": "~1.3",
        "npm-asset/jquery": "^1",
        "bower-asset/jquery-2.x": "^2",
        "bower-asset/example": "*",
    },
    "config": {
        "fxp-asset": {
            "installer-paths": {
                "npm-asset-library": "vendor/asset",
                "bower-asset-library": "vendor/asset"
            },
            "satisfies": {
                "bower-asset/jquery-2.x": "bower-asset/jquery"
            }
        }
    },
}
  • If bower-asset/example requires bower-asset/jquery, is it considered as "available for the Composer root package"?
  • If bower-asset/example requires bower-asset/example2 that requires bower-asset/jquery, is it considered as "available for the Composer root package"?

@francoispluchino
Copy link
Member

Because the config section is only available for the Composer root package. The config section of Composer package is doesn't used if the package is installed in the dependencies. So, you cannot define the map in the library, for this map to be used in the project (root package).

@MrPetovan
Copy link
Author

So, would I be able to require bower-asset/example without importing bower-asset/jquery in the above example?

@francoispluchino
Copy link
Member

Yes, of course.

@MrPetovan
Copy link
Author

Ok, I was just making sure. Thank you so much for the answers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants