lerna / lerna/lerna

publishConfig does not overrides after "lerna publish"

Open
#3,402 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: feature
Dominant language
TypeScript
Stars
36.1k
Forks
2.3k
Avg merge
1d 4h
Merged PRs (30d)
50

Description

Current Behavior

publishConfig does not overrides package.json fields after "lerna publish".

original

{
  "main": "./src/index.ts",
  "publishConfig": {
    "main": "./dist/index.js"
  }
}

uploaded on npm

{
  "main": "./src/index.ts",
  "publishConfig": {
    "main": "./dist/index.js"
  }
}

Expected Behavior

package.json should be overwritten and publishConfig should be removed

{
  "main": "./dist/index.js",
}

Steps to Reproduce

  1. add "main" field in publishConfig different with original "main" field.
  2. run "lerna publish"
  3. install uploaded package on npm, and check its package.json
Failure Logs / Configuration
lerna.json

<!-- Please paste your `lerna.json` here -->

lerna-debug.log

<!-- If you have a `lerna-debug.log` available, please paste it here -->
<!-- Otherwise, feel free to delete this <details> block -->

Environment

System:
OS: macOS 12.1
CPU: (10) arm64 Apple M1 Max
Binaries:
Node: 16.14.0 - /private/var/folders/zr/3tkznhqs6sn26wsynpczk2pxz0g_by/T/xfs-a49a6c75/node
Yarn: 3.2.1 - /private/var/folders/zr/3tkznhqs6sn26wsynpczk2pxz0g_by/T/xfs-a49a6c75/yarn
Utilities:
Git: 2.32.1 - /usr/bin/git

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the package.json example and trace the lerna publish entry point to see how publishConfig is handled; the issue also includes an empty lerna.json section and no debug log. Reproduce with the listed three steps, then verify that the published package.json uses the publishConfig main value and omits publishConfig.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
release
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.