Skip to content

Commit 769dd47

Browse files
chore: migrate from npm to pnpm (#458)
1 parent 5117b80 commit 769dd47

File tree

8 files changed

+4644
-11371
lines changed

8 files changed

+4644
-11371
lines changed

.github/workflows/pr-tests.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,28 @@ jobs:
2222
- name: Checkout code
2323
uses: actions/checkout@v4
2424

25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v4
27+
with:
28+
version: 9
29+
2530
- name: Set up Node.js
2631
uses: actions/setup-node@v4
2732
with:
2833
node-version: ${{ matrix.node-version }}
34+
cache: 'pnpm'
2935

3036
- name: Install modules
31-
run: npm ci
37+
run: pnpm install
3238

3339
- name: Check code formatting
34-
run: npm run lint
40+
run: pnpm run lint
3541

3642
- name: Generate Prisma Client
37-
run: npm run prisma:gen
43+
run: pnpm run prisma:gen
3844

3945
- name: Build
40-
run: npm run build
46+
run: pnpm run build
4147

4248
- name: Run unit tests
43-
run: npm run test
49+
run: pnpm run test

.github/workflows/tests.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,16 @@ jobs:
6262
- name: Checkout code
6363
uses: actions/checkout@v4
6464

65+
- name: Install pnpm
66+
uses: pnpm/action-setup@v4
67+
with:
68+
version: 9
69+
6570
- name: Set up Node.js
6671
uses: actions/setup-node@v4
6772
with:
6873
node-version: ${{ matrix.node-version }}
74+
cache: 'pnpm'
6975

7076
- name: Cache Node.js modules
7177
uses: actions/cache@v4
@@ -76,22 +82,22 @@ jobs:
7682
${{ runner.os }}-node-${{ matrix.node-version }}
7783
7884
- name: Install dependencies
79-
run: npm ci
85+
run: pnpm install
8086

8187
- name: Run linting
82-
run: npm run lint
88+
run: pnpm run lint
8389

8490
- name: Run database migrations
85-
run: npm run db:migrate
91+
run: pnpm run db:migrate
8692

8793
- name: Run database seed
88-
run: npm run db:seed
94+
run: pnpm run db:seed
8995

9096
- name: Build the app
91-
run: npm run build
97+
run: pnpm run build
9298

9399
- name: Run unit tests
94-
run: npm run test
100+
run: pnpm run test
95101

96102
- name: Run e2e tests
97-
run: npm run test:e2e
103+
run: pnpm run test:e2e

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
To ensure consistency throughout the source code, keep these rules in mind as you are working:
2222

2323
- All features or bug fixes must be tested by one or more specs (unit-tests).
24-
- We follow [Google's JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html), but wrap all code at 100 characters. An automated formatter is available (`npm run lint:fix`).
24+
- We follow [Google's JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html), but wrap all code at 100 characters. An automated formatter is available (`pnpm run lint:fix`).
2525

2626
## Commit Message Guidelines
2727

Dockerfile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
11
# Use an official Node.js runtime as the base image
22
FROM node:18 AS builder
33

4+
# Install pnpm
5+
RUN npm install -g pnpm
6+
47
# Set the working directory inside the container
58
WORKDIR /app
69

7-
# Copy package.json and package-lock.json to the working directory
8-
COPY package*.json ./
10+
# Copy package.json and pnpm-lock.yaml to the working directory
11+
COPY package.json pnpm-lock.yaml ./
912
COPY prisma ./prisma/
1013

1114
# Install the app dependencies
12-
RUN npm install
15+
RUN pnpm install
1316

1417
# Copy the rest of the application code
1518
COPY . .
1619

1720
# Run the prisma generator
18-
RUN npm run prisma:gen
21+
RUN pnpm run prisma:gen
1922

2023
# Build the application
21-
RUN npm run build
24+
RUN pnpm run build
2225

2326
# Stage 2: A minimal Docker image with node and compiled app
2427
FROM node:18
2528

29+
# Install pnpm
30+
RUN npm install -g pnpm
31+
2632
# Set the working directory inside the container
2733
WORKDIR /app
2834

2935
COPY --from=builder /app/node_modules ./node_modules
30-
COPY --from=builder /app/package*.json ./
36+
COPY --from=builder /app/package.json ./
37+
COPY --from=builder /app/pnpm-lock.yaml ./
3138
COPY --from=builder /app/dist ./dist
3239
COPY --from=builder /app/prisma ./prisma
3340
COPY --from=builder /app/tsconfig.* ./
@@ -37,4 +44,4 @@ COPY --from=builder /app/common ./common
3744
EXPOSE 3000
3845

3946
# Start the application in production mode
40-
CMD ["npm", "run", "start:prod"]
47+
CMD ["pnpm", "run", "start:prod"]

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
env_file:
1212
- .env
1313
# Run migrations after the app is ready
14-
command: sh -c "npm run db:migrate && npm run db:seed && npm run start:prod"
14+
command: sh -c "pnpm run db:migrate && pnpm run db:seed && pnpm run start:prod"
1515

1616
db:
1717
image: postgres:14

docs/installation.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
## Prerequisite
1313

1414
- [Node.js](https://nodejs.org/en) (version 18 or higher)
15-
- [npm](https://www.npmjs.com)
15+
- [pnpm](https://pnpm.io)
1616
- Database provider you want to use. We currently support MongoDB, PostgreSQL, MySQL, and SQLite.
1717

1818
## Installation Steps
@@ -23,7 +23,7 @@
2323

2424
1. Install the dependencies
2525

26-
Use `npm install` command, to install all the dependencies.
26+
Use `pnpm install` command, to install all the dependencies.
2727

2828
1. Configure the environment variables
2929

@@ -47,18 +47,18 @@
4747
4848
1. Generate the database
4949

50-
Run **`npm run db:migrate`** command to generate the database.
50+
Run **`pnpm run db:migrate`** command to generate the database.
5151

5252
> You can use `npx prisma migrate deploy` command to run migration in **non-development environments** and if you are using any database providers **other than MongoDB**.
5353
> See the details [here](https://www.prisma.io/docs/reference/api-reference/command-reference#migrate-deploy).
5454
5555
1. Seed the data
5656

57-
Run **`npm run db:seed`** command to seed the data.
57+
Run **`pnpm run db:seed`** command to seed the data.
5858

5959
1. Run the app
6060

61-
Use `npm run start` command, to run the app.
61+
Use `pnpm run start` command, to run the app.
6262

6363
### Installation with Docker
6464

@@ -82,11 +82,11 @@ To run the test, you can use the following command:
8282

8383
```shell
8484
# Run unit tests
85-
npm run test
85+
pnpm run test
8686

8787
# Run e2e test
88-
npm run test:e2e
88+
pnpm run test:e2e
8989

9090
# Run coverage test
91-
npm run test:cov
91+
pnpm run test:cov
9292
```

0 commit comments

Comments
 (0)