diff --git a/src/questions/author-github.js b/src/questions/author-github.js index 9ad3ed9..e7b1fa3 100644 --- a/src/questions/author-github.js +++ b/src/questions/author-github.js @@ -2,7 +2,7 @@ const { cleanSocialNetworkUsername } = require('../utils') module.exports = projectInfos => ({ type: 'input', - message: '👤 GitHub username (use empty value to skip)', + message: '👤 GitHub username (comma to split, empty to skip)', name: 'authorGithubUsername', default: projectInfos.githubUsername, filter: cleanSocialNetworkUsername diff --git a/src/questions/author-github.spec.js b/src/questions/author-github.spec.js index b831d6f..1b542b1 100644 --- a/src/questions/author-github.spec.js +++ b/src/questions/author-github.spec.js @@ -9,7 +9,7 @@ describe('askAuthorGithub', () => { expect(result).toEqual({ type: 'input', - message: '👤 GitHub username (use empty value to skip)', + message: '👤 GitHub username (comma to split, empty to skip)', name: 'authorGithubUsername', default: githubUsername, filter: expect.any(Function) diff --git a/src/questions/author-name.js b/src/questions/author-name.js index 2bc55c1..1afd589 100644 --- a/src/questions/author-name.js +++ b/src/questions/author-name.js @@ -1,6 +1,6 @@ module.exports = projectInfos => ({ type: 'input', - message: '👤 Author name', + message: '👤 Author name (use comma if several)', name: 'authorName', default: projectInfos.author }) diff --git a/src/questions/author-name.spec.js b/src/questions/author-name.spec.js index 36335c6..86f7d3e 100644 --- a/src/questions/author-name.spec.js +++ b/src/questions/author-name.spec.js @@ -9,7 +9,7 @@ describe('askAuthorName', () => { expect(result).toEqual({ type: 'input', - message: '👤 Author name', + message: '👤 Author name (use comma if several)', name: 'authorName', default: author }) diff --git a/src/questions/author-twitter.js b/src/questions/author-twitter.js index 145d5d9..acecc63 100644 --- a/src/questions/author-twitter.js +++ b/src/questions/author-twitter.js @@ -2,7 +2,7 @@ const { cleanSocialNetworkUsername } = require('../utils') module.exports = () => ({ type: 'input', - message: '🐦 Twitter username (use empty value to skip)', + message: '🐦 Twitter username (comma to split, empty to skip)', name: 'authorTwitterUsername', filter: cleanSocialNetworkUsername }) diff --git a/src/questions/author-twitter.spec.js b/src/questions/author-twitter.spec.js index 9e77a15..685029a 100644 --- a/src/questions/author-twitter.spec.js +++ b/src/questions/author-twitter.spec.js @@ -6,7 +6,7 @@ describe('askAuthorTwitter', () => { expect(result).toEqual({ type: 'input', - message: '🐦 Twitter username (use empty value to skip)', + message: '🐦 Twitter username (comma to split, empty to skip)', name: 'authorTwitterUsername', filter: expect.any(Function) }) diff --git a/templates/default-no-html.md b/templates/default-no-html.md index aff2056..7210253 100644 --- a/templates/default-no-html.md +++ b/templates/default-no-html.md @@ -17,10 +17,12 @@ [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](<%= repositoryUrl %>/graphs/commit-activity) <% } -%> <% if (licenseName) { -%> -[![License: <%= licenseName %>](https://img.shields.io/<%= isGithubRepos ? `github/license/${authorGithubUsername}/${projectName}` : `badge/License-${licenseName}-yellow.svg` %>)](<%= licenseUrl ? licenseUrl : '#' %>) +[![License: <%= licenseName %>](https://img.shields.io/<%= isGithubRepos ? `github/license/${authorGithubUsername.split(',')[0]}/${projectName}` : `badge/License-${licenseName}-yellow.svg` %>)](<%= licenseUrl ? licenseUrl : '#' %>) <% } -%> <% if (authorTwitterUsername) { -%> -[![Twitter: <%= authorTwitterUsername %>](https://img.shields.io/twitter/follow/<%= authorTwitterUsername %>.svg?style=social)](https://twitter.com/<%= authorTwitterUsername %>) +<% authorTwitterUsername.split(',').forEach(e => { -%> +[![Twitter: <%= e.trim() %>](https://img.shields.io/twitter/follow/<%= e.trim() %>.svg?style=social)](https://twitter.com/<%= e.trim() %>) +<% }) -%> <% } -%> <% if (projectDescription) { -%> @@ -67,16 +69,28 @@ ``` <% } -%> <% if (authorName || authorTwitterUsername || authorGithubUsername) { -%> +<% if (authorName.split(',').length > 1) { -%> + +## Authors + +<% } else { -%> ## Author -<% if (authorName) { %> -👤 **<%= authorName %>** + +<% } -%> +<% const names = authorName.split(',') -%> +<% const twitters = authorTwitterUsername.split(',') -%> +<% const githubs = authorGithubUsername.split(',') -%> +<% for (var i = 0; i < names.length; i++) { -%> +<% if (names[i]) { -%> +👤 **<%= names[i].trim() %>** <% } %> -<% if (authorTwitterUsername) { -%> -* Twitter: [@<%= authorTwitterUsername %>](https://twitter.com/<%= authorTwitterUsername %>) +<% if (twitters[i]) { -%> +* Twitter: [@<%= twitters[i].trim() %>](https://twitter.com/<%= twitters[i].trim() %>) +<% } -%> +<% if (githubs[i]) { -%> +* Github: [@<%= githubs[i].trim() %>](https://github.com/<%= githubs[i].trim() %>) <% } -%> -<% if (authorGithubUsername) { -%> -* Github: [@<%= authorGithubUsername %>](https://github.com/<%= authorGithubUsername %>) <% } -%> <% } -%> <% if (contributingUrl) { -%> @@ -101,9 +115,11 @@ Give a ⭐️ if this project helped you! ## 📝 License <% if (authorName && authorGithubUsername) { -%> -Copyright © <%= currentYear %> [<%= authorName %>](https://github.com/<%= authorGithubUsername %>). - +<% const authors = authorName.split(',') -%> +<% const githubs = authorGithubUsername.split(',') -%> +Copyright © <%= currentYear %> [<%= authors[0].trim() %>](https://github.com/<%= githubs[0].trim() %>)<% for (var i = 1; i < authors.length; i++) { if (authors[i] && githubs[i]) { -%>, [<%= authors[i].trim() %>](https://github.com/<%= githubs[i].trim() %>)<%_ }} _%>. <% } -%> + This project is [<%= licenseName %>](<%= licenseUrl %>) licensed. <% } -%> diff --git a/templates/default.md b/templates/default.md index d25085e..167fb13 100644 --- a/templates/default.md +++ b/templates/default.md @@ -25,13 +25,15 @@ <% } -%> <% if (licenseName) { -%> <a href="<%= licenseUrl ? licenseUrl : '#' %>" target="_blank"> - <img alt="License: <%= licenseName %>" src="https://img.shields.io/<%= isGithubRepos ? `github/license/${authorGithubUsername}/${projectName}` : `badge/License-${licenseName}-yellow.svg` %>" /> + <img alt="License: <%= licenseName %>" src="https://img.shields.io/<%= isGithubRepos ? `github/license/${authorGithubUsername.split(',')[0]}/${projectName}` : `badge/License-${licenseName}-yellow.svg` %>" /> </a> <% } -%> <% if (authorTwitterUsername) { -%> - <a href="https://twitter.com/<%= authorTwitterUsername %>" target="_blank"> - <img alt="Twitter: <%= authorTwitterUsername %>" src="https://img.shields.io/twitter/follow/<%= authorTwitterUsername %>.svg?style=social" /> +<% authorTwitterUsername.split(',').forEach(e => { -%> + <a href="https://twitter.com/<%= e.trim() %>" target="_blank"> + <img alt="Twitter: <%= e.trim() %>" src="https://img.shields.io/twitter/follow/<%= e.trim() %>.svg?style=social" /> </a> +<% }) -%> <% } -%> </p> <% if (projectDescription) { -%> @@ -79,16 +81,26 @@ ``` <% } -%> <% if (authorName || authorTwitterUsername || authorGithubUsername) { -%> +<% if (authorName.split(',').length > 1) { -%> + +## Authors +<% } else { -%> ## Author -<% if (authorName) { %> -👤 **<%= authorName %>** +<% } -%> +<% const names = authorName.split(',') -%> +<% const twitters = authorTwitterUsername.split(',') -%> +<% const githubs = authorGithubUsername.split(',') -%> +<% for (var i = 0; i < names.length; i++) { -%> +<% if (names[i]) { %> +👤 **<%= names[i].trim() %>** <% } %> -<% if (authorTwitterUsername) { -%> -* Twitter: [@<%= authorTwitterUsername %>](https://twitter.com/<%= authorTwitterUsername %>) +<% if (twitters[i]) { -%> +* Twitter: [@<%= twitters[i].trim() %>](https://twitter.com/<%= twitters[i].trim() %>) +<% } -%> +<% if (githubs[i]) { -%> +* Github: [@<%= githubs[i].trim() %>](https://github.com/<%= githubs[i].trim() %>) <% } -%> -<% if (authorGithubUsername) { -%> -* Github: [@<%= authorGithubUsername %>](https://github.com/<%= authorGithubUsername %>) <% } -%> <% } -%> <% if (contributingUrl) { -%> @@ -112,7 +124,9 @@ Give a ⭐️ if this project helped you! ## 📝 License <% if (authorName && authorGithubUsername) { -%> -Copyright © <%= currentYear %> [<%= authorName %>](https://github.com/<%= authorGithubUsername %>).<br /> +<% const authors = authorName.split(',') -%> +<% const githubs = authorGithubUsername.split(',') -%> +Copyright © <%= currentYear %> [<%= authors[0].trim() %>](https://github.com/<%= githubs[0].trim() %>)<% for (var i = 1; i < authors.length; i++) { if (authors[i] && githubs[i]) { -%>, [<%= authors[i].trim() %>](https://github.com/<%= githubs[i].trim() %>)<%_ }} _%>.<br /> <% } -%> This project is [<%= licenseName %>](<%= licenseUrl %>) licensed. <% } -%>