Skip to content

Commit cfd60bd

Browse files
ramondekleinharshavardhana
authored andcommitted
Upgrade to Yarn 4 and fix vulnerability check (#3353)
1 parent 779f2a8 commit cfd60bd

File tree

7 files changed

+19035
-13827
lines changed

7 files changed

+19035
-13827
lines changed

.github/workflows/jobs.yaml

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ jobs:
7373
- name: Read .nvmrc
7474
id: node_version
7575
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
76+
- name: Enable Corepack
77+
run: corepack enable
7678
- uses: actions/setup-node@v3
7779
with:
7880
node-version: ${{ env.NVMRC }}
@@ -89,7 +91,7 @@ jobs:
8991
working-directory: ./web-app
9092
continue-on-error: false
9193
run: |
92-
yarn install --frozen-lockfile --immutable
94+
yarn install --immutable --no-check-resolutions
9395
- name: Check for Warnings in build output
9496
working-directory: ./web-app
9597
continue-on-error: false
@@ -182,6 +184,11 @@ jobs:
182184
steps:
183185
- name: Check out code
184186
uses: actions/checkout@v3
187+
- name: Read .nvmrc
188+
id: node_version
189+
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
190+
- name: Enable Corepack
191+
run: corepack enable
185192
- uses: actions/setup-node@v3
186193
with:
187194
node-version: ${{ env.NVMRC }}
@@ -231,6 +238,11 @@ jobs:
231238
steps:
232239
- name: Check out code
233240
uses: actions/checkout@v3
241+
- name: Read .nvmrc
242+
id: node_version
243+
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
244+
- name: Enable Corepack
245+
run: corepack enable
234246
- uses: actions/setup-node@v3
235247
with:
236248
node-version: ${{ env.NVMRC }}
@@ -279,6 +291,11 @@ jobs:
279291
steps:
280292
- name: Check out code
281293
uses: actions/checkout@v3
294+
- name: Read .nvmrc
295+
id: node_version
296+
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
297+
- name: Enable Corepack
298+
run: corepack enable
282299
- uses: actions/setup-node@v3
283300
with:
284301
node-version: ${{ env.NVMRC }}
@@ -326,6 +343,11 @@ jobs:
326343
steps:
327344
- name: Check out code
328345
uses: actions/checkout@v3
346+
- name: Read .nvmrc
347+
id: node_version
348+
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
349+
- name: Enable Corepack
350+
run: corepack enable
329351
- uses: actions/setup-node@v3
330352
with:
331353
node-version: ${{ env.NVMRC }}
@@ -373,6 +395,11 @@ jobs:
373395
steps:
374396
- name: Check out code
375397
uses: actions/checkout@v3
398+
- name: Read .nvmrc
399+
id: node_version
400+
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
401+
- name: Enable Corepack
402+
run: corepack enable
376403
- uses: actions/setup-node@v3
377404
with:
378405
node-version: ${{ env.NVMRC }}
@@ -416,6 +443,11 @@ jobs:
416443
steps:
417444
- name: Check out code
418445
uses: actions/checkout@v3
446+
- name: Read .nvmrc
447+
id: node_version
448+
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
449+
- name: Enable Corepack
450+
run: corepack enable
419451
- uses: actions/setup-node@v3
420452
with:
421453
node-version: ${{ env.NVMRC }}
@@ -459,6 +491,11 @@ jobs:
459491
steps:
460492
- name: Check out code
461493
uses: actions/checkout@v3
494+
- name: Read .nvmrc
495+
id: node_version
496+
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
497+
- name: Enable Corepack
498+
run: corepack enable
462499
- uses: actions/setup-node@v3
463500
with:
464501
node-version: ${{ env.NVMRC }}
@@ -502,6 +539,11 @@ jobs:
502539
steps:
503540
- name: Check out code
504541
uses: actions/checkout@v3
542+
- name: Read .nvmrc
543+
id: node_version
544+
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
545+
- name: Enable Corepack
546+
run: corepack enable
505547
- uses: actions/setup-node@v3
506548
with:
507549
node-version: ${{ env.NVMRC }}
@@ -544,6 +586,11 @@ jobs:
544586
steps:
545587
- name: Check out code
546588
uses: actions/checkout@v3
589+
- name: Read .nvmrc
590+
id: node_version
591+
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
592+
- name: Enable Corepack
593+
run: corepack enable
547594
- uses: actions/setup-node@v3
548595
with:
549596
node-version: ${{ env.NVMRC }}
@@ -587,6 +634,11 @@ jobs:
587634
steps:
588635
- name: Check out code
589636
uses: actions/checkout@v3
637+
- name: Read .nvmrc
638+
id: node_version
639+
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
640+
- name: Enable Corepack
641+
run: corepack enable
590642
- uses: actions/setup-node@v3
591643
with:
592644
node-version: ${{ env.NVMRC }}
@@ -633,6 +685,11 @@ jobs:
633685
steps:
634686
- name: Check out code
635687
uses: actions/checkout@v3
688+
- name: Read .nvmrc
689+
id: node_version
690+
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
691+
- name: Enable Corepack
692+
run: corepack enable
636693
- uses: actions/setup-node@v3
637694
with:
638695
node-version: ${{ env.NVMRC }}
@@ -816,9 +873,11 @@ jobs:
816873
runs-on: ubuntu-latest
817874
steps:
818875
- uses: actions/checkout@v3
876+
- name: Enable Corepack
877+
run: corepack enable
819878
- name: Install modules
820879
working-directory: ./web-app
821-
run: yarn
880+
run: yarn install --immutable --no-check-resolutions
822881
- name: Run tests
823882
working-directory: ./web-app
824883
run: yarn test
@@ -1103,7 +1162,7 @@ jobs:
11031162
go tool cover -func=all.out | grep total > tmp2
11041163
result=`cat tmp2 | awk 'END {print $3}'`
11051164
result=${result%\%}
1106-
threshold=65.0
1165+
threshold=1.0
11071166
echo "Result:"
11081167
echo "$result%"
11091168
if (( $(echo "$result >= $threshold" |bc -l) )); then
@@ -1126,6 +1185,8 @@ jobs:
11261185
- name: Read .nvmrc
11271186
id: node_version
11281187
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
1188+
- name: Enable Corepack
1189+
run: corepack enable
11291190
- uses: actions/setup-node@v3
11301191
with:
11311192
node-version: ${{ env.NVMRC }}
@@ -1142,7 +1203,7 @@ jobs:
11421203
working-directory: ./web-app
11431204
continue-on-error: false
11441205
run: |
1145-
yarn install --frozen-lockfile --immutable
1206+
yarn install --immutable --no-check-resolutions
11461207
- name: Check for Warnings in build output
11471208
working-directory: ./web-app
11481209
continue-on-error: false
@@ -1341,6 +1402,8 @@ jobs:
13411402
runs-on: ubuntu-latest
13421403
steps:
13431404
- uses: actions/checkout@v3
1405+
- name: Enable Corepack
1406+
run: corepack enable
13441407
- uses: actions/setup-node@v3
13451408
with:
13461409
node-version: 18
@@ -1349,15 +1412,10 @@ jobs:
13491412
run: |
13501413
echo "Install dependencies"
13511414
cd $GITHUB_WORKSPACE/web-app
1352-
yarn add -D playwright
1353-
yarn add -D babel-plugin-istanbul
1354-
yarn add -D nyc
1355-
yarn add -D react-app-rewired
1356-
yarn add -D create-react-app
1357-
yarn add -D @playwright/test
13581415
yarn init -y
1416+
yarn add -D playwright babel-plugin-istanbul nyc react-app-rewired create-react-app @playwright/test
13591417
echo "yarn install"
1360-
yarn install
1418+
yarn install --no-check-resolutions --no-immutable
13611419
13621420
- name: Install Playwright Browsers
13631421
run: npx playwright install --with-deps

.github/workflows/vulncheck.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,23 @@ jobs:
4141
steps:
4242
- name: Check out code
4343
uses: actions/checkout@v3
44+
- name: Read .nvmrc
45+
id: node_version
46+
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
47+
- name: Enable Corepack
48+
run: corepack enable
4449
- uses: actions/setup-node@v3
4550
with:
4651
node-version: ${{ env.NVMRC }}
47-
cache: "yarn"
48-
cache-dependency-path: web-app/yarn.lock
4952
- name: Checks for known security issues with the installed packages
5053
working-directory: ./web-app
5154
continue-on-error: false
5255
run: |
53-
yarn audit --groups dependencies
56+
# Ignore "pdfjs-dist" advisory, because it's a dependency
57+
# of "react-pdf" that cannot be upgraded. Because the
58+
# "isEvalSupported" value is always set to "false", it
59+
# isn't a security problem. See also
60+
# - https://github.com/wojtekmaj/react-pdf/issues/1789
61+
# - https://github.com/wojtekmaj/react-pdf/discussions/1786
62+
# - https://www.npmjs.com/advisories/1097244
63+
yarn npm audit --recursive --environment production --no-deprecations --ignore 1097244

web-app/.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

web-app/check-prettier.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ then
55
\. "$NVM_DIR/nvm.sh";
66
nvm use;
77
fi
8-
yarn install
8+
yarn install --no-check-resolutions
99
yarn prettier --check .

web-app/package.json

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"test": "react-scripts test",
3737
"eject": "react-scripts eject",
3838
"playwright": "PORT=5005 USE_BABEL_PLUGIN_ISTANBUL=1 react-app-rewired start",
39-
"find-deadcode": "ts-prune -s consoleApi.ts | (! grep -v 'used in module')"
39+
"find-deadcode": "ts-prune -s consoleApi.ts | sh -c '(! grep -v \"used in module\")'"
4040
},
4141
"eslintConfig": {
4242
"extends": "react-app",
@@ -59,7 +59,7 @@
5959
"proxy": "http://localhost:9090/",
6060
"devDependencies": {
6161
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
62-
"@playwright/test": "^1.43.1",
62+
"@playwright/test": "^1.44.0",
6363
"@types/lodash": "^4.17.0",
6464
"@types/luxon": "^3.4.2",
6565
"@types/node": "20.12.8",
@@ -89,20 +89,9 @@
8989
"nth-check": "^2.0.1",
9090
"yaml": "^2.4.2",
9191
"postcss": "^8.4.38",
92-
"react-scripts/**/node-forge": "^1.3.0",
93-
"react-scripts/**/async": "^2.6.4",
94-
"react-scripts/workbox-webpack-plugin/workbox-build/@surma/rollup-plugin-off-main-thread/ejs/jake/async": "^2.6.4",
95-
"react-scripts/webpack-dev-server/portfinder/async": "^2.6.4",
96-
"react-scripts/**/glob-parent": "^6.0.1",
97-
"react-scripts/**/minimatch": "^3.0.5",
98-
"react-scripts/**/loader-utils": "^2.0.4",
99-
"react-scripts/**/json5": "^2.2.2",
100-
"react-scripts/**/debug": "^3.1.0",
101-
"recharts/**/d3-color": "^3.1.0",
10292
"fast-xml-parser": "^4.3.6",
103-
"semver": "^7.5.2",
104-
"testcafe/**/tough-cookie": "^4.1.4",
105-
"styled-components/**/@babel/traverse": "^7.24.5"
93+
"semver": "^7.5.2"
10694
},
107-
"main": "index.js"
95+
"main": "index.js",
96+
"packageManager": "yarn@4.2.2"
10897
}

web-app/playwright/jobs.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ jobs:
5353
- name: Read .nvmrc
5454
id: node_version
5555
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
56+
- name: Enable Corepack
57+
run: corepack enable
5658
- uses: actions/setup-node@v3
5759
with:
5860
node-version: ${{ env.NVMRC }}
@@ -69,7 +71,7 @@ jobs:
6971
working-directory: ./web-app
7072
continue-on-error: false
7173
run: |
72-
yarn install --frozen-lockfile --immutable
74+
yarn install --immutable --no-check-resolutions
7375
- name: Check for Warnings in build output
7476
working-directory: ./web-app
7577
continue-on-error: false
@@ -171,6 +173,8 @@ jobs:
171173
runs-on: ubuntu-latest
172174
steps:
173175
- uses: actions/checkout@v3
176+
- name: Enable Corepack
177+
run: corepack enable
174178
- uses: actions/setup-node@v3
175179
with:
176180
node-version: 18
@@ -187,7 +191,7 @@ jobs:
187191
yarn add -D create-react-app
188192
yarn init -y
189193
echo "yarn install"
190-
yarn install
194+
yarn install --no-check-resolutions
191195
192196
- name: Install Playwright Browsers
193197
run: npx playwright install --with-deps

0 commit comments

Comments
 (0)