Skip to content

Commit 438230d

Browse files
authored
Merge pull request #35 from sylhare/pnpm
Use Pnpm
2 parents 37d1528 + 8fe4de7 commit 438230d

File tree

7 files changed

+3511
-5059
lines changed

7 files changed

+3511
-5059
lines changed

.github/dependabot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ updates:
99
docker:
1010
patterns:
1111
- "*"
12-
- package-ecosystem: npm
12+
- package-ecosystem: pnpm
1313
directory: "/"
1414
schedule:
1515
interval: "monthly"

.github/workflows/node.js.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,37 @@ jobs:
1212

1313
steps:
1414
- uses: actions/checkout@v4
15-
- name: Use Node.js 18
15+
16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v4
18+
with:
19+
version: 10
20+
run_install: false
21+
22+
- name: Use Node.js 22
1623
uses: actions/setup-node@v4
1724
with:
18-
node-version: '18'
19-
cache: 'npm'
25+
node-version: '22'
26+
cache: 'pnpm'
27+
cache-dependency-path: 'pnpm-lock.yaml'
2028

2129
- name: Install Dependencies
22-
run: npm ci
30+
run: pnpm install --frozen-lockfile
2331

2432
- name: Run lint
25-
run: npm run lint
33+
run: pnpm run lint
2634

2735
- name: Run test with coverage
28-
run: npm run test:cov
36+
run: pnpm run test:cov
2937

3038
- name: Run Build
31-
run: npm run build
39+
run: pnpm run build
3240

3341
docker:
3442
runs-on: ubuntu-latest
3543

3644
steps:
3745
- uses: actions/checkout@v4
38-
- name: Use Node.js ${{ matrix.node-version }}
39-
uses: actions/setup-node@v4
40-
with:
41-
node-version: '18'
42-
cache: 'npm'
4346

4447
- name: Build docker image
4548
run: docker build -t typescript-project .

Dockerfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
FROM node:24-alpine AS builder
22

3+
# Install pnpm
4+
RUN npm install -g pnpm
5+
36
WORKDIR /app
47
COPY . .
5-
RUN npm install
6-
RUN npm run build
8+
RUN pnpm install
9+
RUN pnpm run build
710

811
FROM node:24-alpine AS production
912

13+
# Install pnpm
14+
RUN npm install -g pnpm
15+
1016
ARG NODE_ENV=production
1117
RUN addgroup -S docker && adduser -S user -G docker
1218

1319
WORKDIR /app
1420

15-
COPY --from=builder --chown=user:docker /app/package*.json ./
21+
COPY --from=builder --chown=user:docker /app/package.json ./
22+
COPY --from=builder --chown=user:docker /app/pnpm-lock.yaml ./
1623
COPY --from=builder --chown=user:docker /app/dist ./dist
17-
RUN npm ci --omit=dev && npm cache clean --force
24+
RUN pnpm install --frozen-lockfile --prod && pnpm store prune
1825

1926
USER user
2027

README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,50 @@
33
Seed project for typescript.
44
Use this repository as a template for your typescript projects.
55

6+
## Prerequisites
7+
8+
This project uses pnpm as the package manager. If you don't have pnpm installed, you can install it using one of the following methods:
9+
10+
### Install pnpm globally via npm
11+
12+
```bash
13+
npm install -g pnpm
14+
```
15+
16+
For other installation methods, visit: https://pnpm.io/installation
17+
618
## Getting Started
719

820
Install the dependencies:
921

1022
```bash
11-
npm install
23+
pnpm install
1224
```
1325

1426
Build the project:
1527

1628
```bash
17-
npm run build
29+
pnpm run build
1830
```
1931

2032
Run the project:
2133

2234
```bash
23-
npm start
35+
pnpm start
2436
```
2537

2638
Test the project using *Jest*:
2739

2840
```bash
29-
npm test
41+
pnpm test
3042
# To test and display the coverage
31-
npm test:cov
43+
pnpm test:cov
3244
```
3345

3446
Lint the project using *ESLint*:
3547

3648
```bash
37-
npm run lint
49+
pnpm run lint
3850
# To fix the linting errors
39-
npm run lint:fix
51+
pnpm run lint:fix
4052
```

jest.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type {Config} from '@jest/types';
1+
import type {Config} from 'jest';
22

3-
const config: Config.InitialOptions = {
3+
const config: Config = {
44
preset: "ts-jest",
55
testRegex: "\\.(test|e2e)\\.ts$",
66
moduleFileExtensions: ["ts", "js", "json"],

0 commit comments

Comments
 (0)