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)
await this.gather_options ();
const options = this.options as CopyrightOptions;
await FileMapper.map_all_files (
this.cwd,
this.fix_file_license.bind (this)
);
modify_json ((json) => {
json.author = `${this.options.author} <${this.options.email}>`;
json.license = this.options.has_license
? this.options.license
json.author = `${options.author} <${options.email}>`;
json.license = options.has_license
? options.license
: 'UNLICENSED';
});
if (this.options.has_license) {
if (options.has_license) {
await fs.writeFile (
path.join (cwd, 'LICENSE'),
getLicense (this.options.license, {
name: this.options.author,
email: this.options.email,
project: this.options.software
getLicense (options.license, {
name: options.author,
email: options.email,
project: options.software
})
);
}