pnpm is not being detected by chromatic-cli
wollardj opened this issue · 8 comments
Bug report
Our team has started using pnpm
as our go-to package manager (npm compatibility with existing tooling + performance of yarn2 = win). We're hitting a snag when using --patch-build
. From what I can gather, that flag causes a call to installDependencies()
which in turn is using yarn-or-npm
to spawn the installation process.
Interestingly, the default seems to be yarn
in our repo even though the README states that npm
is the fallback.
It seems that our pipelines are able to publish to chromatic.com without issue, but I don't know if the pnpm
support that currently exists with chromatic-cli is intentional or incidental - filing as a bug made sense, but I could also see who this might be a feature request.
Hi @wollardj, I don't think we've explicitly worked to support pnpm but it's definitely on our radar as it is becoming more popular and Storybook is working to support it better.
If you run node -e "console.log(require('yarn-or-npm')())"
in your project what do you get? It seems like this might be an upstream bug, perhaps?
Thanks, @tmeasday. Looking at the code leads me to believe that yarn-or-npm isn't meant to support pnpm either. That repo hasn't been updated in three years, and maybe it doesn't need to be given the nature of the problems it solves, but I wonder about the likelihood of getting new features added to that library.
To answer your question, the output of the command you provided is yarn
. I see now that the README does indicate that to be the expected behavior when yarn
is available on the $PATH, which it is in my case.
I'm going to close this out for now since pnpm support issues would be more of a feature request than an issue at this point. If pnpm support is something the team would like to pursue I'd be happy to lend a hand with that.
I'm reluctant to say it's blocking us. Our primary blocker is time right now; time to look into work arounds. We are able to upload assets to Chromatic, but we're not able to generate the original patch that Chromatic needs to expose change sets. We can certainly switch to npm or yarn, but then we're back to our lack of time
@wollardj the only reason chromatic needs a patch build is when there is no chromatic build for the merge base of the PR: https://www.chromatic.com/docs/branching-and-baselines#patch-builds
So a more manual solution looks something like:
- Run Chromatic for the last commit of the base branch (or push a new commit and do that)
- Merge the base branch into the head branch (or rebase)
- Run chromatic for the new head commit (merge or rebased).
The patch build feature is really just something to help folks get started with UI review before they have an existing set of builds on their repo.