]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Generate NPM dependencies manifest 41204/head
authorNizamudeen A <nia@redhat.com>
Sun, 25 Apr 2021 11:01:00 +0000 (16:31 +0530)
committerNizamudeen A <nia@redhat.com>
Thu, 6 May 2021 17:01:15 +0000 (22:31 +0530)
A txt file with all the dependencies and its version & url link.
Fixes: https://tracker.ceph.com/issues/50515
Signed-off-by: Nizamudeen A <nia@redhat.com>
(cherry picked from commit 825ea98915bcb0ab4bbaefb478ee0a0b8e506933)

src/script/generate-npm-manifest.sh [new file with mode: 0755]

diff --git a/src/script/generate-npm-manifest.sh b/src/script/generate-npm-manifest.sh
new file mode 100755 (executable)
index 0000000..eceb51e
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+this_script=$(basename "$0")
+
+function usage {
+    cat <<EOM >&2
+
+This script file is used to generate a .txt file which contains all the npm
+dependencies and its version, from the package-lock.json file.
+
+Usage:
+    ${this_script} path/to/package-lock.json path/for/manifest-file.txt
+
+Example:
+    ${this_script} ../pybind/mgr/dashboard/frontend/package-lock.json ../pybind/mgr/dashboard/manifest.txt
+
+EOM
+}
+
+empty=""
+if [ "$1" == "--help" ] || [ -z $1 ]
+then
+    usage
+    exit
+fi
+
+DEP_PATH=$1
+OUT_PATH=$2
+
+#check if package-lock.json exists
+if [ -e "$DEP_PATH" ]
+then
+    cat $DEP_PATH | jq -r '.dependencies | to_entries[] | "\(.key)  \(.value.version)  \(.value.resolved)"' > $OUT_PATH
+    echo "Manifest generated..."
+else
+    echo "Invalid path..."
+fi