Skip to content

Inconsistent quoting of github dependency names leads to unnecessary lockfile changes #4953

Open
@Gekkio

Description

@Gekkio

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

This seems like a yarn bug.

What is the current behavior?

We've got a certain transitive dependency that is always resolved correctly, but the name of this dependency is sometimes quoted depending on which yarn command was executed last.

If I run yarn install in our project, yarn.lock always ends up containing this (dependency name not quoted):

axios@contentful/axios#fix/https-via-http-proxy:
  version "0.17.1"
  resolved "https://codeload.github.com/contentful/axios/tar.gz/4b06f4a63db3ac16c99f7c61b584ef0e6d11f1af"
  dependencies:
    follow-redirects "^1.2.5"
    is-buffer "^1.1.5"

If I run yarn upgrade in our project, yarn.lock always ends up containing this (dependency name quoted):

"axios@github:contentful/axios#fix/https-via-http-proxy":
  version "0.17.1"
  resolved "https://codeload.github.com/contentful/axios/tar.gz/4b06f4a63db3ac16c99f7c61b584ef0e6d11f1af"
  dependencies:
    follow-redirects "^1.2.5"
    is-buffer "^1.1.5"

So, even if there are no actual version changes, install and upgrade can cause unnecessary lockfile changes that the other command reverts later. Removing node_modules doesn't help.

If the current behavior is a bug, please provide the steps to reproduce.

This is reproducible with a barebones package.json with these two dependencies:

"dependencies": {
  "contentful": "~4.6.2",
  "left-pad": "stevemao/left-pad"
}

Now, running yarn upgrade quotes the axios transitive dependency, and yarn install reverts the quoting. This seems to have something to do with multiple github dependencies, because if left-pad is removed, both yarn commands use quotes in the axios dependency name. Note that contentful doesn't use left-pad even transitively, so just the existence of another github dependency is enough to trigger this behaviour.

What is the expected behavior?

yarn.lock uses consistently either the quoted or non-quoted naming for axios, so install/upgrade doesn't do unnecessary quoting modifications to the lock file.

Please mention your node.js, yarn and operating system version.

$ node --version
v8.9.1
$ yarn --version
1.3.2
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=17.04
DISTRIB_CODENAME=zesty
DISTRIB_DESCRIPTION="Ubuntu 17.04"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions