From b7b189c9d1308335efb42b18c45d58a1e8469b82 Mon Sep 17 00:00:00 2001 From: Tiago Melo Date: Mon, 23 Mar 2020 18:54:06 -0100 Subject: [PATCH] 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 --- src/pybind/mgr/dashboard/run-frontend-unittests.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/dashboard/run-frontend-unittests.sh b/src/pybind/mgr/dashboard/run-frontend-unittests.sh index afb8dd9ae9c..38c47f8e4d7 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 -- 2.39.5