intuit / auto

Generate releases based on semantic version labels on pull requests.
https://intuit.github.io/auto/
MIT License
2.22k stars 202 forks source link

Support PNPM workspace #2149

Open bitabs opened 2 years ago

bitabs commented 2 years ago

Hi there,

We are using pnpm for our monorepo. Some of our dependencies are listed like so (in package.json):

{
  "devDependencies": {
    "@foo/config": "workspace:*",
  },
}

You can find the documentation on pnpm workspace: https://www.pnpm.cn/workspaces

Unfortunately, this has caused the following error message when we run auto shipit:

Screenshot 2022-02-12 at 01 56 46

Will auto support pnpm soon enough so we can leverage this great feature?

Thanks

allbetter-max commented 1 year ago

Cross linking to a discussion on the subject https://github.com/intuit/auto/discussions/2281

bitabs commented 1 year ago

Hi there - It's been more than a year and I'd like an update on the status of this issue? @hipstersmoothie @jackw

FYI, we're not using yarn workspaces, but rather ppm workspaces. Most of our packages references through "workspace:*".

Please advice. Thanks

jackw commented 1 year ago

Whilst I might have contributed to this project I don't maintain it so the following could be incorrect...

To the best of my knowledge (amongst other things) Auto is a wrapper around Lerna that glues it to github labels, etc.

Looking at the error reported above this isn't Auto that's causing the issue but Lerna 4 which doesn't support PNPM or the workspace: protocol. I would suggest trying to bump Lerna to at least 5.5.1 and follow the documentation guide for using pnpm with Lerna. If Auto is then failing with other errors I'd suggest reporting them here.

bitabs commented 1 year ago

Thank you. I may have lived under the rock and had no idea that Lerna 6 has been out. Will have a read on their doc. Thank you 🙏

hipstersmoothie commented 11 months ago

Would anyone want to help upgrade lerna? I would merge that PR

jackw commented 11 months ago

I took a quick look at the codebase and other than the root package.json (which I see has just been bumped to latest) I cannot find any reference to lerna as a dependency of the packages. I can see calls to npx lerna in core and the npm plugin.

Would setting lerna as a peerDependency in auto and @auto-it/npm be enough? We're currently running auto@10.46.0 with lerna@6.6.2 without problems in this repo. Maybe something like the following to limit to last two major releases and prevent unwanted issues when lerna 8 is released without auto having the chance to test it still works?

peerDependencies: {
   "lerna": ">=6.0.0 < 8.0.0",
}
hipstersmoothie commented 11 months ago

I just upgraded us to 7. Do you think the peer dep would be better?

jackw commented 11 months ago

Sorry for not replying sooner...

I just upgraded us to 7. Do you think the peer dep would be better?

I was under the impression the upgrade was for the repo itself rather than for consumers of the auto packages? Maybe I've misunderstood your request to help update lerna. I was assuming it was related to this issue of lerna and pnpm support.

Right now if I create a project, add auto and select the npm package manager plugin there is no version of lerna added to the project.

image

If we add the peerDependencies to the auto and auto/npm packages on install the user would be told about the missing peer dependency of lerna. If they try to install a version that isn't inside whatever semver range auto supports it will again warn which would at least tell devs "this is what auto supports". Dunno, maybe I just misunderstood the relation between the issue and your request for help to bump lerna. 😄

heygrady commented 7 months ago

I just spent more than an hour combing over the docs and source code to uncover the relationship between lerna and auto. The first place I looked was in the package.json files, expecting to see a peer dep listed.

A line like this will fail if lerna isn't installed (or maybe it will hang forever waiting for permission to install lerna?): https://github.com/intuit/auto/blob/7a6f0ae37414b9c56ea7db6547873b77c4dfb425/packages/core/src/utils/get-lerna-packages.ts#L15

I actually don't see any other places where lerna is called directly (maybe I don't know where to look), although it appears that the npm plugin still relies on the presence of an lerna.json file to decide if it's dealing with a monorepo.

hipstersmoothie commented 4 months ago

@heygrady you are correct.

hipstersmoothie commented 4 months ago

@jackw could you make a PR to fix the peer dep?

jackw commented 4 months ago

@hipstersmoothie I'll get something together asap. 👍

hipstersmoothie commented 4 months ago

Thanks!

jjenzz commented 1 month ago

if it helps anyone in the meantime, i installed lerna@8.1.2 and also listed packages in my lerna.json for things to work (even tho i'm not using lerna anywhere else).