Skip to content

Commit

Permalink
build: 🔧 migrate npm to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
nutfdt committed Dec 12, 2024
1 parent e8fc31c commit d14ccbd
Show file tree
Hide file tree
Showing 6 changed files with 13,183 additions and 18 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/install-pnpm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Install pnpm

on:
workflow_call:

jobs:
install-pnpm:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
21 changes: 12 additions & 9 deletions .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ jobs:
run: pip install pre-commit
- name: Install Prettier
working-directory: frontend
uses: ./.github/workflows/install-pnpm.yaml
run: |
npm ci
npm run format-check
pnpm ci
pnpm run format-check
- run: pre-commit run --all-files

build-backend:
Expand All @@ -32,7 +33,9 @@ jobs:

build-frontend:
name: Build Frontend
uses: ./.github/workflows/build.yml
uses: |
./.github/workflows/build.yml
./.github/workflows/install-pnpm.yaml
with:
image: ghcr.io/dnum-mi/basegun/basegun-frontend
context: ./frontend
Expand Down Expand Up @@ -62,12 +65,12 @@ jobs:
name: Test Frontend Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Prettier check
working-directory: frontend
uses: ./.github/workflows/install-pnpm.yaml
run: |
npm ci
npm run format-check
pnpm ci
pnpm run format-check
test-e2e:
name: Run E2E tests
Expand All @@ -84,9 +87,9 @@ jobs:
uses: cypress-io/github-action@v6
with:
working-directory: ./frontend
build: npm run build
start: npm run start
command: npm run test:e2e-ci
build: pnpm run build
start: pnpm run start
command: pnpm run test:e2e-ci
- name: Install pycobertura
run: pip install pycobertura
- name: Generate cobertura report
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ repos:
hooks:
- id: prettier
name: prettier
entry: bash -c 'cd ./frontend && npm run format'
entry: bash -c 'cd ./frontend && pnpm run format'
language: system
files: ^frontend/
6 changes: 3 additions & 3 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ FROM node:20-slim AS base

WORKDIR /app

COPY ./package.json ./package-lock.json ./
RUN npm ci
COPY ./package*.json ./ ./pnpm-lock.yaml ./
RUN pnpm ci

COPY . .

FROM base AS build

RUN npm run build
RUN pnpm run build

FROM nginxinc/nginx-unprivileged:1.24-alpine AS prod

Expand Down
10 changes: 5 additions & 5 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
## How to run ?

```bash
npm install
npm run start
pnpm install
pnpm run start
```

## How to run automated tests ?

1. Make sure the bakend stack is running by running `docker compose up -d` in the backend folder.
2. Make sure all the dependencies are installed by running `npm install` in the frontend folder.
3. Make sure the frontend is running : `npm run start`
2. Make sure all the dependencies are installed by running `pnpm install` in the frontend folder.
3. Make sure the frontend is running : `pnpm run start`

```bash
npm run test:e2e-ci
pnpm run test:e2e-ci
```

## How to check code coverage ?
Expand Down
Loading

0 comments on commit d14ccbd

Please sign in to comment.