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

Yarn upgrade-interactive --latest now has the same output than yarn upgrade-interactive #5842

Open
marcofugaro opened this issue May 21, 2018 · 5 comments
Assignees
Labels

Comments

@marcofugaro
Copy link

marcofugaro commented May 21, 2018

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
I have this in my package.json

"dependencies": {
  "@babel/core": "^7.0.0-beta.46",
}

and this in my yarn.lock

"@babel/core@^7.0.0-beta.46":
  resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.0.0-beta.47.tgz#b9c164fb9a1e1083f067c236a9da1d7a7d759271"
    "@babel/core" "^7.0.0-beta.46"

I see there is a new babel version with yarn info @babel/core versions, the 7.0.0-beta.47, and I want to update my package.json to reflect it, so I run

yarn upgrade-interactive --latest

But the newer babel version doesn't show up in the list!

It's behaving like the command yarn upgrade-interactive, related issue is #4390

Maybe it has something to do with the resolved url in the yarn.lock?

What is the expected behavior?
I want my package.json to be updated

Please mention your node.js, yarn and operating system version.
Node v10.1.0, yarn v1.6.0, OSX

@ghost ghost assigned rally25rs May 21, 2018
@ghost ghost added the triaged label May 21, 2018
@rally25rs
Copy link
Contributor

rally25rs commented May 21, 2018

Seems to work for me if I try to reproduce it:

~/Projects/yarn-test2 🐒   yarn
yarn install v1.6.0
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
success Saved lockfile.
✨  Done in 3.00s.

~/Projects/yarn-test2 🐒   cat package.json
{
  "name": "yarn-test2",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "@babel/core": "^7.0.0-beta.46"
  }
}

~/Projects/yarn-test2 🐒   grep @babel/core@ yarn.lock
"@babel/core@^7.0.0-beta.46":

~/Projects/yarn-test2 🐒   yarn upgrade-interactive --latest
yarn upgrade-interactive v1.6.0
info Color legend :
 "<red>"    : Major Update backward-incompatible updates
 "<yellow>" : Minor Update backward-compatible features
 "<green>"  : Patch Update backward-compatible bug fixes
? Choose which packages to update. (Press <space> to select, <a> to toggle all, <i> to inverse selection)
 dependencies
   name         range   from              to             url
❯◯ @babel/core  latest  7.0.0-beta.46  ❯  7.0.0-beta.47  https://babeljs.io/

Edit:

though if you copy/paste from your lockfile is correct:

"@babel/core@^7.0.0-beta.46":
  resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.0.0-beta.47.tgz#b9c164fb9a1e1083f067c236a9da1d7a7d759271"
    "@babel/core" "^7.0.0-beta.46"

then it resolved to the beta.47.tgz so beta.47 is already installed. What does the version in the lockfile say? You seem to have omitted that line. Should actually look something like:

"@babel/core@^7.0.0-beta.46":
  version "????????"
  resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.0.0-beta.47.tgz#b9c164fb9a1e1083f067c236a9da1d7a7d759271"

@marcofugaro
Copy link
Author

marcofugaro commented May 22, 2018

Thanks for your time @rally25rs!

Here it is with the version:

"@babel/core@^7.0.0-beta.46":
  version "7.0.0-beta.47"
  resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.0.0-beta.47.tgz#b9c164fb9a1e1083f067c236a9da1d7a7d759271"
  dependencies:
    "@babel/code-frame" "7.0.0-beta.47"
    ...

It's actually the 47, but when I do yarn upgrade-interactive --latest I expect my package.json to be updated with the 7.0.0-beta.47 version also.


Here is the project repo
Here is the package.json with the @babel/core dep
To replicate run these commands:
git clone git@github.com:accurat/accurapp.git
cd accurapp
git checkout big-updates
yarn
yarn upgrade-interactive --latest

@babel/core isn't in the list:

@rally25rs
Copy link
Contributor

Ah, yes, you've stumbled upon the edge case. I discussed this in a couple other issue threads, but I know the GitHub search leaves a lot to be desired...

The way the code works is that it first gets a list of outdated items (same as running yarn outdated. In your case it finds nothing outdated because latest is beta.47 and you have beta.47 installed.
Then, since there is nothing to update, the code returns.

If @babel/core had been outdated, then your package.json would have been updated. It's a bit of a weird case. I suppose it's a bug, but it never felt really critical since you'll still have the correct version actually installed.

@rally25rs rally25rs added cat-bug and removed triaged labels May 22, 2018
@marcofugaro
Copy link
Author

Weird, I don't know how it happened, I usually update the deps just with the upgrade-interactive command.

Anyway, I want a way to write the latest and installed version in the package.json, even when the semantic versioning is correct.

@marcofugaro
Copy link
Author

Oh, I figured out how this happened, I removed the yarn.lock, the node_modules and run yarn again. So yarn installed the latest semantically correct version.

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

No branches or pull requests

2 participants