Files: 2a1f7a7a5047c3b4d0032b7acff34d1699a85270 / licenses.js
9025 bytesRaw
1 | var fs = require('fs') |
2 | |
3 | // Supplement or fix what license-checker finds for copyright notices. |
4 | // If the author(s) claimed copyright, note it here and put a commit id to show it. Otherwise just put their names and years based on examining the source and commit log. |
5 | var copyrightOverrides = { |
6 | '@types/node@14.14.8': 'Copyright (c) Microsoft Corporation.', |
7 | '@types/rdf-js@4.0.0': 'Copyright (c) Microsoft Corporation.', |
8 | 'binary@0.3.0': '2010-2012 James Halliday and contributors', |
9 | 'bl@1.2.2': 'Copyright (c) 2013-2016 bl contributors.', |
10 | 'buffer-alloc-unsafe@1.1.0': 'Copyright (c) 2016, 2018 Linus Unnebäck', |
11 | 'buffer-alloc@1.2.0': 'Copyright (c) 2016, 2018 Linus Unnebäck', |
12 | 'buffer-fill@1.0.0': 'Copyright (c) 2016, 2018 Linus Unnebäck', |
13 | 'buffers@0.1.1': '2011-2012 James Halliday and contributors', |
14 | 'chainsaw@0.1.0': 'Copyright 2010 James Halliday (mail@substack.net)', |
15 | 'colors@1.2.1': 'Original Library - Copyright (c) Marak Squires. Additional Functionality - Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)', |
16 | 'concat-map@0.0.1': '2012, 2014 James Halliday', |
17 | 'ed2curve@0.1.4': '2014,2016 Dmitry Chestnykh', |
18 | 'emoji-named-characters@1.0.2': '© 2013 Henrik Joreteg, 2014 Luke Karrys, and contributors', |
19 | 'generate-function@2.0.0': 'Copyright (c) 2014 Mathias Buus', // af11020b5280972156c46876d9779c0e448fdfcb |
20 | 'get-caller-file@1.0.2': 'Copyright 2018 Stefan Penner', |
21 | 'git-packidx-parser@1.0.0': 'Copyright 2013 Chris Dickinson', |
22 | 'human-time@0.0.1': '2014, 2015, 2018 Dave Eddy', |
23 | 'indexof@0.0.1': '2012 tjholowaychuk', |
24 | 'invert-kv@1.0.0': 'Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)', |
25 | 'is-my-ip-valid@1.0.0': 'Copyright (c) 2018 Linus Unnebäck', // 5a9a18540278a8fb0e51543dd79bb407dbe187a0 |
26 | 'kvset@1.0.0': 'Copyright (c) 2016 Charles Lehner', // 66301173fca366fcd05224d0d23678b51c2ed9f6 |
27 | 'minimist@0.0.8': '2013-2014 James Halliday and contributors', |
28 | 'minimist@1.2.5': '2013-2015 James Halliday and contributors', |
29 | 'multicb@1.2.2': 'Copyright (c) 2018 Paul Frazee', // a3798da7e8843cc3036ecd7c08ac0056c842ee4c |
30 | 'multiserver-scopes@1.0.0': '2018 Jan Bölsche', |
31 | 'nan@2.14.1': 'Copyright (c) 2018 NAN contributors', |
32 | 'natives@1.1.3': 'Copyright 2018 Isaac Z. Schlueter', |
33 | 'node-polyglot@1.0.0': '©2012-2014 Airbnb, Inc.', // 4722ccd67f7ac5d72f4f45604b52ad27f51d0402 |
34 | 'process-nextick-args@2.0.0': 'Copyright (c) 2015 Calvin Metcalf', |
35 | 'pull-block-filter@1.0.0': 'Copyright (c) 2016 Charles Lehner', // 5b01c795e220af444c3e1be42616693803cde4d8 |
36 | 'pull-catch@1.0.0': '2016, 2019 Nick Thomas', |
37 | 'pull-git-packidx-parser@1.0.0': '© 2013 Chris Dickinson, 2016 Charles Lehner', |
38 | 'pull-hyperscript@0.2.2': '© 2016 mix irving, Matt McKegg, cel', |
39 | 'pull-identify-filetype@1.1.0': '2015 Paul Frazee', |
40 | 'railroad-diagrams@1.0.0': '2012-2015 Tab Atkins Jr. (and others)', |
41 | 'readable-stream@1.0.34': 'Copyright Joyent, Inc. and other Node contributors.', |
42 | 'readable-stream@1.1.14': 'Copyright Joyent, Inc. and other Node contributors.', |
43 | 'readable-stream@2.3.6': 'Copyright Joyent, Inc. and other Node contributors. All rights reserved.', |
44 | 'sparqljs@3.2.0': 'Copyright ©2014 Ruben Verborgh', |
45 | 'spdx-correct@3.0.0': '2015-2018 Kyle E. Mitchell and contributors', |
46 | 'spdx-exceptions@2.1.0': 'Copyright © 2010-2015 Linux Foundation and its Contributors', |
47 | 'spdx-license-ids@3.0.0': '2014-2018 Shinnosuke Watanabe and contributors', |
48 | 'ssb-caps@1.1.0': '2015, 2019 Dominic Tarr, Andre Medeiros', |
49 | 'ssb-client@4.9.0': 'Copyright 2015-2020 Paul Frazee and Dominic Tarr, and contributors', |
50 | 'ssb-keys@7.2.2': '2014-2015 Paul Frazee, 2014-2020 Dominic Tarr and contributors', |
51 | 'ssb-msg-schemas@6.3.0': '2015-2016 Paul Frazee. 2015,2017 Dominic Tarr. 2017 mix irving. 2016-2019 other contributors', |
52 | 'ssb-msgs@5.2.0': '2014-2015 Paul Frazee. 2015 Dominic Tarr', |
53 | 'ssb-npm-registry@1.10.2': 'Copyright (C) 2017-2019 Secure Scuttlebutt Consortium', |
54 | 'ssb-web-resolver@1.1.2': '2018 Stephen Whitmore', |
55 | 'string_decoder@1.1.1': 'Copyright Node.js contributors. All rights reserved.', |
56 | 'tweetnacl-auth@0.3.1': '2014-2016 Dmitry Chestnykh', |
57 | 'tweetnacl@0.14.5': '2014-2016 Dmitry Chestnykh', |
58 | 'tweetnacl@1.0.3': '2014-2020 Dmitry Chestnykh', |
59 | 'validate-npm-package-license@3.0.4': '2017-2018, 2020 Kyle E. Mitchell and contributors', |
60 | 'patchfoo@1.6.0': 'Copyright (C) 2017-2020 Secure Scuttlebutt Consortium', |
61 | 'rc@1.2.8': 'Copyright (c) 2011 Dominic Tarr', |
62 | } |
63 | |
64 | var licenseOverrides = { |
65 | 'buffers@0.1.1': 'MIT', |
66 | 'chainsaw@0.1.0': 'MIT', |
67 | 'ed2curve@0.1.4': 'Unlicense', |
68 | 'lrucache@1.0.3': 'MIT', |
69 | 'multicb@1.2.2': 'MIT', |
70 | 'options@0.0.6': 'MIT', |
71 | 'sha.js@2.4.5': '(MIT AND BSD-3-Clause)', |
72 | 'indexof@0.0.1': 'MIT', |
73 | 'traverse@0.3.9': 'MIT', |
74 | 'ssb-npm-registry@1.10.2': 'AGPL-3.0-or-later' |
75 | } |
76 | |
77 | var licenseFilenameOverrides = { |
78 | Unlicense: __dirname + '/node_modules/tweetnacl/LICENSE', |
79 | 'AGPL-3.0-or-later': __dirname + '/node_modules/ssb-npm-registry/LICENSE', |
80 | 'MIT': __dirname + '/node_modules/sodium-native/LICENSE', |
81 | 'CC-BY-3.0': __dirname + '/vendor/cc-by-3.0.txt', |
82 | } |
83 | |
84 | var formLicenses = { |
85 | '(MIT AND BSD-3-Clause)': true, |
86 | 'BSD-2-Clause': true, |
87 | 'BSD-3-Clause': true, |
88 | ISC: true, |
89 | MIT: true |
90 | } |
91 | |
92 | var licenseTextOverrides = { |
93 | FSFAP: `Copying and distribution of this file, with or without modification, |
94 | are permitted in any medium without royalty provided the copyright |
95 | notice and this notice are preserved. This file is offered as-is, |
96 | without any warranty.`, |
97 | 'CC0-1.0': `Creative Commons - CC0 1.0 Universal |
98 | Source: http://creativecommons.org/publicdomain/zero/1.0/`, |
99 | Fair: `Usage of the works is permitted provided that this instrument is |
100 | retained with the works, so that any entity that uses the works is |
101 | notified of this instrument. |
102 | |
103 | DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.`, |
104 | 'CC0-1.0': `Creative Commons - CC0 1.0 Universal |
105 | Source: http://creativecommons.org/publicdomain/zero/1.0/`, |
106 | '(MIT AND Zlib)': `- MIT - all files, except \`/lib/zlib\` folder |
107 | - ZLIB - \`/lib/zlib\` content |
108 | |
109 | zlib license: |
110 | |
111 | (C) 1995-2013 Jean-loup Gailly and Mark Adler |
112 | (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin |
113 | |
114 | This software is provided 'as-is', without any express or implied |
115 | warranty. In no event will the authors be held liable for any damages |
116 | arising from the use of this software. |
117 | |
118 | Permission is granted to anyone to use this software for any purpose, |
119 | including commercial applications, and to alter it and redistribute it |
120 | freely, subject to the following restrictions: |
121 | |
122 | 1. The origin of this software must not be misrepresented; you must not |
123 | claim that you wrote the original software. If you use this software |
124 | in a product, an acknowledgment in the product documentation would be |
125 | appreciated but is not required. |
126 | 2. Altered source versions must be plainly marked as such, and must not be |
127 | misrepresented as being the original software. |
128 | 3. This notice may not be removed or altered from any source distribution.` |
129 | } |
130 | |
131 | function return$1($0, $1) { |
132 | return $1 |
133 | } |
134 | |
135 | var checker = require('license-checker') |
136 | |
137 | checker.init({ |
138 | start: __dirname, |
139 | production: true, |
140 | customFormat: { |
141 | licenses: null, |
142 | publisher: null, |
143 | copyright: null, |
144 | licenseFile: null |
145 | } |
146 | }, function (err, packages) { |
147 | if (err) throw err |
148 | |
149 | var licenses = {} |
150 | var licensesFilenames = {} |
151 | var licenseNames = [] |
152 | for (var nameVersion in packages) { |
153 | var pkg = packages[nameVersion] |
154 | pkg.nameVersion = nameVersion |
155 | var license = licenseOverrides[nameVersion] || pkg.licenses |
156 | var licenseInfo = licenses[license] || (licenses[license] = {pkgs: []}) |
157 | licenseInfo.pkgs.push(pkg) |
158 | if (!(license in licensesFilenames)) { |
159 | licensesFilenames[license] = pkg.licenseFile |
160 | licenseNames.push(license) |
161 | } |
162 | } |
163 | try { |
164 | var ssbPkgPkgPkg = require('./node_modules/ssb-pkg/package.json') |
165 | licenses.MIT.pkgs.push({ |
166 | copyright: 'Copyright (c) 2016 Zeit, Inc., 2020 Charles Lehner', |
167 | nameVersion: 'ssb-pkg@' + ssbPkgPkgPkg.version |
168 | }) |
169 | } catch(e) {} |
170 | |
171 | process.stdout.write('Licenses for software packages included in patchfoo binary release\n\n') |
172 | for (var license in licenses) { |
173 | var pkgs = licenses[license].pkgs |
174 | var licenseText = licenseTextOverrides[license] |
175 | if (!licenseText) { |
176 | var licenseFilename = licenseFilenameOverrides[license] |
177 | || licensesFilenames[license] |
178 | licenseText = fs.readFileSync(licenseFilename, 'utf8') |
179 | .replace(/\s*$/, '') |
180 | if (formLicenses[license]) licenseText = licenseText |
181 | .replace(/(^|\n)\s*(Copyright |©)[^\n]*\n*/, return$1) |
182 | } |
183 | process.stdout.write('- ' + license + '\n\n' + |
184 | pkgs.map(function (pkg) { |
185 | return ' - ' + pkg.nameVersion + ' ' + ( |
186 | copyrightOverrides[pkg.nameVersion] || pkg.copyright |
187 | ) |
188 | }).join('\n') |
189 | .replace(/</g, '<') |
190 | .replace(/>/g, '>') + '\n\n' + |
191 | licenseText.replace(/^/gm, ' ') |
192 | + '\n\n') |
193 | } |
194 | |
195 | fs.createReadStream('/home/cel/src/patchfoo/node-v12.18.1-license.txt').pipe(process.stdout) |
196 | |
197 | }) |
198 |
Built with git-ssb-web