yarnpkg/yarn

support gitHead property in package.json

Open

#2,978 建立於 2017年3月23日

在 GitHub 查看
 (1 留言) (6 反應) (0 負責人)JavaScript (41,514 star) (2,731 fork)batch import
cat-compatibilitycat-featurehelp wantedtriaged

描述

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

What is the current behavior? When you run yarn/npm info <package>, the returned package metadata has a gitHead field which points to the git HEAD SHA1 at the time npm publish was run. When you run npm install <package>, you will also find that field in the package.json of the installed package. When you run yarn add <package>, that field is missing from the package.json.

This is a very useful field (see reasoning here: https://github.com/npm/read-package-json/issues/7) and the absence means that yarn users instead need to do an expensive API call with yarn info for every single package if they want to find this information out.

This is not one of npm's underscore-prefixed fields that only get added locally on installation. It gets added to the package data on publish.

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

  • Run yarn add <package>
  • See node_modules/<package>/package.json does not contain gitHead

What is the expected behavior?

  • See node_modules/<package>/package.json contains gitHead

Please mention your node.js, yarn and operating system version. yarn v0.21.3 node v7.7.0 macOS

貢獻者指南