diff --git a/src/commands/config/author/email.ts b/src/commands/config/author/email.ts index 2fd2902..01693d4 100644 --- a/src/commands/config/author/email.ts +++ b/src/commands/config/author/email.ts @@ -15,7 +15,7 @@ export function execute(data: string) { } console.log( chalk.bold.red( - "Failed to set author's email because the set email is not valid", + `Failed to set author's email ${data}, because the set email is not valid`, ), ); } diff --git a/src/commands/config/author/url.ts b/src/commands/config/author/url.ts index fa07ac2..80227d2 100644 --- a/src/commands/config/author/url.ts +++ b/src/commands/config/author/url.ts @@ -2,6 +2,10 @@ import * as LocalStorage from '../../../utils/local-storage'; const chalk = require('chalk'); export function execute(data: string) { + if (data[data.length - 1] === "/"){ + data = data.substring(0, data.length - 1) + } + if ( /^(?:(http|https|ftp):\/\/)?((|[\w-]+\.)+[a-z0-9]+)(?:(\/[^/?#]+)*)?(\?[^#]+)?(#.+)?$/i.test( data, @@ -15,7 +19,7 @@ export function execute(data: string) { } console.log( chalk.bold.red( - "Failed to set author's url because the set url is not valid", + `Failed to set author's url ${data}, because the set url is not valid`, ), ); } diff --git a/src/template/ts-package/README.md b/src/template/ts-package/README.md index efeb0e9..d4a7722 100644 --- a/src/template/ts-package/README.md +++ b/src/template/ts-package/README.md @@ -1,5 +1,5 @@ # ${project.name} -[![standard-readme compliant](https://img.shields.io/badge/${project.name}-v${project.version}-green.svg?style=flat-square)](${project.repository}) +[![standard-readme compliant](https://img.shields.io/badge/${project.name-badge}-v0.0.0--alpha.1-green.svg?style=flat-square)](${project.repository}) ${project.description} diff --git a/src/template/ts-package/package.json b/src/template/ts-package/package.json index 95e8f31..4064865 100644 --- a/src/template/ts-package/package.json +++ b/src/template/ts-package/package.json @@ -17,7 +17,7 @@ }, "repository": { "type": "git", - "url": "git+${project.repository}" + "url": "git+${project.repository}.git" }, "author": "${author.name} <${author.email}> (${author.url})", "license": "MIT", diff --git a/src/utils/local-storage.ts b/src/utils/local-storage.ts index dcfc268..2f317d9 100644 --- a/src/utils/local-storage.ts +++ b/src/utils/local-storage.ts @@ -30,12 +30,12 @@ export function read(target?: string) { try { const ReadData = JSON.parse(fs.readFileSync(LocalStorageFile, 'utf-8')); if (target) { - return new Function('ReadData', `return ReadData.${target}`)(ReadData); + return new Function('ReadData', 'DefaultData', `return Object.assign(DefaultData.${target},ReadData.${target})`)(ReadData, DefaultData); } - return ReadData; + return ReadData || DefaultData; } catch (e) { if (target) { - return ''; + return new Function( 'DefaultData', `return DefaultData.${target}`)(DefaultData); } return DefaultData; }