Skip to content

Commit 1b8471b

Browse files
committed
👷 Switch to pnpm package manager in starter templates
1 parent bcf3326 commit 1b8471b

9 files changed

Lines changed: 34 additions & 26 deletions

File tree

‎starter/_base/.dockerignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
.gitlab
55
.gitlab-ci.yml
66
.huskyrc.json
7-
.npm
7+
.pnpm-store
88
Dockerfile
99
LICENSE
1010
README.md

‎starter/_base/.gitignore‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ node_modules
22
dist
33
tsconfig.tsbuildinfo
44
junit.xml
5-
coverage
5+
coverage
6+
.pnpm-store
7+
pnpm-debug.log*

‎starter/_base/Dockerfile‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# BUILDER IMAGE
22
FROM node:24.5.0 AS builder
3-
ARG NPM_TOKEN
43
ENV NODE_PATH=.
54
ENV JOBS="max"
65
WORKDIR /usr/src/app
@@ -14,19 +13,19 @@ ENV TINI_VERSION v0.19.0
1413
RUN wget -q https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini -O /tini && \
1514
chmod +x /tini
1615

17-
# important, otherwise postinstall hook fails
18-
RUN npm set progress=false
19-
RUN npm set loglevel=error
16+
ENV PNPM_VERSION=10.33.0
17+
RUN curl -fsSL "https://github.com/pnpm/pnpm/releases/download/v${PNPM_VERSION}/pnpm-linux-x64" \
18+
-o /usr/local/bin/pnpm && chmod +x /usr/local/bin/pnpm
2019
# copy all relevant files
2120
COPY . .
22-
# RUN echo "//registry.npmjs.org//:_authToken=$NPM_TOKEN" >> .npmrc
2321
# install dependencies
24-
RUN npm ci
22+
RUN pnpm install --frozen-lockfile
2523
# compile typescript
26-
RUN npm run build
24+
RUN pnpm run build
2725

2826
# MAIN IMAGE
2927
FROM node:24.5.0-slim
28+
COPY --from=builder /usr/local/bin/pnpm /usr/local/bin/pnpm
3029

3130
ENV NODE_PATH=dist
3231
ENV CFG_JSON_PATH="/config/secrets.json"

‎starter/_base/README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Application configuration is handled by [Configuru](https://github.com/AckeeCZ/c
1717
The whole codebase is checked and improved using lint and prettier, run `lint:fix` and `prettier:fix` before committing changes to git.
1818

1919
```bash
20-
npm run lint:fix
21-
npm run prettier:fix
20+
pnpm lint:fix
21+
pnpm prettier:fix
2222
```
2323

2424
## ✅ Tests
@@ -35,19 +35,19 @@ If you need any prerequisites during tests, use the [setup.ts](src/test/setup.ts
3535
To run tests use the test command:
3636

3737
```bash
38-
npm run test
38+
pnpm test
3939
```
4040

4141
## 🚀 Quick start
4242

4343
1. Build the code
4444

4545
```bash
46-
npm run build
46+
pnpm build
4747
```
4848

4949
2. Start the entrypoint / server
5050

5151
```bash
52-
npm run start
52+
pnpm start
5353
```

‎starter/_base/package.json‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
"test": "mocha",
77
"build": "tsc",
88
"start": "node -r source-map-support/register dist/index.js",
9-
"ci-test:no-coverage": "npm run test -- --parallel=false -R mocha-multi-reporters --reporter-options configFile=.mocha-junit-config.json",
10-
"ci-test": "nyc -a -r cobertura --report-dir output npm run ci-test:no-coverage",
9+
"ci-test:no-coverage": "pnpm test --parallel=false -R mocha-multi-reporters --reporter-options configFile=.mocha-junit-config.json",
10+
"ci-test": "nyc -a -r cobertura --report-dir output pnpm run ci-test:no-coverage",
1111
"prettier": "prettier --check --write '**/*.{ts,js,json,jsonc,md}'",
1212
"lint": "eslint '**/*.ts' -f codeframe --fix",
13-
"codestyle": "npm run lint && npm run prettier",
14-
"ci-lint": "npm run lint -- -f checkstyle -o ./output/checkstyle-result.xml",
13+
"codestyle": "pnpm lint && pnpm prettier",
14+
"ci-lint": "pnpm lint -f checkstyle -o ./output/checkstyle-result.xml",
1515
"cli": "tsx ./src/view/cli/cli.ts"
1616
},
1717
"keywords": [],
@@ -42,5 +42,11 @@
4242
"typescript": "^5.0.0",
4343
"yargs": "^18.0.0"
4444
},
45-
"type": "module"
45+
"devEngines": {
46+
"packageManager": {
47+
"name": "pnpm"
48+
}
49+
},
50+
"type": "module",
51+
"packageManager": "pnpm@10.33.0"
4652
}

‎starter/api/graphql/package.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"version": "1.0.0",
44
"main": "index.js",
55
"scripts": {
6-
"generate:api": "graphql-codegen --config codegen.yml && npm run codestyle",
6+
"generate:api": "graphql-codegen --config codegen.yml && pnpm run codestyle",
77
"build:copy-schema": "mkdir -p ./dist/view/graphql/schema && cp -r ./src/view/graphql/schema ./dist/view/graphql/schema",
8-
"build": "npm run build:copy-schema && tsc"
8+
"build": "pnpm run build:copy-schema && tsc"
99
},
1010
"keywords": [],
1111
"author": "",
@@ -30,6 +30,7 @@
3030
"@graphql-eslint/eslint-plugin": "^4.4.0",
3131
"@types/express": "^5.0.0",
3232
"@types/supertest": "^6.0.0",
33+
"graphql-tag": "^2.0.0",
3334
"supertest": "^7.0.0"
3435
},
3536
"type": "module"

‎starter/api/rest/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"main": "index.js",
55
"scripts": {
6-
"generate:api": "npm run cli openapi generate src/view/rest/spec/openapi.yml && npm run codestyle"
6+
"generate:api": "pnpm run cli openapi generate src/view/rest/spec/openapi.yml && pnpm run codestyle"
77
},
88
"keywords": [],
99
"author": "",

‎starter/api/rest/src/view/cli/openapi/generate.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export const run = async (argv: any): Promise<void> => {
1616

1717
await new Promise((resolve, reject) => {
1818
const process = spawn(
19-
'npx',
20-
['openapi-typescript', yamlFilePath, '--output', tsFilePath],
19+
'pnpm',
20+
['exec', 'openapi-typescript', yamlFilePath, '--output', tsFilePath],
2121
{ stdio: 'inherit' }
2222
)
2323
process.on('exit', resolve)

‎starter/pipeline/cloudrun-gitlab/.gitlab-ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ include:
4848
- component: $CI_SERVER_FQDN/Backend/gitlab-components/audit@v1.0.0
4949
inputs:
5050
job-stage: test
51-
audit-command: npm audit --production --audit-level=high
51+
audit-command: pnpm audit --prod --audit-level=high
5252
# TEST
5353
- component: $CI_SERVER_FQDN/Backend/gitlab-components/test@v1.0.0
5454
inputs:
5555
job-stage: test
56-
test-command: DB_CONNECTION_STRING="postgres://node-app_docker:node-app_docker@postgres:5432/postgres" npm run ci-test
56+
test-command: DB_CONNECTION_STRING="postgres://node-app_docker:node-app_docker@postgres:5432/postgres" pnpm ci-test
5757
postgres-user: node-app_docker
5858
postgres-password: node-app_docker
5959
postgres-db: postgres

0 commit comments

Comments
 (0)