Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract license list tool from license checker tool #151

Merged
merged 3 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading