question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Force publish only specific package(s)

See original GitHub issue

Expected Behavior

Pass --force-publish and some other flag to only force publish specific or multiple packages, but not all. One may say to use with --ignore-changes but it seems to not work, meaning that it treats all the packages and seems to ignore the ignore-changes flag completely.

The use case is when you have dist changed but not sources, but you know for sure that the dist is different (has changed) and want to bump version.

Current Behavior

No way of doing it? --force-publish and --ignore-changes doesn’t play well together.

Possible Solution

Don’t know.

Steps to Reproduce (for bugs)

  1. Have 5 or 10 packages
  2. Want to force publish only 2-3
  3. ignore the rest

Removed the rest of the issue template, since it doesn’t apply.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
evocateurcommented, Oct 22, 2019

Removed the rest of the issue template, since it doesn’t apply.

I’d say the version of lerna that you’re using is rather applicable. As is the exact command(s) you attempted. And what (if any) configuration is present in lerna.json.

I’ll practice reading your mind, I guess. Hand-waving, I assume you tried something like this:

npx lerna publish \
  --force-publish foo-package \
  --force-publish @scope/bar-package \
  --ignore-changes '**'

One thing to note, if you do ignore everything except an explicit subset, any changes outside of the subset will be forever lost to subsequent publishes, as far as Lerna is concerned. That is, the next time you run lerna publish without all the fancy forcing, it won’t consider the previously-ignored packages to have changed, and thus won’t publish them.

I would recommend you avoid using the --ignore-changes flag for this purpose, and just accept that Lerna will publish what has changed since the previous release tag in addition to the stuff you forced (which is valid in this case, for sure, build changes and whatnot won’t get recognized).

2reactions
evocateurcommented, Oct 25, 2019

Interesting, very strange and crazy.

It’s literally how tags work in git? That’s what Lerna uses to determine what changed since the last release. The “last release” is the previous annotated git tag.

You can always pass specific globs to --force-publish if you don’t want to version the world. It has the same caveats when combined with --ignore-changes, however, and is generally only used to ensure certain packages always get published (Babel itself uses this for some of their packages due to a weird dependency graph).

Read more comments on GitHub >

github_iconTop Results From Across the Web

It's possible to publish a specific package with Lerna?
If they are both independent, and you don't want to publish them at the same time, then don't use lerna, it's clearly not...
Read more >
Version and Publish - Lerna
We are going to publish the header and the footer packages. It's common to publish only a subset of the projects. Some projects...
Read more >
Untitled
`publish` will help publish any updated packages. ... dist-tag is used at the start to prevent the case where only some of the...
Read more >
@lerna/publish - npm
publishConfig.access. To publish packages with a scope (e.g., @mycompany/rocks ), you must set access : ; publishConfig.registry. You can customize the registry ...
Read more >
@lerna/publish | Yarn - Package Manager
Publish packages in the current project ... publish: support inconsistent workspace prefix usage (#3413 (da2274b); version: only apply prettier if it was ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found