From: Tiago Melo Date: Mon, 23 Mar 2020 19:54:06 +0000 (-0100) Subject: mgr/dashboard: Check for missing npm resolutions X-Git-Tag: v16.1.0~2808^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F34131%2Fhead;p=ceph.git mgr/dashboard: Check for missing npm resolutions Check if it's necessary to run "npm run fix:audit" before committing the changes. This is important to resolve some issues with building and to fix some npm vulnerabilities. Fixes: https://tracker.ceph.com/issues/44723 Signed-off-by: Tiago Melo --- diff --git a/src/pybind/mgr/dashboard/run-frontend-unittests.sh b/src/pybind/mgr/dashboard/run-frontend-unittests.sh index afb8dd9ae9ca..38c47f8e4d77 100755 --- a/src/pybind/mgr/dashboard/run-frontend-unittests.sh +++ b/src/pybind/mgr/dashboard/run-frontend-unittests.sh @@ -38,13 +38,21 @@ fi # I18N npm run i18n:extract i18n_lint=`awk '/ |$| <\/source>/,/<\/context-group>/ {printf "%-4s ", NR; print}' src/locale/messages.xlf` -if [[ ! -z $i18n_lint ]]; then +if [ "$i18n_lint" ]; then echo -e "The following source translations in 'messages.xlf' need to be \ fixed, please check the I18N suggestions in 'HACKING.rst':\n" echo "${i18n_lint}" failed=true fi +# npm resolutions +npm run fix:audit +resolutions=`git status | grep package-lock.json` +if [ "$resolutions" ]; then + echo "Please run 'npm run fix:audit' before committing." + failed=true +fi + if [ `uname` != "FreeBSD" ]; then deactivate fi