Skip to content

Commit d7a50fb

Browse files
authored
Merge pull request #559 from korthout/korthout-auto-update-licenses-txt
Auto update licenses txt
2 parents 669791a + 13771dc commit d7a50fb

File tree

3 files changed

+88
-75
lines changed

3 files changed

+88
-75
lines changed

dist/licenses.txt

Lines changed: 22 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,6 @@ The above copyright notice and this permission notice shall be included in all c
7171

7272
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7373

74-
@fastify/busboy
75-
MIT
76-
Copyright Brian White. All rights reserved.
77-
78-
Permission is hereby granted, free of charge, to any person obtaining a copy
79-
of this software and associated documentation files (the "Software"), to
80-
deal in the Software without restriction, including without limitation the
81-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
82-
sell copies of the Software, and to permit persons to whom the Software is
83-
furnished to do so, subject to the following conditions:
84-
85-
The above copyright notice and this permission notice shall be included in
86-
all copies or substantial portions of the Software.
87-
88-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
89-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
90-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
91-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
92-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
93-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
94-
IN THE SOFTWARE.
95-
9674
@octokit/auth-token
9775
MIT
9876
The MIT License
@@ -494,43 +472,32 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
494472
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
495473

496474

497-
deprecation
498-
ISC
499-
The ISC License
500-
501-
Copyright (c) Gregor Martynus and contributors
502-
503-
Permission to use, copy, modify, and/or distribute this software for any
504-
purpose with or without fee is hereby granted, provided that the above
505-
copyright notice and this permission notice appear in all copies.
506-
507-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
508-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
509-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
510-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
511-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
512-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
513-
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
514-
475+
fast-content-type-parse
476+
MIT
477+
MIT License
515478

516-
once
517-
ISC
518-
The ISC License
479+
Copyright (c) 2023 The Fastify Team
519480

520-
Copyright (c) Isaac Z. Schlueter and Contributors
481+
The Fastify team members are listed at https://github.com/fastify/fastify#team
482+
and in the README file.
521483

522-
Permission to use, copy, modify, and/or distribute this software for any
523-
purpose with or without fee is hereby granted, provided that the above
524-
copyright notice and this permission notice appear in all copies.
484+
Permission is hereby granted, free of charge, to any person obtaining a copy
485+
of this software and associated documentation files (the "Software"), to deal
486+
in the Software without restriction, including without limitation the rights
487+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
488+
copies of the Software, and to permit persons to whom the Software is
489+
furnished to do so, subject to the following conditions:
525490

526-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
527-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
528-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
529-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
530-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
531-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
532-
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
491+
The above copyright notice and this permission notice shall be included in all
492+
copies or substantial portions of the Software.
533493

494+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
495+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
496+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
497+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
498+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
499+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
500+
SOFTWARE.
534501

535502
tunnel
536503
MIT
@@ -586,27 +553,8 @@ universal-user-agent
586553
ISC
587554
# [ISC License](https://spdx.org/licenses/ISC)
588555

589-
Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m)
556+
Copyright (c) 2018-2021, Gregor Martynus (https://github.com/gr2m)
590557

591558
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
592559

593560
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
594-
595-
596-
wrappy
597-
ISC
598-
The ISC License
599-
600-
Copyright (c) Isaac Z. Schlueter and Contributors
601-
602-
Permission to use, copy, modify, and/or distribute this software for any
603-
purpose with or without fee is hereby granted, provided that the above
604-
copyright notice and this permission notice appear in all copies.
605-
606-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
607-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
608-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
609-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
610-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
611-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
612-
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

esbuild.config.mjs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import * as esbuild from "esbuild";
2+
import { readFileSync, writeFileSync } from "fs";
3+
import { join } from "path";
4+
5+
const result = await esbuild.build({
6+
entryPoints: ["src/main.ts"],
7+
bundle: true,
8+
platform: "node",
9+
target: "node24",
10+
format: "esm",
11+
minify: true,
12+
metafile: true,
13+
banner: {
14+
js: "import{createRequire}from'module';const require=createRequire(import.meta.url);",
15+
},
16+
outfile: "dist/index.js",
17+
});
18+
19+
// Collect licenses from all bundled node_modules packages
20+
const packages = new Map();
21+
for (const input of Object.keys(result.metafile.inputs)) {
22+
// Find the last node_modules/ segment to handle nested dependencies
23+
const lastIdx = input.lastIndexOf("node_modules/");
24+
if (lastIdx === -1) continue;
25+
const afterNodeModules = input.slice(lastIdx + "node_modules/".length);
26+
const match = afterNodeModules.match(/^(@[^/]+\/[^/]+|[^/]+)/);
27+
if (match) {
28+
const pkg = match[1];
29+
const pkgDir = input.slice(0, lastIdx + "node_modules/".length + match[0].length);
30+
packages.set(pkg, pkgDir);
31+
}
32+
}
33+
34+
let licenseText = "";
35+
for (const [pkg, pkgDir] of [...packages.entries()].sort(([a], [b]) =>
36+
a.localeCompare(b),
37+
)) {
38+
const pkgJson = JSON.parse(
39+
readFileSync(join(pkgDir, "package.json"), "utf8"),
40+
);
41+
42+
const licenseFiles = [
43+
"LICENSE",
44+
"license",
45+
"LICENCE",
46+
"LICENSE.md",
47+
"License.md",
48+
"LICENSE.txt",
49+
"license.txt",
50+
];
51+
let license = "";
52+
for (const f of licenseFiles) {
53+
try {
54+
license = readFileSync(join(pkgDir, f), "utf8");
55+
break;
56+
} catch {
57+
// try next candidate
58+
}
59+
}
60+
61+
licenseText += `${pkg}\n${pkgJson.license || "Unknown"}\n${license}\n\n`;
62+
}
63+
64+
writeFileSync("dist/licenses.txt", licenseText.trimEnd() + "\n");
65+
console.log(`Collected licenses for ${packages.size} bundled packages`);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"build": "tsc",
1010
"format": "prettier --write \"**.ts\"",
1111
"format-check": "prettier --check \"**.ts\"",
12-
"package": "esbuild src/main.ts --bundle --platform=node --target=node24 --format=esm --banner:js=\"import{createRequire}from'module';const require=createRequire(import.meta.url);\" --minify --outfile=dist/index.js",
12+
"package": "node esbuild.config.mjs",
1313
"test": "NODE_OPTIONS='--experimental-vm-modules' jest --silent",
1414
"test-verbose": "NODE_OPTIONS='--experimental-vm-modules' jest",
1515
"all": "npm run format && npm run build && npm run package && npm test"

0 commit comments

Comments
 (0)