Skip to content

Commit 9f5ff32

Browse files
committed
autogen: update license overview
1 parent 096cc32 commit 9f5ff32

File tree

5 files changed

+3675
-23
lines changed

5 files changed

+3675
-23
lines changed

.bin/license-engine.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ done
9898

9999
# remove pre-approved modules
100100
for approved in "${APPROVED_MODULES[@]}"; do
101-
input=$(echo "$input" | grep -v "\"${approved}\"")
102-
input=$(echo "$input" | grep -v "\"Custom: ${approved}\"")
101+
input=$(echo "$input" | grep -vE "\"${approved}\"")
102+
input=$(echo "$input" | grep -vE "\"Custom: ${approved}\"")
103103
done
104104

105105
# remove allowed licenses

.bin/licenses

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/sh
22
set -e
33

4+
# Get the directory where this script is located
5+
bin_dir="$(cd "$(dirname "$0")" && pwd)"
6+
47
{ echo "Checking licenses ..."; } 2>/dev/null
5-
.bin/list-licenses | .bin/license-engine.sh
8+
"${bin_dir}/list-licenses" | "${bin_dir}/license-engine.sh"

.bin/list-licenses

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
#!/bin/sh
22
set -e
33

4+
bin_dir="$(cd "$(dirname "$0")" && pwd)"
5+
46
# list Node licenses
57
if [ -f package.json ]; then
6-
if grep -q '"dependencies":\s+{[^}]*"[^"]+":' package.json; then
7-
# List all direct Go module dependencies, transform their paths to root module paths
8-
# (e.g., github.com/ory/x instead of github.com/ory/x/foo/bar), and generate a license report
9-
# for each unique root module. This ensures that the license report is generated for the root
10-
# module of a repository, where licenses are typically defined.
11-
go list -f "{{if not .Indirect}}{{.Path}}{{end}}" -m ... |
12-
sort -u |
13-
awk -F/ '{ if ($1 == "github.com" && NF >= 3) { print $1"/"$2"/"$3 } else { print } }' |
14-
sort -u |
15-
xargs -I {} sh -c '.bin/go-licenses report --template .bin/license-template-go.tpl {}' 2>/dev/null |
16-
grep -v '^$'
8+
if jq -e '.dependencies and (.dependencies | keys | length > 0)' package.json >/dev/null; then
9+
npm install >/dev/null 2>&1
10+
npm exec --yes license-checker -- --production --csv --excludePrivatePackages --customPath "${bin_dir}"/license-template-node.json | grep -v '^$'
1711
{ echo; } 2>/dev/null
1812
else
1913
echo "No dependencies found in package.json" >&2
@@ -22,14 +16,23 @@ fi
2216

2317
# list Go licenses
2418
if [ -f go.mod ]; then
25-
module_name=$(grep "^module" go.mod | awk '{print $2}')
26-
if [ -z "$module_name" ]; then
27-
echo "Cannot determine the Go module name" >&2
28-
exit 1
19+
# List all direct Go module dependencies, transform their paths to root module paths
20+
# (e.g., github.com/ory/x instead of github.com/ory/x/foo/bar), and generate a license report
21+
# for each unique root module. This ensures that the license report is generated for the root
22+
# module of a repository, where licenses are typically defined.
23+
go_modules=$(
24+
go list -f "{{if not .Indirect}}{{.Path}}{{end}}" -m ... |
25+
sort -u |
26+
awk -F/ '{ if ($1 == "github.com" && NF >= 3) { print $1"/"$2"/"$3 } else { print } }' |
27+
sort -u
28+
{ echo; } 2>/dev/null
29+
)
30+
if [ -z "$go_modules" ]; then
31+
echo "No Go modules found" >&2
32+
else
33+
# Workaround until https://github.com/google/go-licenses/issues/307 is fixed
34+
# .bin/go-licenses report "$module_name" --template .bin/license-template-go.tpl 2>/dev/null
35+
#
36+
echo "$go_modules" | xargs -I {} sh -c '.bin/go-licenses report --template .bin/license-template-go.tpl {}' 2>/dev/null | grep -v '^$'
2937
fi
30-
31-
# Workaround until https://github.com/google/go-licenses/issues/307 is fixed
32-
# .bin/go-licenses report "$module_name" --template .bin/license-template-go.tpl 2>/dev/null
33-
go list -f "{{if not .Indirect}}{{.Path}}{{end}}" -m ... | xargs -I {} sh -c '.bin/go-licenses report --template .bin/license-template-go.tpl {}' 2>/dev/null | grep -v '^$'
34-
{ echo; } 2>/dev/null
3538
fi

.reports/dep-licenses.csv

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
"module name","licenses"
2+
"@alloc/[email protected]","MIT"
3+
"@auth/[email protected]","ISC"
4+
"@floating-ui/[email protected]","MIT"
5+
"@floating-ui/[email protected]","MIT"
6+
"@floating-ui/[email protected]","MIT"
7+
"@floating-ui/[email protected]","MIT"
8+
"@img/[email protected]","LGPL-3.0-or-later"
9+
"@img/[email protected]","LGPL-3.0-or-later"
10+
"@img/[email protected]","Apache-2.0"
11+
"@img/[email protected]","Apache-2.0"
12+
"@isaacs/[email protected]","ISC"
13+
"@jridgewell/[email protected]","MIT"
14+
"@jridgewell/[email protected]","MIT"
15+
"@jridgewell/[email protected]","MIT"
16+
"@jridgewell/[email protected]","MIT"
17+
"@jridgewell/[email protected]","MIT"
18+
"@next/[email protected]","MIT"
19+
"@next/[email protected]","MIT"
20+
"@next/[email protected]","MIT"
21+
"@nodelib/[email protected]","MIT"
22+
"@nodelib/[email protected]","MIT"
23+
"@nodelib/[email protected]","MIT"
24+
"@panva/[email protected]","MIT"
25+
"@pkgjs/[email protected]","MIT"
26+
"@radix-ui/[email protected]","MIT"
27+
"@radix-ui/[email protected]","MIT"
28+
"@radix-ui/[email protected]","MIT"
29+
"@radix-ui/[email protected]","MIT"
30+
"@radix-ui/[email protected]","MIT"
31+
"@radix-ui/[email protected]","MIT"
32+
"@radix-ui/[email protected]","MIT"
33+
"@radix-ui/[email protected]","MIT"
34+
"@radix-ui/[email protected]","MIT"
35+
"@radix-ui/[email protected]","MIT"
36+
"@radix-ui/[email protected]","MIT"
37+
"@radix-ui/[email protected]","MIT"
38+
"@radix-ui/[email protected]","MIT"
39+
"@radix-ui/[email protected]","MIT"
40+
"@radix-ui/[email protected]","MIT"
41+
"@radix-ui/[email protected]","MIT"
42+
"@radix-ui/[email protected]","MIT"
43+
"@radix-ui/[email protected]","MIT"
44+
"@radix-ui/[email protected]","MIT"
45+
"@radix-ui/[email protected]","MIT"
46+
"@radix-ui/[email protected]","MIT"
47+
"@radix-ui/[email protected]","MIT"
48+
"@radix-ui/[email protected]","MIT"
49+
"@radix-ui/[email protected]","MIT"
50+
"@radix-ui/[email protected]","MIT"
51+
"@radix-ui/[email protected]","MIT"
52+
"@radix-ui/[email protected]","MIT"
53+
"@radix-ui/[email protected]","MIT"
54+
"@radix-ui/[email protected]","MIT"
55+
"@radix-ui/[email protected]","MIT"
56+
"@swc/[email protected]","Apache-2.0"
57+
"@swc/[email protected]","Apache-2.0"
58+
"@types/[email protected]","MIT"
59+
"@types/[email protected]","MIT"
60+
"@types/[email protected]","MIT"
61+
"@types/[email protected]","MIT"
62+
63+
64+
65+
66+
67+
68+
69+
70+
71+
72+
73+
74+
75+
76+
"[email protected]","CC-BY-4.0"
77+
78+
"[email protected]","Apache-2.0"
79+
80+
81+
82+
83+
84+
85+
86+
87+
88+
89+
90+
"[email protected]","Apache-2.0"
91+
92+
"[email protected]","Apache-2.0"
93+
94+
95+
96+
97+
98+
99+
100+
101+
102+
103+
104+
105+
106+
107+
108+
109+
110+
111+
112+
113+
114+
115+
"[email protected]","BlueOak-1.0.0"
116+
117+
118+
119+
120+
121+
122+
123+
124+
125+
126+
127+
128+
129+
130+
131+
132+
133+
134+
135+
136+
"[email protected]","BlueOak-1.0.0"
137+
138+
139+
"[email protected]","BlueOak-1.0.0"
140+
141+
142+
143+
144+
145+
146+
147+
148+
149+
150+
151+
152+
153+
154+
155+
156+
157+
158+
159+
160+
161+
162+
163+
164+
165+
166+
167+
168+
"[email protected]","Apache-2.0"
169+
170+
171+
172+
173+
"[email protected]","BSD-3-Clause"
174+
175+
176+
177+
178+
179+
180+
181+
182+
183+
184+
185+
186+
187+
188+
"[email protected]","Apache-2.0"
189+
190+
191+
192+
193+
194+
195+
196+
197+

0 commit comments

Comments
 (0)