build(web): use pnpm from corepack (#935)

* feat(web): use pnpm packageManager on package.json

* build(web): add frozen-lockfile to Makefile

* build(docker): use the same node version as Docker image

* build(docker): enable corepack

* build(makefile): use --dir instead of cd for pnpm
This commit is contained in:
Fabricio Silva 2023-05-21 16:05:53 +01:00 committed by GitHub
parent 8925266104
commit 1f76aa38f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 11 deletions

View file

@ -23,15 +23,19 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Set up Node - name: Set up Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 18 node-version: '18.7.0'
cache: 'pnpm'
- name: Set up corepack
run: corepack enable
# It can not be done before enable corepack
- name: Set up cache
uses: actions/setup-node@v3
with:
cache: pnpm
cache-dependency-path: web/pnpm-lock.yaml cache-dependency-path: web/pnpm-lock.yaml
- name: Fetch web dependencies - name: Fetch web dependencies

View file

@ -2,8 +2,8 @@
FROM node:18.7.0-alpine3.16 AS web-builder FROM node:18.7.0-alpine3.16 AS web-builder
COPY . ./ COPY . ./
WORKDIR /web WORKDIR /web
RUN npm install -g pnpm && \ RUN corepack enable &&
pnpm install --frozen-lockfile && \ pnpm install --frozen-lockfile &&
pnpm run build pnpm run build
# build app # build app

View file

@ -15,7 +15,7 @@ BINDIR = bin
all: clean build all: clean build
deps: deps:
cd web && pnpm install pnpm --dir web install --frozen-lockfile
go mod download go mod download
test: test:
@ -30,7 +30,7 @@ build/ctl:
go build -ldflags $(GOFLAGS) -o bin/autobrrctl cmd/autobrrctl/main.go go build -ldflags $(GOFLAGS) -o bin/autobrrctl cmd/autobrrctl/main.go
build/web: build/web:
cd web && pnpm run build pnpm --dir web run build
build/docker: build/docker:
docker build -t autobrr:dev -f Dockerfile . --build-arg GIT_TAG=$(GIT_TAG) --build-arg GIT_COMMIT=$(GIT_COMMIT) docker build -t autobrr:dev -f Dockerfile . --build-arg GIT_TAG=$(GIT_TAG) --build-arg GIT_COMMIT=$(GIT_COMMIT)

View file

@ -77,5 +77,6 @@
"tailwindcss": "^3.1.3", "tailwindcss": "^3.1.3",
"typescript": "^4.7.3", "typescript": "^4.7.3",
"vite": "^4.2.1" "vite": "^4.2.1"
} },
"packageManager": "pnpm@8.5.1"
} }