Add go licenses to licenses.txt (#21034)
`make go-licenses` will generate `assets/go-licenses.json` which is then included in the webpack build. This step depends on both go and node being present, so unfortunately, I could not automate the generation by hooking it up to `tidy` as that target is triggered on CI where we do not have a docker image with both go an node. It should be ran from time to time, ideally after each go mod update.tokarchuk/v1.18
parent
82c6f7bf4a
commit
49efd1fb96
File diff suppressed because one or more lines are too long
@ -0,0 +1,30 @@ |
|||||||
|
#!/usr/bin/env node
|
||||||
|
import fastGlob from 'fast-glob'; |
||||||
|
import {fileURLToPath} from 'url'; |
||||||
|
import {readFileSync, writeFileSync} from 'fs'; |
||||||
|
import wrapAnsi from 'wrap-ansi'; |
||||||
|
import {join, dirname} from 'path'; |
||||||
|
|
||||||
|
const base = process.argv[2]; |
||||||
|
const out = process.argv[3]; |
||||||
|
|
||||||
|
function exit(err) { |
||||||
|
if (err) console.error(err); |
||||||
|
process.exit(err ? 1 : 0); |
||||||
|
} |
||||||
|
|
||||||
|
async function main() { |
||||||
|
const data = fastGlob.sync('**/*', { |
||||||
|
cwd: fileURLToPath(new URL(`../${base}`, import.meta.url)), |
||||||
|
}).filter((path) => { |
||||||
|
return /\/((UN)?LICEN(S|C)E|COPYING|NOTICE)/i.test(path); |
||||||
|
}).sort().map((path) => { |
||||||
|
return { |
||||||
|
name: dirname(path), |
||||||
|
body: wrapAnsi(readFileSync(join(base, path), 'utf8') || '', 80) |
||||||
|
}; |
||||||
|
}); |
||||||
|
writeFileSync(out, JSON.stringify(data, null, 2)); |
||||||
|
} |
||||||
|
|
||||||
|
main().then(exit).catch(exit); |
Loading…
Reference in new issue