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.39k stars 2.72k forks source link

structure of "bin" within a dependencies package.json is different when installing with yarn or npm #1697

Open klausbayrhammer opened 7 years ago

klausbayrhammer commented 7 years ago

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

What is the current behavior? When installing e.g. casperjs the structure of "bin" within the node_modules/casperjs/package.json looks different whether I use yarn or npm to install the package. The yarn version looks like this:

{
  "bin": "./bin/casperjs"
}

the npm version looks like this:

{
  "bin": {
    "casperjs": "./bin/casperjs"
  },
}

Projects like BackstopJS rely on the structure of bin section within a dependencies package.json (see garris/BackstopJS#323).

If the current behavior is a bug, please provide the steps to reproduce. yarn add casperjs respectively npm i casperjs

Please mention your node.js, yarn and operating system version. yarn version v0.16.1 node v6.5.0 npm 3.10.3

sebmck commented 7 years ago

We aren't normalising package.json like npm is doing, we probably need to write the normalised version. Regardless, if your tool is consuming package.json then it should be doing this normalisation anyway.