Update buildLicenses to only include the theme url if there is one

This commit is contained in:
Nate Butler 2023-06-08 01:23:19 -04:00
parent e996a66596
commit 1e43fec1c5

View file

@ -30,17 +30,19 @@ function generateLicenseFile(themes: ThemeConfig[]) {
checkLicenses(themes) checkLicenses(themes)
for (const theme of themes) { for (const theme of themes) {
const licenseText = fs.readFileSync(theme.licenseFile).toString() const licenseText = fs.readFileSync(theme.licenseFile).toString()
writeLicense(theme.name, theme.licenseUrl, licenseText) writeLicense(theme.name, licenseText, theme.licenseUrl)
} }
} }
function writeLicense( function writeLicense(
themeName: string, themeName: string,
licenseUrl: string, licenseText: string,
licenseText: String licenseUrl?: string
) { ) {
process.stdout.write( process.stdout.write(
`## [${themeName}](${licenseUrl})\n\n${licenseText}\n********************************************************************************\n\n` licenseUrl
? `## [${themeName}](${licenseUrl})\n\n${licenseText}\n********************************************************************************\n\n`
: `## ${themeName}\n\n${licenseText}\n********************************************************************************\n\n`
) )
} }