syncpack: feat: find mismatches in internal monorepo packages

Description

  1. @this-monorepo/atoms and @this-monorepo/molecules are developed in your monorepo.
  2. packages/atoms/package.json contains
    {
      "version": "1.2.3"
    }
    
  3. packages/molecules/package.json contains
    {
      "dependencies": {
        "@this-monorepo/atoms": "1.0.4"
      }
    }
    
  4. syncpack does not report any mismatches because nothing else in the monorepo depends on @this-monorepo/atoms.

Suggested Solution

Add --workspace to the existing list of locations to check for mismatches:

  -p, --prod              include dependencies
  -d, --dev               include devDependencies
  -P, --peer              include peerDependencies
  -R, --resolutions       include resolutions (yarn)
  -o, --overrides         include overrides (pnpm)
+ -w, --workspace         include locally developed package versions

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 30 (27 by maintainers)

Commits related to this issue

Most upvoted comments

Yep you are right! Let me add that. Just for future releases, as a consumer, it would be better if minors didn’t have potentially breaking changes is all. Thanks so much! Looking forward to actually using this feature!

You’re welcome. A lot of nice ideas and improvements have come off the back of your feedback and repros, so thanks a lot for that.

Excellent, thanks for looking into this! Sorry I think I tried it initially with quotes but then forget to do that for the new version. Maybe the Yarn shell interferes here so it could be that nothing needs to change for syncpack.

Works perfectly now and helped me do a good clean up of the repository. Also could configure it to support multiple versions of the same package I needed using version groups.

And could use the list-mismatches in the CI workflow, since it will return 1 exit code when there are mismatches which makes for a great test ❤️

https://github.com/goldstack/goldstack/blob/master/.github/workflows/branch.yml#L65

Running this on Windows - maybe let me try running it in Linux env and see what the result is!

On mobile now but that seems right, I will take a look at that branch soon and try to reproduce and fix, thanks.

Released in 7.0.0