Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pnpm is not being detected by chromatic-cli #698

Closed
wollardj opened this issue Dec 13, 2022 · 8 comments
Closed

pnpm is not being detected by chromatic-cli #698

wollardj opened this issue Dec 13, 2022 · 8 comments
Labels
bug Classification: Something isn't working needs triage Tracking: Issue needs confirmation

Comments

@wollardj
Copy link

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.

@wollardj wollardj added bug Classification: Something isn't working needs triage Tracking: Issue needs confirmation labels Dec 13, 2022
@tmeasday
Copy link
Member

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?

@wollardj
Copy link
Author

wollardj commented Dec 15, 2022

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.

@wollardj
Copy link
Author

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.

@tmeasday
Copy link
Member

@wollardj we'd definitely be open for PRs that added it. I'll open a internal ticket for it and link this issue to it. If others need it also, it's probably best to write into support directly and let us know.

@wollardj is it blocking y'all from using Chromatic at this stage?

@wollardj
Copy link
Author

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 😄

@tmeasday
Copy link
Member

@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:

  1. Run Chromatic for the last commit of the base branch (or push a new commit and do that)
  2. Merge the base branch into the head branch (or rebase)
  3. 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.

@ghengeveld
Copy link
Member

Hey @wollardj, it's been a long time but we've been working on pnpm compatibility. Support for pnpm is currently available in 7.0.0-next.0 and via chromaui/action-next (GitHub Action). Would you be willing to give it a try?

@rin-st
Copy link

rin-st commented Sep 19, 2023

it worked for me in ^7.2.0 with chromaui/action@v1, but I needed to add pnpm to chromatic workflow

    ...
      - uses: actions/checkout@v1

      - uses: pnpm/action-setup@v2
        with:
          version: 8.7.6

      - name: Install dependencies
        run: pnpm i
    ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Classification: Something isn't working needs triage Tracking: Issue needs confirmation
Projects
None yet
Development

No branches or pull requests

4 participants