Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | const fs = require("fs"); const glob = require("glob"); const path = require("path"); glob("{libs,packages}/*/*/package.json", (err, files) => { if (err) throw err; files.forEach((file) => { fs.readFile(file, "utf8", (err, data) => { if (err) throw err; const pkg = JSON.parse(data); const licenseFile = `${pkg.license.split(" ").join("_")}.md`; const src = `licenses/${licenseFile}`; const target = `${path.dirname(file)}/LICENSE.md`; fs.copyFile(src, target, (err) => { if (err) throw err; console.log(`${src} was copied to ${target}`); }); }); }); }); |