JamieMason / syncpack

Consistent dependency versions in large JavaScript Monorepos.
https://jamiemason.github.io/syncpack/
MIT License
1.46k stars 51 forks source link

question(config): how to pin local packages to "workspace:*"? (3) #230

Closed johtso closed 4 months ago

johtso commented 4 months ago

I get output like this:

= Use workspace protocol when developing local packages ========================
✘ my-package 0.0.0 → workspace:* services/my-package/package.json > version [PinnedMismatch]

I'd understand that pinned versions in dependencies pointing to other packages in your monorepo should be changed to "workspace:", but `"version": "workspace:"` for a package doesn't make sense.

Using syncpack 12.3.3

Am I doing something wrong?

JamieMason commented 4 months ago

Hi @johtso, I can't see your config file but I think you might need to remove the local dependency type from being included in your rule.

https://jamiemason.github.io/syncpack/guide/local-package-versions/#the-local-dependency-type

Possibly related

johtso commented 4 months ago

Thanks @JamieMason

I have this in my config, but I guess that's not quite right:

{
  "versionGroups": [
    {
      "label": "Use workspace protocol when developing local packages",
      "dependencies": ["$LOCAL"],
      "pinVersion": "workspace:*"
    }
  ]
}
JamieMason commented 4 months ago

Great, I think this fix should do it 👍

johtso commented 4 months ago

Great, I think this fix should do it 👍

Ah amazing! I fell into the same trap 😂

Thanks for the help

JamieMason commented 4 months ago

You're welcome, lots of people get caught by this one 😁