lerna
lerna copied to clipboard
publishConfig does not overrides after "lerna publish"
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
- add "main" field in publishConfig different with original "main" field.
- run "lerna publish"
- 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
https://github.com/lerna/lerna/blob/e33be4b043f4392311a1b12a1e3de4bdd5e0f42d/utils/pack-directory/lib/pack-directory.js#L55
Yarn, pnpm has its own packing logic, (via yarn pack, pnpm pack). And inside the pack command, I think there's a logic that overrides package.json's field by publishConfig. So creating tar like this might not work as expected in yarn, pnpm.
@ghiscoding The mentioned issue talks about pnpm. The publishConfig replacement doesn't seem to work with yarn. It works if I do yarn npm publish
to manually publish a package but not with lerna publish
. Any other insight on this?
@sahibjotsaggu yes it's been supported for a while now in Lerna-Lite with the help of @artechventure, see publishConfig overrides and the implementation is package manager agnostic, so it works the same on all of them (pnpm, yarn, npm).
However Lerna itself does not yet support this, hence why I'm guessing this issue is still open in here.
For me this sound like an important feature, to make lerna usable with Typescript right? Can we expect any progress?