From cae2b2ad7563cfa2e95371a1e4581dd1dded32b4 Mon Sep 17 00:00:00 2001 From: Timo Hocker Date: Sun, 26 Apr 2020 12:04:10 +0200 Subject: [PATCH] fix --- lib/snippets/copyright/index.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/snippets/copyright/index.ts b/lib/snippets/copyright/index.ts index 4e19a68..ed7e534 100644 --- a/lib/snippets/copyright/index.ts +++ b/lib/snippets/copyright/index.ts @@ -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 }) ); }