pnpm / action-setup

Install pnpm package manager
https://github.com/marketplace/actions/setup-pnpm
MIT License
936 stars 89 forks source link

Install the self-contained binary version of pnpm #31

Closed zkochan closed 1 year ago

zkochan commented 2 years ago

This is a breaking change because the binary version of pnpm is only available from v6.17.1. Also, it doesn't ship pnpx.

close #18

KSXGitHub commented 2 years ago

Amendment:

You intend to drop support for pnpm versions without self-contained binary, correct? If that's the case, why even bother running the self-installer and install it via the npm registry at all? Why not just download the binary directly from GitHub release?

GitHub Release does not support version ranges (e.g. ^6.17.1), so we must resolve to the correct version ourselves. Or just fallback to npm. Or drop support for version ranges entirely.

KSXGitHub commented 2 years ago

@zkochan When will you resolve my requests for change in this PR?

zkochan commented 2 years ago

I have to think about it. Not soon.

privatenumber commented 2 years ago

Curious if this would be easier to move forward with if it's opt-in via an option (eg. binary: true)?

tksst commented 1 year ago

I agree with @privatenumber . Since this branch is very old and differs significantly from the latest master, I forked this action and implemented an option to install a self-contained binary.

I will post another PR after I add the test and update the readme.

fz6m commented 1 year ago

Good job @tksst .

I think adding a node-version option, detect it and auto switch pnpm@version to @pnpm/exe@version is better.

e.g.

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        node-version: [14.x, 16.x, 18.x]
        os: [ubuntu-latest, windows-latest]
    steps:
      - name: Install pnpm
        uses: pnpm/action-setup@v3.0.0
        with:
          # in the node 14.x env, we auto install `@pnpm/exe` instead of `pnpm`
          # refer: https://pnpm.io/installation#compatibility
          node-version: ${{ matrix.node-version }}
          version: 8

      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
          cache: 'pnpm'
tksst commented 1 year ago

@fz6m

I think adding a node-version option, detect it and auto switch pnpm@version to @pnpm/exe@version is better.

That is a nice feature, but a bit complicated.
I may try to implement it when I have time.

tksst commented 1 year ago

After thinking about how to implement this feature, I gave up trying to implement it. The node-version option of setup-node can take various values. For example, "^18.0.0", ">=18.0.0", "lts/*", etc. I need to implement the same logic to determine the version as actions/setup-node. This is difficult.