(projectRoot, pkg, options)
| 80 | } |
| 81 | |
| 82 | async function updateLicense(projectRoot, pkg, options) { |
| 83 | if (!options.updateLicense) return; |
| 84 | const fs = options.fs || FSE; |
| 85 | let licenseId = options.license; |
| 86 | if (typeof licenseId === 'object') { |
| 87 | licenseId = licenseId.id; |
| 88 | } |
| 89 | pkg.set('license', licenseId); |
| 90 | pkg.set('copyright.owner', options.copyrightOwner); |
| 91 | await fs.write( |
| 92 | path.join(projectRoot, 'LICENSE'), |
| 93 | renderLicense({ |
| 94 | name: pkg.get('name'), |
| 95 | owner: options.copyrightOwner, |
| 96 | license: options.license, |
| 97 | years: await getYears(projectRoot), |
| 98 | }), |
| 99 | ); |
| 100 | } |
| 101 | |
| 102 | exports.renderLicense = renderLicense; |
| 103 | exports.spdxLicenseList = spdxLicenseList; |
no test coverage detected