Skip to content

Commit ede0ecc

Browse files
authored
Upgrade to Yarn 4 (#8061)
* updated yarn to version 4 * update readme * update docker iamge for CI * create a tmp dir for yarn stuff during asset compilation * CI? * replace deprecated yarn --frozen-lock flag with --immutable * CI? * CI * remove yarn caching from CI * fix CI * add PR feedback * add yarn 4.4.1 to docker.dev image
1 parent 2b2469c commit ede0ecc

9 files changed

+15278
-11801
lines changed

.circleci/config.yml

+4-15
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
DEV_CACHE=$NORMALIZED_BRANCH docker-compose build base
4040
- run:
4141
name: Prepare dependency folders
42-
command: mkdir -p project/target target ~/.ivy2 ~/.cache/coursier ~/.cache/yarn
42+
command: mkdir -p project/target target ~/.ivy2 ~/.cache/coursier
4343
- restore_cache:
4444
name: Restore target cache
4545
keys:
@@ -50,14 +50,9 @@ jobs:
5050
keys:
5151
- sbt-cache-{{ checksum ".circleci/cache_version" }}-{{ checksum "project/Dependencies.scala" }}
5252
- sbt-cache-{{ checksum ".circleci/cache_version" }}-
53-
- restore_cache:
54-
name: Restore yarn cache
55-
keys:
56-
- yarn-cache-{{ checksum ".circleci/cache_version" }}-{{ checksum "yarn.lock" }}
57-
- yarn-cache-{{ checksum ".circleci/cache_version" }}-
5853
- run:
5954
name: Install frontend dependencies
60-
command: docker-compose run -e PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true base yarn install --frozen-lockfile
55+
command: docker-compose run -e PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true base yarn install --immutable
6156
- run:
6257
name: Assert unique evolution numbers
6358
command: docker-compose run base tools/postgres/dbtool.js assert-unique-evolution-numbers
@@ -110,12 +105,6 @@ jobs:
110105
- "~/.ivy2"
111106
- "~/.cache/coursier"
112107

113-
- save_cache:
114-
name: Save yarn cache
115-
key: yarn-cache-{{ checksum ".circleci/cache_version" }}-{{ checksum "yarn.lock" }}
116-
paths:
117-
- "~/.cache/yarn"
118-
119108
- run:
120109
name: Build webknossos docker image
121110
command: |
@@ -261,7 +250,7 @@ jobs:
261250
- run:
262251
name: Install dependencies and sleep at least 3min
263252
command: |
264-
yarn install --frozen-lockfile &
253+
yarn install --immutable &
265254
sleep 180 &
266255
wait
267256
- run:
@@ -300,7 +289,7 @@ jobs:
300289
- run:
301290
name: Install dependencies
302291
command: |
303-
yarn install --frozen-lockfile
292+
yarn install --immutable
304293
305294
- run:
306295
name: Assert GZIP

.gitignore

+55-34
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,57 @@ velocity.log
99
dist/*
1010
lib_managed/
1111
src_managed/
12-
project/boot/
13-
project/plugins/project/
1412
RUNNING_PID
1513
.cache
1614
.classpath
1715
.project
1816
.settings/
1917
.target/
20-
logs/
18+
./data/
2119
.history
22-
target/
23-
binarydata/
24-
userBinaryData/
25-
binaryData
26-
tracingData/
20+
.eslintcache
21+
*.vscode
22+
.bsp
23+
.env
24+
.bloop
25+
.metals
26+
metals.sbt
27+
28+
29+
# Webknossos
2730
backup/
28-
./data/
29-
fossildb-dev/
31+
binaryData
32+
binarydata/
3033
boot/
34+
conf/application.conf-e
35+
dev-db/
36+
docker-compose.override.yml
37+
fossildb-dev/
38+
!frontend/javascripts/test/snapshots/type-check/.gitkeep
39+
!frontend/javascripts/test/snapshots/debug-htmls/.gitkeep
40+
frontend/javascripts/test/snapshots/debug-htmls/*
41+
frontend/javascripts/test/snapshots/type-check/*
42+
logs/
43+
project/boot/
44+
project/plugins/project/
45+
public-test/test-bundle
46+
public/bundle
47+
public/commit.txt
48+
public/docs
49+
public/docs/frontend-api
50+
public/test-bundle
51+
src/main/scala/rebel.xml
52+
target/
53+
temp-webknossos-schema**
54+
tracingData/
55+
userBinaryData/
56+
57+
# IntelliJ
3158
.idea/
3259
.tmp/
3360
*.iml
3461
.idea_modules/
62+
3563
node_modules/
3664
*.db
3765
*.class
@@ -42,41 +70,34 @@ node_modules/
4270
lifttemplate.iml
4371
lifttemplate.ipr
4472
lifttemplate.iws
45-
src/main/scala/rebel.xml
4673
*.obj
4774
*.zip
4875
*.skp
4976
*.mtl
50-
public/bundle
51-
public/test-bundle
52-
public-test/test-bundle
53-
public/docs
54-
public/commit.txt
5577
/knowledge
5678
conf/github.conf
5779
tmp/
5880
errorShots/
5981
flow-coverage/
60-
public/docs/frontend-api
61-
dev-db/
62-
docker-compose.override.yml
63-
frontend/javascripts/test/snapshots/debug-htmls/*
64-
!frontend/javascripts/test/snapshots/debug-htmls/.gitkeep
65-
frontend/javascripts/test/snapshots/type-check/*
66-
!frontend/javascripts/test/snapshots/type-check/.gitkeep
67-
.eslintcache
82+
83+
84+
# Sublime
6885
*.sublime-project
6986
*.sublime-workspace
70-
**/screenshots/*.diff.png
71-
**/screenshots/*.new.png
87+
88+
# Testing
7289
.nyc_output
7390
coverage
7491
coverage-ts
75-
*.vscode
76-
.bsp
77-
temp-webknossos-schema**
78-
conf/application.conf-e
79-
.env
80-
.bloop
81-
.metals
82-
metals.sbt
92+
**/screenshots/*.diff.png
93+
**/screenshots/*.new.png
94+
95+
# Yarn
96+
.yarn/*
97+
!.yarn/cache
98+
!.yarn/patches
99+
!.yarn/plugins
100+
!.yarn/releases
101+
!.yarn/sdks
102+
!.yarn/versions
103+
tools/proxy/.yarn/*

.yarnrc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

CHANGELOG.unreleased.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
1616
### Changed
1717
- Clicking on a bounding box within the bounding box tab centers it within the viewports and focusses it in the list. [#8049](https://github.com/scalableminds/webknossos/pull/8049)
1818
- For self-hosted versions, the text in the data set upload view was updated to recommend switching to webknossos.org. [#7996](https://github.com/scalableminds/webknossos/pull/7996)
19+
- Updated frontend package management to yarn version 4. [8061](https://github.com/scalableminds/webknossos/pull/8061)
1920

2021
### Fixed
2122

Dockerfile.dev

+3-5
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,13 @@ RUN apt-get update && apt-get install apt-transport-https
1111
# add node package source
1212
RUN curl -sL "https://deb.nodesource.com/setup_${VERSION_NODE}" | bash -
1313

14-
# add yarn package source
15-
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
16-
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
17-
1814
# Install sbt, node & build-essentials
1915
RUN apt-get update \
2016
&& apt-get install -y \
2117
build-essential \
2218
findutils \
2319
nodejs \
2420
postgresql-client \
25-
yarn \
2621
cmake \
2722
git \
2823
libdraco-dev \
@@ -32,3 +27,6 @@ RUN apt-get update \
3227
mesa-utils xvfb libgl1-mesa-dri libglapi-mesa libosmesa6 pkg-config x11proto-xext-dev xserver-xorg-dev libxext-dev libxi-dev \
3328
&& apt-get clean \
3429
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
30+
31+
# Enable corepack for Node (which will install yarn)
32+
RUN corepack enable && corepack install --global yarn@4.4.1

package.json

+2-8
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
"webpack-cli": "^5.1.4",
7474
"webpack-dev-server": "^5.0.2"
7575
},
76-
"optionalDependencies": {},
7776
"scripts": {
7877
"start": "node tools/proxy/proxy.js",
7978
"build": "node --max-old-space-size=4096 node_modules/.bin/webpack --env production",
@@ -213,12 +212,6 @@
213212
"url-join": "^4.0.0",
214213
"worker-loader": "^3.0.8"
215214
},
216-
"resolutions": {
217-
"**/mini-store": "^1.1.0",
218-
"**/redux": "3.7.2",
219-
"**/rc-resize-observer": "^1.4.0",
220-
"**/rc-util": "^5.39.1"
221-
},
222215
"ava": {
223216
"files": [
224217
"./public-test/test-bundle/**/*.{js,jsx}"
@@ -241,5 +234,6 @@
241234
"frontend/javascripts/test/**/*.*"
242235
],
243236
"reporter": "lcov"
244-
}
237+
},
238+
"packageManager": "yarn@4.4.1"
245239
}

project/AssetCompilation.scala

+1-16
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ object AssetCompilation {
2525
try {
2626
val exitValue = startProcess(
2727
yarnPath.value,
28-
List("install", "--frozen-lockfile"),
28+
List("install", "--immutable"),
2929
baseDirectory.value
3030
) ! streams.value.log
3131
if (exitValue != 0)
@@ -84,21 +84,6 @@ object AssetCompilation {
8484
streams.value.log.error("Could not test database entries to stage dir: " + e.getMessage)
8585
}
8686

87-
// copy node_modules for diff_schema.js
88-
{
89-
val nodeSrc = baseDirectory.value / "node_modules"
90-
val nodeDest = target.value / "universal" / "stage" / "node_modules"
91-
val tmpPath = baseDirectory.value / "tmp"
92-
val streamsValue = streams.value.log
93-
94-
tmpPath.mkdirs
95-
startProcess(yarnPath.value, List("init", "-y"), tmpPath) ! streamsValue
96-
startProcess(yarnPath.value, List("add", (nodeSrc / "commander").getAbsolutePath), tmpPath) ! streamsValue
97-
deleteRecursively(nodeDest)
98-
copyRecursively(tmpPath / "node_modules", nodeDest)
99-
deleteRecursively(tmpPath)
100-
}
101-
10287
} dependsOn yarnInstall
10388

10489
private def slickClassesFromDBSchemaTask: Def.Initialize[Task[Seq[File]]] =

0 commit comments

Comments
 (0)