Install pnpm package manager
Go to file
2021-09-08 13:41:00 -05:00
.github Update test workflow 2021-03-23 12:53:25 +07:00
dist Download releases from github 2021-09-08 13:41:00 -05:00
src Download releases from github 2021-09-08 13:41:00 -05:00
.editorconfig Update .editorconfig 2020-05-08 10:35:40 +07:00
.gitattributes Fix .gitattributes 2020-05-09 08:13:09 +07:00
.gitignore Add .pnpm-store to .gitignore 2021-03-23 12:48:07 +07:00
action.yml Download releases from github 2021-09-08 13:41:00 -05:00
LICENSE.md 2020 2020-02-26 17:29:08 +07:00
package.json Download releases from github 2021-09-08 13:41:00 -05:00
pnpm-lock.yaml Download releases from github 2021-09-08 13:41:00 -05:00
README.md Download releases from github 2021-09-08 13:41:00 -05:00
renovate.json Instruct renovate to ignore ajv updates 2021-03-23 11:47:55 +07:00
run.sh Use pnpm.js to install pnpm 2021-03-23 12:42:43 +07:00
tsconfig.json Download releases from github 2021-09-08 13:41:00 -05:00

Setup pnpm

Install pnpm package manager.

Inputs

version

Can either specifiy a specific version of pnpm to install (e.g. "6.14.6") or can specifiy a version range (in the semver range format). The latest version to match the range is used and if the input version is not specified, the latest overall version is used. Version ranges are only supported for versions starting at 6.13.0 and higher, because that is the first version of pnpm to be published to github releases.

dest

This option is obsolete. It is only used when a specific version of pnpm which is 6.12 or lower is specified. For these old versions of pnpm, the dest input is where to store pnpm files.

run_install

If specified, run pnpm install.

If run_install is either null (the default) or false, pnpm will not install any npm package.

If run_install is true, pnpm will install dependencies recursively.

If run_install is a YAML string representation of either an object or an array, pnpm will execute every install commands.

run_install.recursive

(type: boolean, default: false) Whether to use pnpm recursive install.

run_install.cwd

(type: string) Working directory when run pnpm [recursive] install.

run_install.args

(type: string[]) Additional arguments after pnpm [recursive] install, e.g. [--frozen-lockfile, --strict-peer-dependencies].

Outputs

bin_dest

Folder containing the pnpm executable.

dest

Expanded path of inputs#dest, only set if a version before "6.14.6" is specified.

Usage example

Install latest pnpm and cache store

The following yaml will first install the latest version of pnpm, install node, and setup caching of the pnpm store. actions/setup-node has support for caching the pnpm store, as long as pnpm is installed first.

steps:
  - uses: actions/checkout@v2
  - uses: pnpm/action-setup@v2.0.1
  - uses: actions/setup-node@v2
    with:
      node-version: "16"
      cache: "pnpm"

  - run: pnpm install --frozen-lockfile

  # more build/run commands ...

  - run: pnpm store prune

Install specific range of pnpm

steps:
  - uses: actions/checkout@v2

  - uses: pnpm/action-setup@v2.0.1
    with:
      version: "^6.14.6"

  - uses: actions/setup-node@v2
    with:
      node-version: "16"
      cache: "pnpm"

  - run: pnpm install --frozen-lockfile

  # more build/run commands ...

  - run: pnpm store prune

Install pnpm and a few npm packages

Unfortunately, using run_install does not work together with the caching in actions/setup-node. The caching in actions/setup-node requires pnpm to be installed before node, while the run_install option requires node to be installed first. In this situation, you will need to setup the caching yourself.

steps:
  - uses: actions/checkout@v2

  - uses: actions/setup-node@v2
    with:
      node-version: "16"

  - uses: pnpm/action-setup@v2.0.1
    with:
      version: "6.*"
      run_install: |
        - recursive: true
          args: [--frozen-lockfile, --strict-peer-dependencies]
        - args: [--global, gulp, prettier, typescript]        

  # Setup caching here using actions/cache

License

MIT © Hoàng Văn Khải