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.

Omit private packages from lists of changed and unchanged packages offered by the CLI when running `yarn changeset`

See original GitHub issue

Affected Packages

Problem

The list of packages offered by yarn changeset includes private packages (i.e. packages with private: true in package.json). In projects with broad contribution, contributors may not be aware that only packages that get published should be included in changesets, and include those private packages. This creates noise for maintainers, who have to explain the issue and ask the contributor to fix the changeset.

Proposed solution

If a package is marked as private, it shouldn’t be included in the lists of changed and unchanged packages offered by the CLI. This behavior could be behind an optional flag if there are workflows where including private packages in this list makes sense.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:13
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
Andaristcommented, Dec 17, 2021

My only concern is that people may still want to have a version field for private package to be able to reference them inside a monorepo. When using yarn, workspace:* protocol helps, but I am not sure it works with NPM, which means people need to specify some version to reference package they need.

There is also file: protocol and it’s supported by npm. So this could potentially still be used there.

But I struggle to find any practical use case when 2 private packages inside a monorepo refer to each other.

You may still need to reference a private package in dev dependencies of a public package - and referencing a private package from a private package doesn’t look that different to me, or am I missing something? 🤔

Do I understand correctly, that adjusting the behavior to omit all the packages without a version field applies not only to changeset add command but to other commands as well?

Yes, this would have to be taken into account in the system as a whole. It’s hard for me list all the exact places right now though - but hopefully this should limit itself to just a couple of places.

Does Changesets even work when version field is absent? If it does not, skipping packages without version absolutely makes sense and my concern above can be ignored.

I’ve recently opened a PR to fill the missing version ( https://github.com/changesets/changesets/pull/705 ) and this has prompted the discussion that maybe instead of doing that we should ignore private package without a version. The version will still be required for publishable packages though - and we might want to throw when a version is missing in such a package.

1reaction
bhovhannescommented, Dec 14, 2021

@Andarist I have implement changes locally, however, I think that will be a major change because people will no longer see private packages in the list displayed by CLI which can be a pain for them if they are creating changesets for private packages as well.
To avoid breaking changes I can work on introducing a new config option - skipPrivatePackages which will be false by default, fully preserving current behavior of the CLI. When skipPrivatePackages will be set to true private packages will be totally omitted by CLI.
There are multiple ways new config option can be added, so I’ll be grateful to hear maintainers opinion on this.

We don’t use changesets now, but we have a use case for generating changelog for private packages. We are moving to micro-frontends and each micro-frontend is a npm package, which never gets published. Instead we just deploy content of dist folder to S3 and update import-map in html. We even want to prohibit users from publishing micro-frontends to npm, so we have private: true set in package.json.

BTW, thank you for nice code in the repo. During implementing changes I realized that I do not feel like I am working in a “foreign” repo, which was awesome!

Read more comments on GitHub >

github_iconTop Results From Across the Web

@changesets/cli | Yarn - Package Manager
Helps you manage the versioning and changelog entries for your packages, with a focus on versioning within a mono-repository (though we support single-package...
Read more >
How can I version bump all my dependencies? - Stack Overflow
If you want your package.json to be updated: Change all your dependencies to a fixed version ( "x.x.x" ); Run yarn to update...
Read more >
Nixpkgs 22.11 manual - NixOS
This chapter describes how to extend and change Nixpkgs using overlays. Overlays are used to add layers in the fixed-point used by Nixpkgs...
Read more >
Commands.dev - Find commands at the speed of thought
Commands.dev is a searchable, templated catalog of popular terminal commands curated from across the internet.
Read more >
rollup.js
Rollup should typically be used from the command line. You can provide an optional Rollup configuration file to simplify command line usage and...
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