-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Update spec file license generating, deprecate old Webpack pl…
…ugin" This reverts commit 6848428.
- Loading branch information
Showing
18 changed files
with
2,232 additions
and
4,036 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
|
||
function fillSpecFile() { | ||
delete require.cache[require.resolve("../vendors/npm.licenses.structured")]; | ||
const { npmLicensesArray } = require("../vendors/npm.licenses.structured"); | ||
|
||
// Keep the original base license | ||
npmLicensesArray.push("GPL-2.0-only"); | ||
// Files under `web/html/javascript` are MIT licensed but won't be inferred from the automatic list | ||
npmLicensesArray.push("MIT"); | ||
|
||
//https://github.com/metal/metal.js/issues/411 | ||
const processedLicenses = npmLicensesArray.map((item) => { | ||
if (item === "BSD") { | ||
return "0BSD"; | ||
} | ||
return item; | ||
}); | ||
const mappedProcessedLicenses = Array.from(new Set(processedLicenses)).sort().join(" AND "); | ||
|
||
const specFileLocation = "../../spacewalk-web.spec"; | ||
|
||
return new Promise(function (resolve, reject) { | ||
fs.readFile(specFileLocation, "utf8", function (err, specFile) { | ||
if (err) { | ||
reject(err); | ||
throw err; | ||
} | ||
const editedSpecFile = specFile.replace( | ||
/(?<=%package -n spacewalk-html[\s\S]*?)License:.*/m, | ||
`License: ${mappedProcessedLicenses}` | ||
); | ||
|
||
if (editedSpecFile === specFile) { | ||
console.log(`${path.basename(specFileLocation)} is already up to date.`); | ||
resolve(); | ||
return; | ||
} | ||
|
||
fs.writeFile(specFileLocation, editedSpecFile, "utf8", function (err) { | ||
if (err) { | ||
reject(err); | ||
throw err; | ||
} | ||
|
||
console.log( | ||
`${path.basename( | ||
specFileLocation | ||
)} was updated successfully with the following licenses for spacewalk-html: ${mappedProcessedLicenses}` | ||
); | ||
resolve(); | ||
}); | ||
}); | ||
}); | ||
} | ||
|
||
module.exports = { | ||
fillSpecFile, | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.