Skip to content

Commit 7f47b34

Browse files
authored
Small pnpm adjustments (#1175)
* build: new try pinning dependencies * build: last missing version pins * build: replace npm with pnpm * build: move sections from package.json, prettier ignore lockfile * build: fix phantom dependencies and remove a few useless ones * build: update ci to use pnpm * build: update Dockerfile * build: update npm calls to pnpm * build: simplify building examples * build: fix e2e tests * build: don't build code in start command * build: update args passing to pnpm (no -- separator) * ci: sync lockfile * docs: update docs to mention pnpm instead of npm * docs: update tools installation guide * chore: formatting * build: bump typescript to 6 * build: bump typescript-eslint * lint: don't ignore docs/examples * lint: ignore buggy rule for `webapp` * chore: fix lint errors in discojs * chore: fix gitignore patterns * chore: formatted previously gitignored code * chore: make knip pass - adjust dependencies - remove unused exports - refine knip config * ci: add knip to ci * chore: sync lockfile * build: deduplicate dependencies * build: make isomorphic-wrtc a workspace dependency * build: add `isomorphic-wrtc` to workspaces * ci: knip ignore dependency (necessary for deduplicating deps) * build: drop corepack * build: don't use pnpm install script either * docs: change pnpm install instructions, document buggy behavior fix * docs: link new file
1 parent fd927ec commit 7f47b34

8 files changed

Lines changed: 292 additions & 243 deletions

File tree

.knip.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"workspaces": {
33
".": {
44
"ignore": ["docs/**"],
5-
"ignoreDependencies": ["typescript-eslint"]
5+
"ignoreDependencies": ["typescript-eslint", "supports-color"]
66
},
77
"webapp": {
88
"ignore": ["env.d.ts"],

DEV.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,7 @@ Use it to install the version we use in DISCO.
7171
nvm install # it reads `.nvmrc` to select the correct version
7272
```
7373

74-
To use pnpm, you can use corepack, which usually comes bundled with Node.js
75-
76-
```
77-
corepack enable
78-
corepack use pnpm
79-
```
74+
To use pnpm, you can follow their [installation instructions](https://pnpm.io/installation)
8075

8176
`nvm` manages your different Node.js versions while `pnpm` handles your different Node.js project packages within one version.
8277

@@ -193,6 +188,7 @@ As there are many guides in the project, here is a table of contents referencing
193188
- [Privacy in DISCO](./docs/PRIVACY.md)
194189
- [Vue.js in DISCO](./docs/VUEJS.md)
195190
- [FAQ](./docs/FAQ.md)
191+
- [Notes about tooling](./docs/TOOLING.md)
196192
- `README` files contain information relevant to their respective module:
197193
- [`server` README](./server/README.md), with API and deployment information
198194
- [`cli` README](./cli/README.md)

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# TODO freeze to 22 until tfjs#8425 is merged
22
FROM node:22 AS builder
33

4-
RUN corepack enable
4+
RUN npm i -g pnpm
55

66
WORKDIR /disco
77

@@ -27,18 +27,17 @@ FROM node:22-slim AS runner
2727

2828
WORKDIR /disco
2929

30-
RUN corepack enable
30+
RUN npm i -g pnpm
3131

3232
COPY --link --from=builder /disco/package.json /disco/pnpm*.yaml /disco/
3333
COPY --link --from=builder /disco/isomorphic-wrtc/package.json isomorphic-wrtc/
3434
COPY --link --from=builder /disco/discojs/package.json discojs/
3535
COPY --link --from=builder /disco/discojs-node/package.json discojs-node/
3636
COPY --link --from=builder /disco/server/package.json server/
3737

38-
# We need to copy the file dependency before installing
39-
COPY --link --from=builder /disco/isomorphic-wrtc/ isomorphic-wrtc/
4038
RUN pnpm --prod ci
4139

40+
COPY --link --from=builder /disco/isomorphic-wrtc/ isomorphic-wrtc/
4241
COPY --link --from=builder /disco/discojs/dist/ discojs/dist/
4342
COPY --link --from=builder /disco/discojs-node/dist/ discojs-node/dist/
4443
COPY --link --from=builder /disco/server/dist/ server/dist/

discojs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"homepage": "https://github.com/epfml/disco#readme",
2020
"dependencies": {
21-
"@epfml/isomorphic-wrtc": "file:../isomorphic-wrtc",
21+
"@epfml/isomorphic-wrtc": "workspace:*",
2222
"@jimp/core": "1.6.1",
2323
"@jimp/plugin-resize": "1.6.1",
2424
"@msgpack/msgpack": "3.1.3",

docs/TOOLING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# General tooling documentation
2+
3+
## Dependencies
4+
5+
We use `supports-color` as a root dev-dependency because when it is not declared it causes some bugs in pnpm v11.9, leading to duplicate dependencies and alternating constantly between versions of dependencies. The goal is to get it removed if the behavior gets fixed in future pnpm versions.
6+
To check with a new version, run `pnpm i`, then remove the dependency and `pnpm i` again. If something changes, it's still broken

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,16 @@
2020
"eslint-plugin-vue": "10.8.0",
2121
"knip": "6.17.1",
2222
"prettier": "3.6.2",
23+
"supports-color": "8.1.1",
2324
"typescript": "catalog:",
2425
"typescript-eslint": "8.62.1",
2526
"vitest": "catalog:"
2627
},
27-
"packageManager": "pnpm@11.8.0+sha512.c1f5e7c4cb241c8f174b743851d82f42b802324afc8b0f116b96adb15aa06664948dde36960a3ba1079ba5b4b29dd0140135b94b5b5f5263592249d68e555f26"
28+
"devEngines": {
29+
"packageManager": {
30+
"name": "pnpm",
31+
"version": ">=11.0.0 <12.0.0",
32+
"onFail": "download"
33+
}
34+
}
2835
}

0 commit comments

Comments
 (0)