Skip to content

Commit d8ab8f8

Browse files
authored
feat: Replace npm with pnpm (#4932)
Replace npm with a modern alternative, a lot faster for local dev, and doesn't run install scripts automatically Closes #4905
1 parent 0772c3f commit d8ab8f8

5 files changed

Lines changed: 4161 additions & 6410 deletions

File tree

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ You must install:
5252
2. [Google Cloud SDK](https://cloud.google.com/sdk)
5353
3. [Hugo](https://gohugo.io/installation/)
5454
4. [Node JS](https://nodejs.org/) >= 18.17.x
55-
5. [Terraform](https://developer.hashicorp.com/terraform/install) >= 1.5 (for infrastructure changes)
55+
5. [pnpm](https://pnpm.io/installation) (install via `npm install -g pnpm --prefix ~/.local` or `corepack enable pnpm`)
56+
6. [Terraform](https://developer.hashicorp.com/terraform/install) >= 1.5 (for infrastructure changes)
5657

5758
Then you can set up the development environment by cloning the OSV repo and
5859
installing the Poetry dependencies.

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@ build-api-protos:
8989
build-protos: build-osv-protos build-api-protos
9090

9191
run-website:
92-
cd gcp/website/frontend3 && npm install && npm run build
92+
cd gcp/website/frontend3 && pnpm install && pnpm run build
9393
cd gcp/website/blog && hugo --buildFuture -d ../dist/static/blog
9494
cd gcp/website && $(install-cmd) && GOOGLE_CLOUD_PROJECT=oss-vdb OSV_VULNERABILITIES_BUCKET=osv-vulnerabilities $(run-cmd) python main.py
9595

9696
run-website-staging:
97-
cd gcp/website/frontend3 && npm install && npm run build
97+
cd gcp/website/frontend3 && pnpm install && pnpm run build
9898
cd gcp/website/blog && hugo --buildFuture -d ../dist/static/blog
9999
cd gcp/website && $(install-cmd) && GOOGLE_CLOUD_PROJECT=oss-vdb-test OSV_VULNERABILITIES_BUCKET=osv-test-vulnerabilities $(run-cmd) python main.py
100100

101101
run-website-emulator:
102-
cd gcp/website/frontend3 && npm install && npm run build
102+
cd gcp/website/frontend3 && pnpm install && pnpm run build
103103
cd gcp/website/blog && hugo --buildFuture -d ../dist/static/blog
104104
cd gcp/website && $(install-cmd) && DATASTORE_EMULATOR_PORT=5002 $(run-cmd) python frontend_emulator.py
105105

gcp/website/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ FROM node:24.14@sha256:dcac36e9d0d3049214862dac30af9f1ee86fccaa8d3bd3a0399b59d6f
33
WORKDIR /build/frontend3
44

55
# Install dependencies first for better caching
6-
COPY gcp/website/frontend3/package.json gcp/website/frontend3/package-lock.json ./
7-
RUN npm ci
6+
RUN corepack enable pnpm
7+
COPY gcp/website/frontend3/package.json gcp/website/frontend3/pnpm-lock.yaml ./
8+
RUN pnpm install --frozen-lockfile
89

910
COPY gcp/website/frontend3/webpack.prod.js ./
1011
COPY gcp/website/frontend3/img img
1112
COPY gcp/website/frontend3/src src
1213

13-
RUN npm run build:prod
14+
RUN pnpm run build:prod
1415

1516
# Build hugo blogs
1617
# Use the ci image, since it already built the version of hugo we want from source

0 commit comments

Comments
 (0)