This commit is contained in:
Timo Hocker 2020-04-26 12:04:10 +02:00
parent b69e6a36c3
commit cae2b2ad75

View File

@ -29,25 +29,27 @@ export default class Copyright implements Snippet {
if (!this.options) if (!this.options)
await this.gather_options (); await this.gather_options ();
const options = this.options as CopyrightOptions;
await FileMapper.map_all_files ( await FileMapper.map_all_files (
this.cwd, this.cwd,
this.fix_file_license.bind (this) this.fix_file_license.bind (this)
); );
modify_json ((json) => { modify_json ((json) => {
json.author = `${this.options.author} <${this.options.email}>`; json.author = `${options.author} <${options.email}>`;
json.license = this.options.has_license json.license = options.has_license
? this.options.license ? options.license
: 'UNLICENSED'; : 'UNLICENSED';
}); });
if (this.options.has_license) { if (options.has_license) {
await fs.writeFile ( await fs.writeFile (
path.join (cwd, 'LICENSE'), path.join (cwd, 'LICENSE'),
getLicense (this.options.license, { getLicense (options.license, {
name: this.options.author, name: options.author,
email: this.options.email, email: options.email,
project: this.options.software project: options.software
}) })
); );
} }