Skip to content

Commit

Permalink
EXUI-1108: Update to yarn v4.5.0 (#1782)
Browse files Browse the repository at this point in the history
* Update to yarn v4.5.0

* add yarn 4.5.0.cjs

* Manually remove line from known issues to check that script exits when difference is detected

* update yarn audit, add pretty print to sh comparison file

* Update version number

* Update audit csript

* remove unused file

* update yarn audit

* Update to release version number
  • Loading branch information
Josh-HMCTS authored Oct 28, 2024
1 parent b9e29d3 commit b7abf6a
Show file tree
Hide file tree
Showing 11 changed files with 10,183 additions and 10,094 deletions.
1 change: 1 addition & 0 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
node-version: 18
- run: corepack enable && yarn --version
- run: yarn install
- run: yarn test:audit
- run: yarn lint
- run: yarn build
- run: yarn test
Expand Down
874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.4.cjs

This file was deleted.

925 changes: 925 additions & 0 deletions .yarn/releases/yarn-4.5.0.cjs

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ compressionLevel: mixed

enableGlobalCache: false

enableStrictSsl: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.6.4.cjs
yarnPath: .yarn/releases/yarn-4.5.0.cjs
3 changes: 3 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## RELEASE NOTES

### Version 7.0.73
**EXUI-1108** Fix yarn npm audit in ccd-case-ui-toolkit

### Version 7.0.71
**EXUI-EXUI-2227** error-handling-specific-access-request

Expand Down
56 changes: 23 additions & 33 deletions bin/run-yarn-audit.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,28 @@
#!/usr/bin/env bash
set +e
yarn audit
result=$?
set -e
#!/bin/bash

if [[ "$result" != 0 ]]; then
if [[ -f yarn-audit-known-issues ]]; then
set +e
yarn audit --json | grep auditAdvisory > yarn-audit-issues
set -e
new_vulnerabilities=false
while read -r line; do
url=$(node -pe 'JSON.parse(process.argv[1]).data.advisory.url' "$line")
if ! grep -q "$url" yarn-audit-known-issues; then
echo "unknown vulnerability:$url"
new_vulnerabilities=true
fi
done < yarn-audit-issues
upToDateVulnerabilities=$(mktemp)
vulnerabilitiesInRepo="./yarn-audit-known-issues"

if [[ "$new_vulnerabilities" = true ]] ; then
echo
echo Security vulnerabilities were found that were not ignored
echo
echo Check to see if these vulnerabilities apply to production
echo and/or if they have fixes available. If they do not have
echo fixes and they do not apply to production, you may ignore them
echo
echo To ignore these vulnerabilities, please add advisories urls
echo "to yarn-audit-known-issues (eg: https://npmjs.com/advisories/755)"
echo
echo and commit the yarn-audit-known-issues file.
yarn npm audit --recursive --environment production --json > "$upToDateVulnerabilities"

exit "$result"
fi
# Ensure both files exist
if [[ ! -f "$upToDateVulnerabilities" || ! -f "$vulnerabilitiesInRepo" ]]; then
echo "Error: One or both required files do not exist."
rm -f "$upToDateVulnerabilities"
exit 1
fi

fi
# Compare the files and act based on the result
if diff_output=$(diff "$upToDateVulnerabilities" "$vulnerabilitiesInRepo"); then
echo "No differences found in vulnerabilities."
else
echo
echo "Security vulnerability differences were found"
echo
echo "To ignore these vulnerabilities, run:"
echo 'yarn npm audit --recursive --environment production --json > yarn-audit-known-issues'
echo
exit 1
fi

rm -f "$upToDateVulnerabilities"
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.0.71",
"version": "7.0.73",
"engines": {
"node": ">=18.19.0"
},
Expand Down Expand Up @@ -237,5 +237,5 @@
"sourceMap": false,
"instrument": false
},
"packageManager": "yarn@3.6.4"
"packageManager": "yarn@4.5.0"
}
2 changes: 1 addition & 1 deletion projects/ccd-case-ui-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.0.71",
"version": "7.0.73",
"engines": {
"node": ">=18.19.0"
},
Expand Down
Empty file removed yarn-audit-issues
Empty file.
44 changes: 43 additions & 1 deletion yarn-audit-known-issues

Large diffs are not rendered by default.

Loading

0 comments on commit b7abf6a

Please sign in to comment.