Skip to content

Commit 0165dde

Browse files
authored
Merge pull request #73 from infinum/feat/switch-to-pnpm
Switch package manager to pnpm
2 parents c42dff3 + 91555b8 commit 0165dde

File tree

19 files changed

+18286
-27731
lines changed

19 files changed

+18286
-27731
lines changed

.github/workflows/pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
jobs:
77
test-analyze:
88
name: 'Run'
9-
uses: infinum/js-pipeline/.github/workflows/pipeline.yml@master
9+
uses: infinum/js-pipeline/.github/workflows/pipeline.yml@main
1010
with:
11-
ci_steps: 'lint test analyze'
11+
ci_steps: 'lint test'
1212
workflow: '.github/workflows/pr.yml'
1313
environment: 'staging'

.vscode/settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@
1515
},
1616
"typescript.preferences.importModuleSpecifier": "non-relative",
1717
"editor.codeActionsOnSave": ["source.fixAll.format", "source.fixAll.eslint"],
18-
"typescript.tsdk": "node_modules/typescript/lib"
18+
"typescript.tsdk": "node_modules/typescript/lib",
19+
"i18n-ally.localesPaths": ["public/locales", "src/components/shared/messages"],
20+
"[dockerfile]": {
21+
"editor.defaultFormatter": "ms-azuretools.vscode-docker"
22+
}
1923
}

Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM node:20.10.0-bookworm AS base
2+
WORKDIR /app
3+
ENV PNPM_HOME="/pnpm"
4+
ENV PATH="$PNPM_HOME:$PATH"
5+
6+
RUN npm install -g [email protected]
7+
8+
# # # PROJECT
9+
FROM base as project
10+
COPY . .
11+
12+
# # # PROD DEPENDENCIES
13+
FROM project AS prod-dependencies
14+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile --ignore-scripts
15+
16+
# # # BUILDER
17+
FROM project AS builder
18+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --ignore-scripts
19+
20+
ARG NEXT_PUBLIC_BUGSNAG_API_KEY
21+
22+
RUN pnpm build
23+
24+
# # # RUNNER
25+
FROM base AS runner
26+
COPY --from=prod-dependencies /app/node_modules /app/node_modules
27+
28+
COPY --from=builder /app/.next/standalone/ /app/.next/standalone
29+
COPY --from=builder /app/.next/static /app/.next/standalone/.next/static
30+
COPY --from=builder /app/public /app/.next/standalone/public
31+
32+
CMD ["node", ".next/standalone/server.js"]

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
```bash
2626
# Install dependencies
27-
npm ci
27+
pnpm i
2828

2929
# Start the dev server
30-
npm run dev
30+
pnpm dev
3131
```
3232

3333
Use one of the user credentials to log in to the application
@@ -120,13 +120,13 @@ If you need to start a new project from this template, you have these options:
120120
1. Stripped down version of the App from `project-starter-template` branch
121121

122122
```bash
123-
npx create-next-app@latest PROJECT_NAME -e https://github.com/infinum/JS-React-Example/tree/project-starter-template --use-npm
123+
pnpx create-next-app@latest PROJECT_NAME -e https://github.com/infinum/JS-React-Example/tree/project-starter-template --use-pnpm
124124
```
125125

126126
2. Full-blown example App from the `master` branch
127127

128128
```bash
129-
npx create-next-app@latest PROJECT_NAME -e https://github.com/infinum/JS-React-Example --use-npm
129+
pnpx create-next-app@latest PROJECT_NAME -e https://github.com/infinum/JS-React-Example --use-pnpm
130130
```
131131

132132
> Note: replace PROJECT_NAME with the name of your project
@@ -141,7 +141,6 @@ git push -u origin main
141141

142142
> Note: Replace REPOSITORY_NAME with the name of your repository. These commands will add the remote repository, rename the branch to main, and push your changes to the remote repository.
143143
144-
145144
# Credits
146145

147146
JS-React-Example is maintained by

README.template.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626

2727
### Prerequisites / Dependencies
2828

29-
You will need to have NodeJS and NPM installed to run this application. Use the [handbook guide](https://infinum.com/handbook/frontend/node/managing-node-npm-versions) to set up the correct NodeJS version.
29+
You will need to have NodeJS and pNPM installed to run this application. Use the Infinum handbooks to set up the [package manager](https://infinum.com/handbook/frontend/node/package-managers-guidelines) and [NodeJS version](https://infinum.com/handbook/frontend/node/managing-node-npm-versions).
3030

3131
### Installation
3232

3333
1. clone this repository: `git clone [TODO:GIT_LINK]`
34-
2. install all the dependencies: `npm ci`
34+
2. install all the dependencies: `pnpm i`
3535

3636
### Post-install
3737

@@ -51,8 +51,8 @@ To build the app you can use some of the following commands:
5151
npm run build
5252
5353
# TODO: development and production builds if applicable
54-
# npm run build:dev
55-
# npm run build:prod
54+
# pnpm build:dev
55+
# pnpm build:prod
5656
5757
```
5858

@@ -63,9 +63,9 @@ npm run build
6363
To start the unit tests you can use one of the following commands:
6464

6565
```
66-
npm run test
67-
npm run test:watch
68-
npm run test:coverage
66+
pnpm test
67+
pnpm test:watch
68+
pnpm test:coverage
6969
7070
```
7171

@@ -106,10 +106,10 @@ You can specify environment variables as per the guide in the [Nuts & Bolts](htt
106106

107107
### List of environment variables
108108

109-
| Variable | Requirement | Description |
110-
| ---------------- | ----------- | ---------------------------------------------------------- |
111-
| API_HOST | required | API endpoint URL |
112-
| ENV | required | Available options: development, production |
109+
| Variable | Requirement | Description |
110+
| -------- | ----------- | ------------------------------------------ |
111+
| API_HOST | required | API endpoint URL |
112+
| ENV | required | Available options: development, production |
113113

114114
## Deployment
115115

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const customJestConfig = {
2323
// Handle module aliases (this will be automatically configured for you soon)
2424
'^@/(.*)$': '<rootDir>/src/$1',
2525
'^test-utils$': '<rootDir>/scripts/test-utils',
26+
'lodash-es': 'lodash',
2627
},
2728
// if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work
2829
moduleDirectories: ['node_modules', '<rootDir>/'],

0 commit comments

Comments
 (0)