Skip to content

Commit 9fe037e

Browse files
authored
Replace yarn with pnpm (#5457)
1 parent 7f79d97 commit 9fe037e

File tree

13 files changed

+14075
-12048
lines changed

13 files changed

+14075
-12048
lines changed

.drone.yml

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,16 @@ steps:
147147
- redis
148148
- api
149149
volumes:
150-
- name: yarn_cache
151-
path: /tmp/cache
150+
- name: pnpm-store
151+
path: /drone/src/.pnpm-store
152152
environment:
153153
CYPRESS_INSTALL_BINARY: 0
154154
commands:
155155
- apk --no-cache add curl
156-
- yarn --frozen-lockfile --cache-folder /tmp/cache
156+
- npm i -g corepack
157+
- corepack enable
158+
- pnpm config set store-dir .pnpm-store
159+
- pnpm install --frozen-lockfile
157160

158161
- name: build
159162
image: node:20-alpine
@@ -164,7 +167,9 @@ steps:
164167
depends_on:
165168
- setup
166169
commands:
167-
- yarn build
170+
- npm i -g corepack
171+
- corepack enable
172+
- pnpm build
168173

169174
- name: test
170175
image: node:20-alpine
@@ -175,7 +180,9 @@ steps:
175180
depends_on:
176181
- setup
177182
commands:
178-
- yarn test
183+
- npm i -g corepack
184+
- corepack enable
185+
- pnpm test
179186

180187
- name: lint
181188
image: node:20-alpine
@@ -186,7 +193,9 @@ steps:
186193
depends_on:
187194
- setup
188195
commands:
189-
- yarn lint
196+
- npm i -g corepack
197+
- corepack enable
198+
- pnpm lint
190199

191200
- name: typescript
192201
image: node:20-slim
@@ -197,7 +206,9 @@ steps:
197206
depends_on:
198207
- setup
199208
commands:
200-
- yarn types
209+
- npm i -g corepack
210+
- corepack enable
211+
- pnpm types
201212
failure: ignore
202213

203214
- name: install_cypress
@@ -211,7 +222,9 @@ steps:
211222
environment:
212223
CYPRESS_CACHE_FOLDER: /drone/src/.cypress_cache
213224
commands:
214-
- yarn workspace lego-webapp cypress install
225+
- npm i -g corepack
226+
- corepack enable
227+
- pnpm --filter lego-webapp exec cypress install
215228

216229
- name: frontend
217230
image: node:20-alpine
@@ -228,7 +241,9 @@ steps:
228241
WS_URL: ws://api:8000
229242
ENVIRONMENT: ci
230243
commands:
231-
- yarn workspace lego-webapp preview
244+
- npm i -g corepack
245+
- corepack enable
246+
- pnpm --filter lego-webapp preview
232247

233248
- name: cypress
234249
image: cypress/browsers:node-20.18.0-chrome-130.0.6723.69-1-ff-131.0.3-edge-130.0.2849.52-1
@@ -253,7 +268,9 @@ steps:
253268
commands:
254269
- ./wait-for-it.sh -t 180 frontend:3000
255270
- ./wait-for-it.sh -t 180 legocypresshelper:3030
256-
- yarn workspace lego-webapp cypress run --record
271+
- npm i -g corepack
272+
- corepack enable
273+
- pnpm --filter lego-webapp exec cypress run --record
257274

258275
- name: docker
259276
image: plugins/docker
@@ -315,13 +332,13 @@ steps:
315332
- build
316333

317334
volumes:
318-
- name: yarn_cache
335+
- name: pnpm-store
319336
host:
320-
path: /tmp/drone-cache/yarn
337+
path: /tmp/drone-cache/pnpm
321338

322339
image_pull_secrets:
323340
- dockerconfigjson
324341

325342
---
326343
kind: signature
327-
hmac: 1f637c635932b8fe0fb1eb246ac53a05e18bd98a537d9f600aecb2701667773c
344+
hmac: a95a62f4328792b24179fb0d7e53961e15c410622f6cad6b359c0abe25bd9c1c

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
FROM node:20-alpine AS builder
2+
ENV PNPM_HOME="/pnpm"
3+
ENV PATH="$PNPM_HOME:$PATH"
24

35
WORKDIR /app/
4-
COPY package.json yarn.lock ./
6+
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
57
COPY lego-webapp/package.json lego-webapp/package.json
68
COPY packages packages
79

10+
RUN corepack enable
811
RUN apk add curl # For Mazemap installation
9-
RUN yarn install
12+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
1013

1114
COPY . /app
1215

@@ -24,7 +27,7 @@ ENV SENTRY_URL=${SENTRY_URL}
2427
ENV SENTRY_RELEASE=${RELEASE}
2528
ENV NODE_ENV=production
2629

27-
RUN yarn build
30+
RUN pnpm build
2831

2932
FROM node:20-alpine
3033

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
## Quick Start
1919

20-
> For all the alternative ways to run the project, you will need to run `yarn build` to compile [lego-bricks](#lego-bricks) the first time you run the project. After this, it will build automatically when changed.
20+
> For all the alternative ways to run the project, you will need to run `pnpm build` to compile [lego-bricks](#lego-bricks) the first time you run the project. After this, it will build automatically when changed.
2121
2222
```bash
23-
$ yarn # Install dependencies
24-
$ yarn build # Compile LEGO-BRICKS - only required the first time you run the project
25-
$ yarn dev:staging # Start webserver with development backend
23+
$ pnpm # Install dependencies
24+
$ pnpm build # Compile LEGO-BRICKS - only required the first time you run the project
25+
$ pnpm dev:staging # Start webserver with development backend
2626
```
2727

2828
Everything should be up and running on [localhost:3000](http://localhost:3000). The `:staging` suffix points the webserver at a hosted development backend.
@@ -32,16 +32,16 @@ Everything should be up and running on [localhost:3000](http://localhost:3000).
3232
First, you need to have the `django` backend running, see [webkom/lego](https://github.com/webkom/lego).
3333

3434
```bash
35-
$ yarn dev # Start webserver with local backend
35+
$ pnpm dev # Start webserver with local backend
3636
```
3737

3838
### Server side rendering (Optional)
3939

4040
In production (live) we use server side rendering. Due to bad hot reloading, we don't use it by default in dev. The server side renderer can be started by running:
4141

4242
```bash
43-
$ yarn build
44-
$ yarn preview # or yarn preview:staging
43+
$ pnpm build
44+
$ pnpm preview # or pnpm preview:staging
4545
```
4646

4747
### Environment Variables
@@ -52,18 +52,18 @@ The `webserver` running the frontend can take many optional environment variable
5252

5353
To facilitate using components from LEGO-WEBAPP in other projects, certain components have been split out to a separate package — LEGO-BRICKS. That package is stored within this repo, under `/packages/lego-bricks`.
5454

55-
The current build structure requires that `lego-bricks` be compiled to run the project, which can be done either by running `yarn build` in the root directory, or by navigating to the package and running the same command there.
55+
The current build structure requires that `lego-bricks` be compiled to run the project, which can be done either by running `pnpm build` in the root directory, or by navigating to the package and running the same command there.
5656

5757
## Development
5858

5959
We use some conventions and tools for our JavaScript/React development.
6060

6161
- [prettier](https://github.com/prettier/prettier) for JS code formatter.
62-
- `yarn prettier`
62+
- `pnpm prettier`
6363
- [eslint](https://eslint.org/) for finding and fixing problems in your JavaScript code.
64-
- `yarn lint`
64+
- `pnpm lint`
6565
- [TypeScript](https://www.typescriptlang.org) for type checking.
66-
- `yarn types`
66+
- `pnpm types`
6767

6868
We recommend getting plugins/extensions in `VSCode` or `Vim` so the code auto-formats, and automatically prompts you with errors. When you submit code to Github the CI server will automatically run all the commands above to check that your code is up to par.
6969

@@ -74,16 +74,16 @@ We recommend getting plugins/extensions in `VSCode` or `Vim` so the code auto-fo
7474
Run all the tests and check for lint errors with the command:
7575

7676
```bash
77-
$ yarn test
77+
$ pnpm test
7878
```
7979

8080
For development you can run the tests continuously by using:
8181

8282
```bash
83-
$ yarn test:watch
83+
$ pnpm test:watch
8484
```
8585

86-
A coverage report can be generated by running `yarn test -- --coverage`.
86+
A coverage report can be generated by running `pnpm test -- --coverage`.
8787

8888
</details>
8989

@@ -118,26 +118,26 @@ docker compose restart lego_cypress_helper # Make sure the copy is of the clean
118118
Start up the node server
119119

120120
```bash
121-
$ yarn dev
121+
$ pnpm dev
122122
```
123123

124124
And start cypress in another terminal
125125

126126
```bash
127-
$ yarn cypress open
127+
$ pnpm cypress open
128128
```
129129

130130
**Alternative:** You can also run the node server with server side rendering enabled. This is how the tests are run on CI. To do this, you build and start the server
131131

132132
```bash
133-
$ yarn build
134-
$ yarn preview
133+
$ pnpm build
134+
$ pnpm preview
135135
```
136136

137137
And you run cypress headlessly (no visible browser) in another terminal
138138

139139
```bash
140-
yarn cypress run
140+
pnpm cypress run
141141
```
142142

143143
#### STRIPE
@@ -165,7 +165,7 @@ $ daphne lego.asgi:application -b 0.0.0.0 -p 8001
165165
Lastly, one has to run the frontend without captcha:
166166

167167
```bash
168-
$ SKIP_CAPTCHA=TRUE yarn dev
168+
$ SKIP_CAPTCHA=TRUE pnpm dev
169169
```
170170

171171
</details>

lego-webapp/package.json

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
"license": "MIT",
88
"scripts": {
99
"dev": "vike dev",
10-
"dev:staging": "API_URL=https://lego-staging.abakus.no/api/v1 BASE_URL=https://lego-staging.abakus.no WS_URL=wss://ws-staging.abakus.no CAPTCHA_KEY=1x00000000000000000000AA ENVIRONMENT=local_staging yarn dev",
11-
"start": "echo '\\033[0;31mUse `yarn dev` instead' && yarn dev",
12-
"start:staging": "echo '\\033[0;31mUse `yarn dev:staging` instead' && yarn dev:staging",
10+
"dev:staging": "API_URL=https://lego-staging.abakus.no/api/v1 BASE_URL=https://lego-staging.abakus.no WS_URL=wss://ws-staging.abakus.no CAPTCHA_KEY=1x00000000000000000000AA ENVIRONMENT=local_staging pnpm dev",
11+
"start": "echo '\\033[0;31mUse `pnpm dev` instead\\033[0m' && pnpm dev",
12+
"start:staging": "echo '\\033[0;31mUse `pnpm dev:staging` instead\\033[0m' && pnpm dev:staging",
1313
"build": "vike build",
1414
"preview": "NODE_ENV=production node dist/server/index.mjs",
15-
"preview:staging": "API_URL=https://lego-staging.abakus.no/api/v1 BASE_URL=https://lego-staging.abakus.no WS_URL=wss://ws-staging.abakus.no CAPTCHA_KEY=1x00000000000000000000AA ENVIRONMENT=local_staging yarn preview",
16-
"ssr": "echo '\\033[0;31mUse `yarn preview` instead' && yarn preview",
17-
"ssr:staging": "echo '\\033[0;31mUse `yarn preview:staging` instead' && yarn preview:staging",
15+
"preview:staging": "API_URL=https://lego-staging.abakus.no/api/v1 BASE_URL=https://lego-staging.abakus.no WS_URL=wss://ws-staging.abakus.no CAPTCHA_KEY=1x00000000000000000000AA ENVIRONMENT=local_staging pnpm preview",
16+
"ssr": "echo '\\033[0;31mUse `pnpm preview` instead\\033[0m' && pnpm preview",
17+
"ssr:staging": "echo '\\033[0;31mUse `pnpm preview:staging` instead\\033[0m' && pnpm preview:staging",
1818
"test": "vitest run",
19-
"lint": "yarn lint:js && yarn lint:prettier",
19+
"lint": "pnpm lint:js && pnpm lint:prettier",
2020
"lint:js": "eslint .",
2121
"lint:prettier": "prettier '**/*.{ts,tsx,js,css,md,json}' --check",
2222
"types": "tsc --noEmit",
@@ -32,35 +32,46 @@
3232
"@stripe/react-stripe-js": "^3.1.1",
3333
"@stripe/stripe-js": "^5.7.0",
3434
"@vitejs/plugin-react": "^4.3.4",
35-
"@webkom/lego-bricks": "^1.3.6",
36-
"@webkom/lego-editor": "^2.6.2",
37-
"@webkom/mazemap": "^2.2.1",
35+
"@webkom/lego-bricks": "workspace:*",
36+
"@webkom/lego-editor": "^2.6.3",
37+
"@webkom/mazemap": "workspace:*",
3838
"@webkom/react-meter-bar": "^2.0.0",
3939
"@webkom/react-prepare": "^1.2.0",
40+
"classnames": "^2.5.1",
4041
"cookie": "^1.0.2",
42+
"cropperjs": "^1.6.2",
4143
"express": "^4.21.2",
4244
"file-saver": "^2.0.5",
4345
"final-form": "^4.20.10",
4446
"final-form-arrays": "^3.1.0",
4547
"fuzzy": "^0.1.3",
48+
"immer": "^10.1.1",
4649
"isomorphic-fetch": "^3.0.0",
4750
"js-cookie": "^3.0.5",
4851
"jsdom": "^26.0.0",
4952
"jszip": "^3.10.1",
5053
"jwt-decode": "^4.0.0",
5154
"linkify-react": "^4.2.0",
5255
"linkifyjs": "^4.2.0",
56+
"lodash": "^4.17.21",
57+
"lucide-react": "catalog:",
5358
"minireset.css": "^0.0.7",
59+
"moment": "^2.30.1",
5460
"moment-timezone": "^0.5.47",
5561
"node-htmldiff": "^0.9.4",
5662
"normalizr": "^3.6.2",
57-
"react": "^18.3.1",
63+
"postcss-custom-media": "^11.0.3",
64+
"qs": "^6.14.0",
65+
"react": "catalog:",
66+
"react-aria-components": "catalog:",
5867
"react-canvas-confetti": "^2.0.7",
5968
"react-cropper": "^2.3.3",
60-
"react-dom": "^18.3.1",
69+
"react-dom": "catalog:",
70+
"react-dropzone": "^14.3.8",
6171
"react-final-form": "^6.5.9",
6272
"react-final-form-arrays": "^3.1.4",
6373
"react-helmet-async": "^2.0.5",
74+
"react-image-crop": "^11.0.7",
6475
"react-infinite-scroller": "^1.2.6",
6576
"react-overlays": "^5.2.1",
6677
"react-phone-number-input": "^3.4.12",
@@ -77,6 +88,7 @@
7788
"react-youtube": "^10.1.0",
7889
"recharts": "^2.15.1",
7990
"redux-logger": "^3.0.6",
91+
"reselect": "^5.1.1",
8092
"slugify": "^1.6.6",
8193
"validator": "^13.12.0",
8294
"vaul": "^1.1.2",
@@ -90,30 +102,32 @@
90102
"@eslint/js": "^9.20.0",
91103
"@sentry/vite-plugin": "^3.1.2",
92104
"@types/cookie-parser": "^1.4.8",
105+
"@types/express": "^5.0.0",
93106
"@types/isomorphic-fetch": "^0.0.39",
94107
"@types/js-cookie": "^3.0.6",
95108
"@types/jsdom": "^21.1.7",
96-
"@types/react": "^18.3.18",
97-
"@types/react-dom": "^18.3.5",
109+
"@types/react": "catalog:",
110+
"@types/react-dom": "catalog:",
98111
"@types/redux-logger": "^3.0.13",
99112
"@types/validator": "^13.12.2",
113+
"@typescript-eslint/parser": "^8.26.1",
100114
"cypress": "^14.1.0",
101115
"enzyme": "^3.11.0",
102-
"eslint": "^9.20.1",
116+
"eslint": "catalog:",
103117
"eslint-config-prettier": "^10.0.1",
104118
"eslint-import-resolver-typescript": "^3.8.2",
105119
"eslint-plugin-cypress": "^4.1.0",
106120
"eslint-plugin-import-x": "^4.6.1",
107121
"eslint-plugin-react": "^7.37.4",
108122
"eslint-plugin-react-hooks": "^5.1.0",
109123
"globals": "^15.15.0",
110-
"prettier": "^3.5.1",
111-
"typescript": "^5.7.3",
124+
"typescript": "catalog:",
112125
"typescript-eslint": "^8.24.0",
113126
"utility-types": "^3.11.0",
114127
"vike": "^0.4.223",
115-
"vite": "^6.1.0",
116-
"vite-css-modules": "^1.8.4"
128+
"vite": "catalog:",
129+
"vite-css-modules": "^1.8.4",
130+
"vitest": "catalog:"
117131
},
118132
"prettier": {
119133
"singleQuote": true

lego-webapp/pages/lending/@lendableObjectId/request/new/+Page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
LegoFinalForm,
1010
SubmitButton,
1111
TextInput,
12-
} from 'lego-webapp/components/Form';
12+
} from '~/components/Form';
1313
import HTTPError from '~/components/errors/HTTPError';
1414
import { createLendingRequest } from '~/redux/actions/LendingRequestActions';
1515
import { useAppDispatch } from '~/redux/hooks';

0 commit comments

Comments
 (0)