diff --git a/check-licenses.js b/check-licenses.js index 7ba5c651d2..b08d2ec322 100644 --- a/check-licenses.js +++ b/check-licenses.js @@ -1,57 +1,56 @@ const fs = require('fs'); const https = require('https'); - const remoteConfigUrl = 'https://raw.githubusercontent.com/anytypeio/open/main/compliance/licenses-config.json'; function processLicenses(licenses, allowedLicenses) { - const disallowedPackages = Object.keys(licenses).filter(pkg => { - var pkgLicenses = licenses[pkg].licenses.replace(/[()*]/g, '') + const disallowedPackages = Object.keys(licenses).filter(pkg => { + var pkgLicenses = licenses[pkg].licenses.replace(/[()*]/g, '') + + // The hyphenation language patterns are licensed under the LGPL (unless otherwise noted) and copyrighted to their respective creators and maintainers. + // https://github.com/bramstein/hyphenation-patterns + if (pkgLicenses == "UNKNOWN") { + pkgLicenses = "LGPL" + } - // The hyphenation language patterns are licensed under the LGPL (unless otherwise noted) and copyrighted to their respective creators and maintainers. - // https://github.com/bramstein/hyphenation-patterns - if (pkgLicenses == "UNKNOWN") { - pkgLicenses = "LGPL" - } + // Solutions developed by Anytype are allowed + if (licenses[pkg].publisher == "Anytype") { + return false; + } + + if (pkgLicenses.includes(' AND ')) { + const licenseNames = pkgLicenses.split(' AND ') + return !licenseNames.every(name => allowedLicenses.includes(name)); + } - // Solutions developed by Anytype are allowed - if (licenses[pkg].publisher == "Anytype") { - return false; - } - - if (pkgLicenses.includes(' AND ')) { - const licenseNames = pkgLicenses.split(' AND ') - return !licenseNames.every(name => allowedLicenses.includes(name)); - } - - const licenseNames = pkgLicenses.split(' OR '); - return !licenseNames.some(name => allowedLicenses.includes(name)); - }); - if (disallowedPackages.length > 0) { - console.error('The following packages have disallowed licenses:'); - disallowedPackages.forEach(pkg => { - console.error(`- ${pkg} (${licenses[pkg].licenses})`); - }); - process.exit(1); - } else { - console.info('All packages have allowed licenses.') - } + const licenseNames = pkgLicenses.split(' OR '); + return !licenseNames.some(name => allowedLicenses.includes(name)); + }); + if (disallowedPackages.length > 0) { + console.error('The following packages have disallowed licenses:'); + disallowedPackages.forEach(pkg => { + console.error(`- ${pkg} (${licenses[pkg].licenses})`); + }); + process.exit(1); + } else { + console.info('All packages have allowed licenses.') + } } https.get(remoteConfigUrl, (res) => { - let data = ''; - res.on('data', (chunk) => { - data += chunk; - }); - res.on('end', () => { - const config = JSON.parse(data); - const allowedLicenses = config.allowedLicenses; - fs.readFile('./licenses.json', 'utf8', (err, data) => { - if (err) throw err; - const licenses = JSON.parse(data); - processLicenses(licenses, allowedLicenses); - }); - }); + let data = ''; + res.on('data', (chunk) => { + data += chunk; + }); + res.on('end', () => { + const config = JSON.parse(data); + const allowedLicenses = config.allowedLicenses; + fs.readFile('./licenses.json', 'utf8', (err, data) => { + if (err) throw err; + const licenses = JSON.parse(data); + processLicenses(licenses, allowedLicenses); + }); + }); }).on('error', (err) => { - console.error(`Error retrieving remote configuration: ${err}`); - process.exit(1); + console.error(`Error retrieving remote configuration: ${err}`); + process.exit(1); }); diff --git a/package.json b/package.json index 6942e5dfb7..ddc895a7d6 100644 --- a/package.json +++ b/package.json @@ -526,7 +526,7 @@ "publish": [ { "provider": "spaces", - "name": "at9412003", + "name": "anytype-release", "region": "fra1" } ], @@ -545,7 +545,7 @@ "publish": [ { "provider": "spaces", - "name": "at9412003", + "name": "anytype-release", "region": "fra1" } ] @@ -560,7 +560,6 @@ "snap", "AppImage", "deb", - "rpm" ], "description": "Anytype", "publish": [