fumeng
fumeng

Reputation: 1820

Lerna publish adds gitHead key to package.jsons

I've got the following scripts in my root package.json in my lerna repo:

"scripts": {
    "lerna:changed": "npx lerna changed",
    "lerna:diff": "npx lerna diff",
    "lerna:publish": "npx lerna publish"
  }

After running npm run lerna:publish I see a gitHead key in my package.json file of all packages (not the root.json). This becomes a big problem when it comes to versioning because all packages will get bumped when this change is added. Why is this happening and how can I stop it?

I used to have a publish command in my root package.json file and I know this could have caused this problem originally but I've since removed it. Now, the package.json files for my sub packages look basically like this:

{
  "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"

}

Upvotes: 7

Views: 2977

Answers (1)

fumeng
fumeng

Reputation: 1820

UPDATE: It seems like gitHead is added as a temporary key during the publish phase. My publish creates tags and commits them to GIT but my deployment to my registry is failing and that's probably why the cleanup isn't happening.

Upvotes: 4

Related Questions