From 17ebe2b786aff7c619347efe319c6c7b61e3a080 Mon Sep 17 00:00:00 2001 From: Kevin Goslar Date: Fri, 27 Dec 2024 17:20:47 -0600 Subject: [PATCH 1/3] Split the license checker into lister and checker --- licenses/install | 2 ++ licenses/licenses | 20 ++------------------ licenses/list-licenses | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 18 deletions(-) create mode 100755 licenses/list-licenses diff --git a/licenses/install b/licenses/install index f1005fb..8194d23 100755 --- a/licenses/install +++ b/licenses/install @@ -13,6 +13,8 @@ curl https://raw.githubusercontent.com/ory/ci/master/licenses/license-engine.sh chmod +x .bin/license-engine.sh curl https://raw.githubusercontent.com/ory/ci/master/licenses/licenses -o .bin/licenses chmod +x .bin/licenses +curl https://raw.githubusercontent.com/ory/ci/master/licenses/list-licenses -o .bin/list-licenses +chmod +x .bin/list-licenses if [ -f go.mod ]; then { diff --git a/licenses/licenses b/licenses/licenses index a21bc8d..bbe6026 100755 --- a/licenses/licenses +++ b/licenses/licenses @@ -1,21 +1,5 @@ #!/bin/sh set -e -# check Node licenses -if [ -f package.json ]; then - { echo "Checking Node licenses ..."; } 2>/dev/null - npm exec -- license-checker --csv --production --excludePrivatePackages --customPath .bin/license-template-node.json | .bin/license-engine.sh - { echo; } 2>/dev/null -fi - -# check Go licenses -if [ -f go.mod ]; then - { echo "Checking Go licenses ..."; } 2>/dev/null - module_name=$(grep "^module" go.mod | awk '{print $2}') - if [ -z "$module_name" ]; then - echo "Cannot determine the Go module name" - exit 1 - fi - .bin/go-licenses report "$module_name" --template .bin/license-template-go.tpl 2>/dev/null | .bin/license-engine.sh - { echo; } 2>/dev/null -fi +{ echo "Checking licenses ..."; } 2>/dev/null +.bin/list-licenses | .bin/license-engine.sh diff --git a/licenses/list-licenses b/licenses/list-licenses new file mode 100755 index 0000000..c7a14b9 --- /dev/null +++ b/licenses/list-licenses @@ -0,0 +1,19 @@ +#!/bin/sh +set -e + +# check Node licenses +if [ -f package.json ]; then + npm exec --yes license-checker -- --csv --production --excludePrivatePackages --customPath .bin/license-template-node.json + { echo; } 2>/dev/null +fi + +# check Go licenses +if [ -f go.mod ]; then + module_name=$(grep "^module" go.mod | awk '{print $2}') + if [ -z "$module_name" ]; then + >&2 echo "Cannot determine the Go module name" + exit 1 + fi + .bin/go-licenses report "$module_name" --template .bin/license-template-go.tpl 2>/dev/null + { echo; } 2>/dev/null +fi From 6863c54d86122c51b2125b7cd524a41587584870 Mon Sep 17 00:00:00 2001 From: Kevin Goslar Date: Fri, 27 Dec 2024 17:27:29 -0600 Subject: [PATCH 2/3] list-licenses --- licenses/list-licenses | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/licenses/list-licenses b/licenses/list-licenses index c7a14b9..ea7eee1 100755 --- a/licenses/list-licenses +++ b/licenses/list-licenses @@ -1,13 +1,13 @@ #!/bin/sh set -e -# check Node licenses +# list Node licenses if [ -f package.json ]; then npm exec --yes license-checker -- --csv --production --excludePrivatePackages --customPath .bin/license-template-node.json { echo; } 2>/dev/null fi -# check Go licenses +# list Go licenses if [ -f go.mod ]; then module_name=$(grep "^module" go.mod | awk '{print $2}') if [ -z "$module_name" ]; then From cf2770a1ebe715c80c7d7a50efb8701c314892eb Mon Sep 17 00:00:00 2001 From: Kevin Goslar Date: Fri, 27 Dec 2024 17:35:39 -0600 Subject: [PATCH 3/3] Fix formatting --- licenses/list-licenses | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/licenses/list-licenses b/licenses/list-licenses index ea7eee1..ae671c0 100755 --- a/licenses/list-licenses +++ b/licenses/list-licenses @@ -11,7 +11,7 @@ fi if [ -f go.mod ]; then module_name=$(grep "^module" go.mod | awk '{print $2}') if [ -z "$module_name" ]; then - >&2 echo "Cannot determine the Go module name" + echo "Cannot determine the Go module name" >&2 exit 1 fi .bin/go-licenses report "$module_name" --template .bin/license-template-go.tpl 2>/dev/null