Lerna 发布将 gitHead 密钥添加到 package.jsons

fum*_*eng 7 node.js npm lerna

我的 lerna 存储库中的根 package.json 中有以下脚本:

"scripts": {
    "lerna:changed": "npx lerna changed",
    "lerna:diff": "npx lerna diff",
    "lerna:publish": "npx lerna publish"
  }
Run Code Online (Sandbox Code Playgroud)

运行npm run lerna:publish后,我在所有包的 package.json 文件(不是 root.json)中看到一个gitHead键。当涉及到版本控制时,这成为一个大问题,因为添加此更改后所有包都会受到影响。为什么会发生这种情况?我该如何阻止它?

我曾经在我的根 package.json 文件中有一个发布命令,我知道这最初可能会导致这个问题,但我已经将其删除了。现在,我的子包的 package.json 文件基本上如下所示:

{
  "name": "@myProject/appOne",
  "version": "0.0.15-alpha.0",
  "description": "",
  "main": "index.js",
  "directories": {
    "lib": "lib"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
Run Code Online (Sandbox Code Playgroud)

}

fum*_*eng 4

更新:似乎 gitHead 在发布阶段被添加为临时密钥。我的发布创建了标签并将它们提交到 GIT,但我对注册表的部署失败,这可能就是清理没有发生的原因。