Skip to content

Commit 085f554

Browse files
committed
Migrate webpack to RSPack
1 parent 5d64caf commit 085f554

File tree

26 files changed

+13951
-11652
lines changed

26 files changed

+13951
-11652
lines changed

.circleci/config.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,25 @@ jobs:
100100
javascript-tests:
101101
executor:
102102
name: node/default
103-
# The Node version here must be kept in sync with that in `package.json`.
104-
tag: '22.11.0'
103+
# The Node version here should be compatible with `package.json` engines.
104+
# Note: cimg/node requires at least a minor version (e.g., '22.0'), not just major version
105+
tag: '22.0'
105106
steps:
106107
- checkout
107-
- node/install-packages:
108-
# `yarn install --frozen-lockfile` is run and cache is enabled by default for this orb configuration
109-
pkg-manager: yarn
110108
- run:
111-
command: yarn lint
109+
name: Install pnpm
110+
command: sudo corepack enable && corepack prepare [email protected] --activate
111+
- run:
112+
name: Install dependencies
113+
command: pnpm install --frozen-lockfile
114+
- run:
115+
command: pnpm lint
112116
name: Run linting
113117
- run:
114-
command: yarn markdownlint
118+
command: pnpm markdownlint
115119
name: Check markdown linting
116120
- run:
117-
command: yarn test:coverage
121+
command: pnpm test:coverage
118122
name: Run Jest tests
119123
- codecov/upload
120124

@@ -123,10 +127,6 @@ jobs:
123127
- image: 'cimg/python:3.10-node'
124128
steps:
125129
- checkout
126-
- restore_cache:
127-
name: Restore Yarn Package Cache
128-
keys:
129-
- node-deps-v1-{{ .Branch }}
130130
- run: pip install tox
131131
- run:
132132
command: tox -e docs

.markdownlintignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
docs/index.md
2-
node_modules
2+
node_modules
3+
venv
4+
CLAUDE.md

.npmrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# pnpm configuration for Treeherder
2+
3+
# Equivalent to yarn's ignore-engines - don't check engine compatibility
4+
engine-strict=false
5+
6+
# Save exact versions instead of ranges when adding packages
7+
save-exact=true
8+
9+
# Don't run lifecycle scripts during install for security
10+
ignore-scripts=true
11+
12+
# Hoist all dependencies to node_modules root for compatibility
13+
# This makes pnpm behavior similar to npm/yarn flat node_modules
14+
shamefully-hoist=true
15+
16+
# Auto-install peers to avoid peer dependency warnings
17+
auto-install-peers=true

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Ignore generated directories.
22
.*/
3+
venv/
4+
node_modules/
5+
pnpm-lock.yaml
36

47
# Ignore our legacy JS since it will be rewritten when converted to React.
58
ui/js/

.yarnrc

Lines changed: 0 additions & 20 deletions
This file was deleted.

babel.config.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,7 @@
1818
[
1919
"@babel/preset-react",
2020
{
21-
"development": true,
22-
"useSpread": true
23-
}
24-
]
25-
],
26-
"plugins": [
27-
"@babel/plugin-syntax-dynamic-import",
28-
"react-hot-loader/babel",
29-
[
30-
"@babel/plugin-proposal-class-properties",
31-
{
32-
"loose": true
21+
"runtime": "automatic"
3322
}
3423
]
3524
]

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ services:
6060
# https://hub.docker.com/_/node
6161
image: node:23.5.0-alpine3.20
6262
# Installing JS dependencies at runtime so that they share the `node_modules` from the
63-
# host, improving speed (both install and build due to the webpack cache) and ensuring
63+
# host, improving speed (both install and build due to the rspack cache) and ensuring
6464
# the host copy stays in sync (for people that switch back and forth between UI-only
6565
# and full stack Treeherder development).
6666
working_dir: /app
6767
environment:
6868
BACKEND: http://backend:8000
69-
command: sh -c "yarn && yarn start --host 0.0.0.0"
69+
command: sh -c "corepack enable && corepack prepare [email protected] --activate && pnpm install && pnpm start --host 0.0.0.0"
7070
volumes:
7171
- .:/app
7272
ports:

docker/Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
## Frontend stage
2-
FROM node:22.11.0 AS frontend
2+
FROM node:22-slim AS frontend
33

44
WORKDIR /app
55

6+
# Install pnpm
7+
RUN corepack enable && corepack prepare [email protected] --activate
8+
69
COPY ui/ /app/ui/
7-
COPY package.json babel.config.json webpack.config.js yarn.lock /app/
10+
COPY package.json rspack.config.js pnpm-lock.yaml .npmrc /app/
811

9-
RUN npm install -g --force [email protected]
10-
RUN yarn install
11-
RUN yarn build
12+
RUN pnpm install --frozen-lockfile
13+
RUN pnpm build
1214

1315

1416
## Backend stage
@@ -38,7 +40,7 @@ RUN python manage.py collectstatic --noinput
3840
# WhiteNoise can then serve in preference to the originals. This is required
3941
# since WhiteNoise's Django storage backend only gzips assets handled by
4042
# collectstatic, and so does not affect files in the `.build/` directory
41-
# since they are instead generated by webpack.
43+
# since they are instead generated by rspack.
4244
RUN python -m whitenoise.compress .build
4345

4446
RUN groupadd --gid 9500 treeherder && \

docs/backend_tasks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ docker-compose run backend bash
1616

1717
...which saves having to wait for docker-compose to spin up for every test run.
1818

19-
`yarn build` will generate a `.build` directory which will be seen within the `backend` container.
20-
If you don't have `yarn` working on your host you can run this instead `docker-compose run frontend sh -c "yarn && yarn build"`
19+
`pnpm build` will generate a `.build` directory which will be seen within the `backend` container.
20+
If you don't have `pnpm` working on your host you can run this instead `docker-compose run frontend sh -c "corepack enable && pnpm install && pnpm build"`
2121

2222
Then run the individual tools within that shell, like so:
2323

docs/code_style.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Javascript in the [Installation section](installation.md#validating-javascript))
88

99
Prettier is also used to format JSON/CSS/HTML/Markdown/YAML. However these are not supported
1010
by ESLint, so instead are validated using Prettier's CLI. To manually check their formatting
11-
(as well as that of JS/JSX) using Prettier, run `yarn format:check`, or to apply formatting
12-
fixes run `yarn format`.
11+
(as well as that of JS/JSX) using Prettier, run `pnpm format:check`, or to apply formatting
12+
fixes run `pnpm format`.
1313

1414
However we recommend that you instead
1515
[add Prettier to your editor/IDE](https://prettier.io/docs/en/editors.html)

0 commit comments

Comments
 (0)