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

Only update the packages requested by the user #2070

Merged
merged 3 commits into from
Dec 2, 2015

Conversation

contolini
Copy link
Member

Given:

"dependencies": {
    "component-one": "~1.0.0",
    "component-two": "~1.0.0"
}

Running bower update component-one will update component-one and component-two. This is particularly problematic if you have dozens of dependencies because you'll be waiting for bower to download all of them when all you wanted was component-one. Running bower install component-XYZ does the same thing -- update every component.

This PR instructs the manager to only update the requested component(s).

General logic:

  1. Store arguments passed to the install/update commands (the names of packages the user wants to install/update).
  2. When it's time to fetch targets, only fetch targets that match the packages from step 1.
  3. If no arguments were passed, fetch everything.

Related to #256, #924, #1770 and probably many other issues.

Feedback appreciated.

@sheerun
Copy link
Contributor

sheerun commented Dec 1, 2015

@bower/contributors Could you review and test?

@@ -112,7 +114,12 @@ Manager.prototype.resolve = function () {
// Otherwise, fetch each target from the repository
// and let the process roll out
} else {
this._targets.forEach(this._fetch.bind(this));
this._targets.forEach(function (target) {
var name = target.name || target.source;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you define the var outside the loop and just reuse it later in each iteration?

@zzarcon
Copy link
Contributor

zzarcon commented Dec 1, 2015

@contolini very good job here, I think this will be a very good improvement, looking forward to it ;)

@contolini
Copy link
Member Author

👍 Thanks for the feedback @zzarcon!

@0q98ahdsg3987y1h987y
Copy link

👍 Works for me.

@0q98ahdsg3987y1h987y
Copy link

@contolini I think you might want to rebase and squash the commits by the way

@Ianleeclark
Copy link

I'm diggin' it, @contolini . Really useful feature 👍

@KeesWoestenenk
Copy link

Sorry, I’m not in the position to review, I can’t even get Sage getting installed, so better remove me from the reviewers list.

Thank you.
 

 
Kees Woestenenk
about.me/kees.woestenenk
 
http://about.me/kees.woestenenk

Op 1 dec. 2015, om 15:14 heeft Adam Stankiewicz notifications@github.com het volgende geschreven:

@bower/contributors https://github.com/orgs/bower/teams/contributors Could you review and test?


Reply to this email directly or view it on GitHub #2070 (comment).

it('installs only the specified dependencies', function() {
var package4 = new helpers.TempDir({
'bower.json': {
name: 'package3'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be package4?

@riyadhalnur
Copy link
Member

kudos on increasing coverage 👍

@paulohp
Copy link
Member

paulohp commented Dec 2, 2015

👍

@contolini
Copy link
Member Author

Thanks @riyadhalnur. I went through all the test files and reformatted them to comply with the new jscs rules.

@sheerun
Copy link
Contributor

sheerun commented Dec 2, 2015

Looks good :) Thank you for a great pull request

sheerun added a commit that referenced this pull request Dec 2, 2015
Only update the packages requested by the user
@sheerun sheerun merged commit 94ffc35 into bower:master Dec 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

9 participants