1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

revert some changes, fix formatting

This commit is contained in:
Andrew Simachev 2023-03-01 15:52:10 +03:00
parent 3148b0fbe9
commit ab75d57be1
No known key found for this signature in database
GPG key ID: 49A163D0D14E6FD8
2 changed files with 46 additions and 48 deletions

View file

@ -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);
});

View file

@ -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": [