From bc9b7107dd752888fc5901a4e2264aea53122731 Mon Sep 17 00:00:00 2001 From: ibon eskudero <ibon.eskudero@tecnalia.com> Date: Fri, 10 Jan 2025 10:10:41 +0100 Subject: [PATCH] add package.json path checker --- npm-packages/license_checker.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/npm-packages/license_checker.yml b/npm-packages/license_checker.yml index ac10e97..205c178 100644 --- a/npm-packages/license_checker.yml +++ b/npm-packages/license_checker.yml @@ -1,5 +1,12 @@ before_script: + # Set PACKAGE_DIR to "." if not already defined. + # PACKAGE_DIR should point to where the package.json file is + - PACKAGE_DIR=${PACKAGE_DIR:-"."} + # check if package.json exist on PACKAGE_DIR. If not, raise error + - test -f $PACKAGE_DIR/package.json || (echo "package.json not found in $PACKAGE_DIR" && exit 1) - npm install -g js-green-licenses + # check if js-green-licenses.json exist on PACKAGE_DIR. If not, inform user and continue + - test -f $PACKAGE_DIR/js-green-licenses.json || (echo "js-green-licenses.json not found in $PACKAGE_DIR" && echo "Continuing with default configuration") cache: paths: @@ -11,6 +18,9 @@ license_check: - docker image: node:latest script: + # Change to the directory containing package.json + - cd $PACKAGE_DIR + # Install dependencies - npm install - jsgl --local ./ || exit 1 only: -- GitLab