yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.38k stars 2.72k forks source link

Incorrect Yarn.lock File Entry After "yarn add @namespace/package@1.2.3" #4247

Open kkincade opened 6 years ago

kkincade commented 6 years ago

The company I work for has a private NPM registry where we host internal Ember.js addons. We then have our main website (Ember application) pull specific "frozen" versions of our addons. When publishing a new version of an addon and propagating the new version into the application, I am not getting the newest code.

Steps Taken:

  1. Publish a new version of an addon to the registry (e.g. new version = 3.2.0).
    • Note: The app already has an older version of the addon (e.g. old version = 3.0.2).
  2. Within the ember app, run yarn add @namespace/addon-name@3.2.0.
  3. Resulting yarn.lock file is below.
"@adc/ember-utils@*":
  version "3.0.2"
  resolved "http://internal-ip:port/@adc%2fember-utils/-/ember-utils-3.0.2.tgz#95600265e0ff6a13419c95d50c62d01f7db861a0"
  dependencies:
    ember-cli-babel "^6.3.0"
    ember-cli-htmlbars "^2.0.1"
    ember-maybe-import-regenerator "^0.1.6"
 
"@adc/ember-utils@3.2.0":
  version "3.2.0"
  resolved "http://internal-ip:port/@adc%2fember-utils/-/ember-utils-3.2.0.tgz#aa8e47728ed0553486bb1190ed56e5de91f209b6"
  dependencies:
    ember-cli-babel "^6.3.0"
    ember-cli-htmlbars "^2.0.1"
    ember-maybe-import-regenerator "^0.1.6"
  1. Commit the yarn.lock file to version control.
  2. When someone pulls the latest version of the yarn.lock file, it will not pull version the newest version (i.e. 3.2.0).

Looking at other addons within the yarn.lock file, I am under the impression that the result should look like the following.

"@adc/ember-utils@*", "@adc/ember-utils@3.2.0":
  version "3.2.0"
  resolved "http://internal-ip:port/@adc%2fember-utils/-/ember-utils-3.2.0.tgz#aa8e47728ed0553486bb1190ed56e5de91f209b6"
  dependencies:
    ember-cli-babel "^6.3.0"
    ember-cli-htmlbars "^2.0.1"
    ember-maybe-import-regenerator "^0.1.6"

It should also be noted that if the yarn.lock file is deleted and recreated by yarn install, the entry is properly grouped like the code example above.

Current Versions: Yarn Version: 0.27.5 Node.js Version: 6.10.2 OS: Mac or Windows

kkincade commented 6 years ago

Can anyone verify that this is indeed a bug or if it is intended behavior?

BYK commented 6 years ago

There's a known bug right now that seems like this. I have a fix on the way. Will link you to that once it is up. Probably will be tomorrow.