Yarn: Upgrade single package

Created on 14 Oct 2016  路  9Comments  路  Source: yarnpkg/yarn

Hi, I really tried to find this before posting here, but I cannot find a way of upgrading a single package. I can only upgrade all of them, Is it possible? Something like:

yarn upgrade mypackage

Most helpful comment

Using yarn add mypackage again should update the package to the latest one.

All 9 comments

Using yarn add mypackage again should update the package to the latest one.

Hmm, this is not the way i understand the documentation ? https://yarnpkg.com/en/docs/usage

It says use the syntax yarn upgrade [package] to upgrade a dependency, or if i do yarn upgrade color for exemple, i got :

yarn upgrade color
yarn upgrade v0.15.1
error This command doesn't require any arguments.
info Visit http://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.

And this page is not telling the same thing : https://yarnpkg.com/en/docs/cli/upgrade

So i think this documentation page https://yarnpkg.com/en/docs/usage is not uptodate :)

Ok, i think it is a duplicate of #598

Yeah I think the docs are out-of-date.

Sorry my comment was vague, I should have clarified. yarn upgrade upgrades all packages to the latest version that matches the version range specified in the package.json. It does not edit the package.json file though. Using yarn add on an existing package will update the package.json to reference the latest version number, and also install that version.

Yes, you're right. Thanks for clarification.

But as @cpojer say in #598, it seems that the correct behavior was the one on the main doc (upgrade should be able to upgrade one dependancy)

So i don't know if the main doc should be updated or if the ability to upgrade one dependency should be added :)

But right now, this is a little bit confusing :)

Theses docs are out-of-date :

And this one is ok :

Merging into #598.

NB yarn add package by itself won't upgrade package to a new version if its from a private repo -- rather it will give you an error (Couldn't find package ...). Would be nice to have a way simply to upgrade a package not re-add....

I have a private Ember addon with a blueprint which installs some dependencies.

module.exports = {
  description: 'Bla bla bla',
  normalizeEntityName() {},
  afterInstall: function() {
    return this.addAddonsToProject({
      packages: [
        {name: 'ember-changeset', target: '1.3.0'},
        {name: 'ember-changeset-validations', target: '1.2.8'},
        {name: 'ember-form-for', target: '2.0.0-alpha.14'},
        {name: 'ember-truth-helpers'},
        {name: 'ember-power-select'}
    });
  }
}

However, each time I upgrade my private addon from a consumer project (yarn upgrade my-private-addon), yarn automatically upgrade dependencies of my addon too. I only wat to upgrade my-private-addon to last commit from master.

Any idea, please ? Thanks.

NOTE: Using yarn add servir-ember-utilities (name of my private addon), results in this error:
An unexpected error occurred: "https://registry.yarnpkg.com/servir-ember-utilities: Not found"

@cluis13915 Please create a separate issue rather than commenting on a closed one.

Was this page helpful?
0 / 5 - 0 ratings