Skip to content

Commit

Permalink
Update pnpm and use corepack
Browse files Browse the repository at this point in the history
Signed-off-by: Olga Bulat <obulat@gmail.com>
  • Loading branch information
obulat committed Jul 17, 2024
1 parent 25a8021 commit 6e222aa
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
5 changes: 2 additions & 3 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ runs:
pip install -U pip
pip install pipenv pdm
# Node.js
- name: Setup pnpm
if: inputs.setup_nodejs == 'true'
uses: pnpm/action-setup@v3
# Automatically reads `packageManager` field from root `package.json`.
shell: bash
run: corepack enable pnpm

- name: Setup Node.js
if: inputs.setup_nodejs == 'true'
Expand Down
5 changes: 1 addition & 4 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ ARG FRONTEND_NODE_VERSION

FROM docker.io/node:${FRONTEND_NODE_VERSION}-alpine AS builder

# Automatically use the right version of pnpm.
ARG FRONTEND_PNPM_VERSION

# Install system packages needed to build on macOS
RUN apk add --no-cache --virtual .gyp python3 make g++ \
&& npm install -g pnpm@${FRONTEND_PNPM_VERSION}
&& corepack enable

USER node

Expand Down
7 changes: 4 additions & 3 deletions frontend/Dockerfile.playwright
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ ARG PLAYWRIGHT_VERSION

FROM mcr.microsoft.com/playwright:v${PLAYWRIGHT_VERSION}-jammy

ARG PACKAGE_MANAGER

COPY package.json /

# Ensure the /.cache/node directory exists in the Playwright container and is writable
RUN mkdir -p /.cache/node/corepack/ && chmod -R 777 /.cache/node/corepack/

# Requires `packageManager` field to be present in `frontend/package.json`.
RUN npm install -g $PACKAGE_MANAGER
RUN corepack enable
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "Openverse frontend",
"private": true,
"version": "2.2.1",
"packageManager": "pnpm@9.5.0",
"scripts": {
"predev": "pnpm install && pnpm i18n:no-get",
"dev": "run-p dev:only 'i18n:en --watch'",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"preeslint": "pnpm --filter '@openverse/eslint-plugin' run build",
"eslint": "eslint --ext .js,.ts,.vue,.json,.json5 --ignore-path .gitignore --ignore-path .eslintignore --max-warnings=0 frontend automations/js packages/js .pnpmfile.cjs .eslintrc.js prettier.config.js tsconfig.base.json"
},
"packageManager": "pnpm@9.2.0",
"packageManager": "pnpm@9.5.0",
"engines": {
"node": ">= 20.0.0 <21"
},
Expand Down

0 comments on commit 6e222aa

Please sign in to comment.