Skip to content

Commit

Permalink
feat: extract license list tool from license checker tool (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgo authored Dec 30, 2024
1 parent a617847 commit 53a0029
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
2 changes: 2 additions & 0 deletions licenses/install
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
20 changes: 2 additions & 18 deletions licenses/licenses
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions licenses/list-licenses
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
set -e

# 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

# list Go licenses
if [ -f go.mod ]; then
module_name=$(grep "^module" go.mod | awk '{print $2}')
if [ -z "$module_name" ]; then
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
{ echo; } 2>/dev/null
fi

0 comments on commit 53a0029

Please sign in to comment.