var fs = require('fs') // Supplement or fix what license-checker finds for copyright notices. // 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. var copyrightOverrides = { '@types/node@14.14.8': 'Copyright (c) Microsoft Corporation.', '@types/rdf-js@4.0.0': 'Copyright (c) Microsoft Corporation.', 'binary@0.3.0': '2010-2012 James Halliday and contributors', 'bl@1.2.2': 'Copyright (c) 2013-2016 bl contributors.', 'buffer-alloc-unsafe@1.1.0': 'Copyright (c) 2016, 2018 Linus Unnebäck', 'buffer-alloc@1.2.0': 'Copyright (c) 2016, 2018 Linus Unnebäck', 'buffer-fill@1.0.0': 'Copyright (c) 2016, 2018 Linus Unnebäck', 'buffers@0.1.1': '2011-2012 James Halliday and contributors', 'chainsaw@0.1.0': 'Copyright 2010 James Halliday (mail@substack.net)', 'colors@1.2.1': 'Original Library - Copyright (c) Marak Squires. Additional Functionality - Copyright (c) Sindre Sorhus (sindresorhus.com)', 'concat-map@0.0.1': '2012, 2014 James Halliday', 'ed2curve@0.1.4': '2014,2016 Dmitry Chestnykh', 'emoji-named-characters@1.0.2': '© 2013 Henrik Joreteg, 2014 Luke Karrys, and contributors', 'generate-function@2.0.0': 'Copyright (c) 2014 Mathias Buus', // af11020b5280972156c46876d9779c0e448fdfcb 'get-caller-file@1.0.2': 'Copyright 2018 Stefan Penner', 'git-packidx-parser@1.0.0': 'Copyright 2013 Chris Dickinson', 'human-time@0.0.1': '2014, 2015, 2018 Dave Eddy', 'indexof@0.0.1': '2012 tjholowaychuk', 'invert-kv@1.0.0': 'Copyright (c) Sindre Sorhus (https://sindresorhus.com)', 'is-my-ip-valid@1.0.0': 'Copyright (c) 2018 Linus Unnebäck', // 5a9a18540278a8fb0e51543dd79bb407dbe187a0 'kvset@1.0.0': 'Copyright (c) 2016 Charles Lehner', // 66301173fca366fcd05224d0d23678b51c2ed9f6 'minimist@0.0.8': '2013-2014 James Halliday and contributors', 'minimist@1.2.5': '2013-2015 James Halliday and contributors', 'multicb@1.2.2': 'Copyright (c) 2018 Paul Frazee', // a3798da7e8843cc3036ecd7c08ac0056c842ee4c 'multiserver-scopes@1.0.0': '2018 Jan Bölsche', 'nan@2.14.1': 'Copyright (c) 2018 NAN contributors', 'natives@1.1.3': 'Copyright 2018 Isaac Z. Schlueter', 'node-polyglot@1.0.0': '©2012-2014 Airbnb, Inc.', // 4722ccd67f7ac5d72f4f45604b52ad27f51d0402 'process-nextick-args@2.0.0': 'Copyright (c) 2015 Calvin Metcalf', 'pull-block-filter@1.0.0': 'Copyright (c) 2016 Charles Lehner', // 5b01c795e220af444c3e1be42616693803cde4d8 'pull-catch@1.0.0': '2016, 2019 Nick Thomas', 'pull-git-packidx-parser@1.0.0': '© 2013 Chris Dickinson, 2016 Charles Lehner', 'pull-hyperscript@0.2.2': '© 2016 mix irving, Matt McKegg, cel', 'pull-identify-filetype@1.1.0': '2015 Paul Frazee', 'railroad-diagrams@1.0.0': '2012-2015 Tab Atkins Jr. (and others)', 'readable-stream@1.0.34': 'Copyright Joyent, Inc. and other Node contributors.', 'readable-stream@1.1.14': 'Copyright Joyent, Inc. and other Node contributors.', 'readable-stream@2.3.6': 'Copyright Joyent, Inc. and other Node contributors. All rights reserved.', 'sparqljs@3.2.0': 'Copyright ©2014 Ruben Verborgh', 'spdx-correct@3.0.0': '2015-2018 Kyle E. Mitchell and contributors', 'spdx-exceptions@2.1.0': 'Copyright © 2010-2015 Linux Foundation and its Contributors', 'spdx-license-ids@3.0.0': '2014-2018 Shinnosuke Watanabe and contributors', 'ssb-caps@1.1.0': '2015, 2019 Dominic Tarr, Andre Medeiros', 'ssb-client@4.9.0': 'Copyright 2015-2020 Paul Frazee and Dominic Tarr, and contributors', 'ssb-keys@7.2.2': '2014-2015 Paul Frazee, 2014-2020 Dominic Tarr and contributors', 'ssb-msg-schemas@6.3.0': '2015-2016 Paul Frazee. 2015,2017 Dominic Tarr. 2017 mix irving. 2016-2019 other contributors', 'ssb-msgs@5.2.0': '2014-2015 Paul Frazee. 2015 Dominic Tarr', 'ssb-npm-registry@1.10.2': 'Copyright (C) 2017-2019 Secure Scuttlebutt Consortium', 'ssb-web-resolver@1.1.2': '2018 Stephen Whitmore', 'string_decoder@1.1.1': 'Copyright Node.js contributors. All rights reserved.', 'tweetnacl-auth@0.3.1': '2014-2016 Dmitry Chestnykh', 'tweetnacl@0.14.5': '2014-2016 Dmitry Chestnykh', 'tweetnacl@1.0.3': '2014-2020 Dmitry Chestnykh', 'validate-npm-package-license@3.0.4': '2017-2018, 2020 Kyle E. Mitchell and contributors', 'patchfoo@1.6.0': 'Copyright (C) 2017-2020 Secure Scuttlebutt Consortium', 'rc@1.2.8': 'Copyright (c) 2011 Dominic Tarr', } var licenseOverrides = { 'buffers@0.1.1': 'MIT', 'chainsaw@0.1.0': 'MIT', 'ed2curve@0.1.4': 'Unlicense', 'lrucache@1.0.3': 'MIT', 'multicb@1.2.2': 'MIT', 'options@0.0.6': 'MIT', 'sha.js@2.4.5': '(MIT AND BSD-3-Clause)', 'indexof@0.0.1': 'MIT', 'traverse@0.3.9': 'MIT', 'ssb-npm-registry@1.10.2': 'AGPL-3.0-or-later' } var licenseFilenameOverrides = { Unlicense: __dirname + '/node_modules/tweetnacl/LICENSE', 'AGPL-3.0-or-later': __dirname + '/node_modules/ssb-npm-registry/LICENSE', 'MIT': __dirname + '/node_modules/sodium-native/LICENSE', 'CC-BY-3.0': __dirname + '/vendor/cc-by-3.0.txt', } var formLicenses = { '(MIT AND BSD-3-Clause)': true, 'BSD-2-Clause': true, 'BSD-3-Clause': true, ISC: true, MIT: true } var licenseTextOverrides = { FSFAP: `Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.`, 'CC0-1.0': `Creative Commons - CC0 1.0 Universal Source: http://creativecommons.org/publicdomain/zero/1.0/`, Fair: `Usage of the works is permitted provided that this instrument is retained with the works, so that any entity that uses the works is notified of this instrument. DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.`, 'CC0-1.0': `Creative Commons - CC0 1.0 Universal Source: http://creativecommons.org/publicdomain/zero/1.0/`, '(MIT AND Zlib)': `- MIT - all files, except \`/lib/zlib\` folder - ZLIB - \`/lib/zlib\` content zlib license: (C) 1995-2013 Jean-loup Gailly and Mark Adler (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution.` } function return$1($0, $1) { return $1 } var checker = require('license-checker') checker.init({ start: __dirname, production: true, customFormat: { licenses: null, publisher: null, copyright: null, licenseFile: null } }, function (err, packages) { if (err) throw err var licenses = {} var licensesFilenames = {} var licenseNames = [] for (var nameVersion in packages) { var pkg = packages[nameVersion] pkg.nameVersion = nameVersion var license = licenseOverrides[nameVersion] || pkg.licenses var licenseInfo = licenses[license] || (licenses[license] = {pkgs: []}) licenseInfo.pkgs.push(pkg) if (!(license in licensesFilenames)) { licensesFilenames[license] = pkg.licenseFile licenseNames.push(license) } } try { var ssbPkgPkgPkg = require('./node_modules/ssb-pkg/package.json') licenses.MIT.pkgs.push({ copyright: 'Copyright (c) 2016 Zeit, Inc., 2020 Charles Lehner', nameVersion: 'ssb-pkg@' + ssbPkgPkgPkg.version }) } catch(e) {} process.stdout.write('Licenses for software packages included in patchfoo binary release\n\n') for (var license in licenses) { var pkgs = licenses[license].pkgs var licenseText = licenseTextOverrides[license] if (!licenseText) { var licenseFilename = licenseFilenameOverrides[license] || licensesFilenames[license] licenseText = fs.readFileSync(licenseFilename, 'utf8') .replace(/\s*$/, '') if (formLicenses[license]) licenseText = licenseText .replace(/(^|\n)\s*(Copyright |©)[^\n]*\n*/, return$1) } process.stdout.write('- ' + license + '\n\n' + pkgs.map(function (pkg) { return ' - ' + pkg.nameVersion + ' ' + ( copyrightOverrides[pkg.nameVersion] || pkg.copyright ) }).join('\n') .replace(/</g, '<') .replace(/>/g, '>') + '\n\n' + licenseText.replace(/^/gm, ' ') + '\n\n') } fs.createReadStream('/home/cel/src/patchfoo/node-v12.18.1-license.txt').pipe(process.stdout) })