-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
607d57f
commit 41185ed
Showing
7 changed files
with
166 additions
and
42 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,48 @@ | ||
export const getOSADL = (spdxid: string): string => { | ||
return `https://spdx.org/licenses/${spdxid}.html`; | ||
}; | ||
export class LicenseUtil { | ||
private BASE_OSADL_URL = 'https://spdx.org/licenses'; | ||
private HTML = 'html'; | ||
constructor() { | ||
this.init(); | ||
} | ||
|
||
private defaultCopyleftLicenses = new Set<string>( | ||
[ | ||
'GPL-1.0-only', | ||
'GPL-2.0-only', | ||
'GPL-3.0-only', | ||
'AGPL-3.0-only', | ||
'Sleepycat', | ||
'Watcom-1.0', | ||
'GFDL-1.1-only', | ||
'GFDL-1.2-only', | ||
'GFDL-1.3-only', | ||
'LGPL-2.1-only', | ||
'LGPL-3.0-only', | ||
'MPL-1.1', | ||
'MPL-2.0', | ||
'EPL-1.0', | ||
'EPL-2.0', | ||
'CDDL-1.0', | ||
'CDDL-1.1', | ||
'CECILL-2.1', | ||
'Artistic-1.0', | ||
'Artistic-2.0', | ||
'CC-BY-SA-4.0' | ||
].map(l => l.toLowerCase()) | ||
); | ||
|
||
private copyLeftLicenses = new Set<string>(); | ||
|
||
private init(): void { | ||
this.copyLeftLicenses = this.defaultCopyleftLicenses; | ||
} | ||
|
||
isCopyLeft(spdxid: string): boolean { | ||
return this.copyLeftLicenses.has(spdxid); | ||
} | ||
|
||
getOSADL(spdxid: string): string { | ||
return `${this.BASE_OSADL_URL}/${spdxid}/.${this.HTML}`; | ||
} | ||
} | ||
export const licenseUtil = new LicenseUtil(); |