diff --git a/.all-contributorsrc b/.all-contributorsrc index 6a9e2f3..f0c4fe7 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -199,6 +199,15 @@ "contributions": [ "code" ] + }, + { + "login": "MIKOLAJW197", + "name": "Mikołaj Wolicki", + "avatar_url": "https://avatars3.githubusercontent.com/u/42266201?v=4", + "profile": "https://github.com/MIKOLAJW197", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 757c0a2..6637003 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ Feel free to check [issues page](https://github.com/kefranabg/readme-md-generato Ankit Tiwari
Ankit Tiwari

💻 ⚠️ 🐛 Johan Bonneau
Johan Bonneau

💻 Hugo Wood
Hugo Wood

💻 + Mikołaj Wolicki
Mikołaj Wolicki

💻 diff --git a/src/__snapshots__/readme.spec.js.snap b/src/__snapshots__/readme.spec.js.snap index c2c9b13..f4b9aff 100644 --- a/src/__snapshots__/readme.spec.js.snap +++ b/src/__snapshots__/readme.spec.js.snap @@ -72,6 +72,8 @@ Give a ⭐️ if this project helped you! + + ## 📝 License Copyright © 2019 [Franck Abgrall](https://github.com/kefranabg).
@@ -142,6 +144,7 @@ Give a ⭐️ if this project helped you! [![support us](https://img.shields.io/badge/become-a patreon%20us-orange.svg?cacheSeconds=2592000)](https://www.patreon.com/FranckAbgrall) + ## 📝 License Copyright © 2019 [Franck Abgrall](https://github.com/kefranabg). diff --git a/src/project-infos.js b/src/project-infos.js index 9bc3850..2fe0325 100644 --- a/src/project-infos.js +++ b/src/project-infos.js @@ -134,6 +134,7 @@ const getProjectInfos = async () => { const author = getAuthorName(packageJson) const version = get(packageJson, 'version', undefined) const licenseName = get(packageJson, 'license', undefined) + const fundingUrl = get(packageJson, 'funding.url', undefined) const homepage = get(packageJson, 'homepage', undefined) const usage = has(packageJson, 'scripts.start') ? 'npm run start' : undefined const testCommand = has(packageJson, 'scripts.test') @@ -178,7 +179,8 @@ const getProjectInfos = async () => { isGithubRepos, usage, testCommand, - isJSProject + isJSProject, + fundingUrl } } diff --git a/src/questions/index.js b/src/questions/index.js index cf539ad..0efed65 100644 --- a/src/questions/index.js +++ b/src/questions/index.js @@ -6,6 +6,7 @@ module.exports = { askProjectHomepage: require('./project-homepage'), askProjectDemoUrl: require('./project-demo-url'), askProjectDocumentationUrl: require('./project-documentation-url'), + askProjectFundingUrl: require('./project-funding-url'), askAuhtorName: require('./author-name'), askAuthorGithub: require('./author-github'), askAuthorWebsite: require('./author-website'), diff --git a/src/questions/index.spec.js b/src/questions/index.spec.js index 3b533d0..d29b171 100644 --- a/src/questions/index.spec.js +++ b/src/questions/index.spec.js @@ -11,6 +11,7 @@ describe('questions', () => { 'askProjectHomepage', 'askProjectDemoUrl', 'askProjectDocumentationUrl', + 'askProjectFundingUrl', 'askAuhtorName', 'askAuthorGithub', 'askAuthorWebsite', diff --git a/src/questions/project-funding-url.js b/src/questions/project-funding-url.js new file mode 100644 index 0000000..1997dc4 --- /dev/null +++ b/src/questions/project-funding-url.js @@ -0,0 +1,6 @@ +module.exports = projectInfos => ({ + type: 'input', + message: '💸 Project funding url (use empty value to skip)', + name: 'projectFundingUrl', + default: projectInfos.fundingUrl +}) diff --git a/src/questions/project-funding.spec-url.js b/src/questions/project-funding.spec-url.js new file mode 100644 index 0000000..876e915 --- /dev/null +++ b/src/questions/project-funding.spec-url.js @@ -0,0 +1,17 @@ +const askProjectFundingUrl = require('./project-funding-url') + +describe('askProjectFunding', () => { + it('should return correct question format', () => { + const fundingUrl = 'fundingUrl' + const projectInfos = { fundingUrl } + + const result = askProjectFundingUrl(projectInfos) + + expect(result).toEqual({ + type: 'input', + message: '💸 Project funding url (use empty value to skip)', + name: 'projectFundingUrl', + default: fundingUrl + }) + }) +}) diff --git a/src/readme.spec.js b/src/readme.spec.js index 041f7af..6f6518f 100644 --- a/src/readme.spec.js +++ b/src/readme.spec.js @@ -93,6 +93,7 @@ describe('readme', () => { projectHomepage: 'https://github.com/kefranabg/readme-md-generator#readme', projectDemoUrl: 'https://github.com/kefranabg/readme-md-generator#-demo', + projectFundingUrl: null, authorName: 'Franck Abgrall', authorWebsite: 'https://www.franck-abgrall.me/', authorGithubUsername: 'kefranabg', diff --git a/templates/default-no-html.md b/templates/default-no-html.md index 02d7c89..48b029f 100644 --- a/templates/default-no-html.md +++ b/templates/default-no-html.md @@ -102,6 +102,10 @@ Give a ⭐️ if this project helped you! [![support us](https://img.shields.io/badge/become-a patreon%20us-orange.svg?cacheSeconds=2592000)](https://www.patreon.com/<%= authorPatreonUsername %>) <% } -%> +<% if (projectFundingUrl) { -%> +You can also support this project [here.](<%= projectFundingUrl %>) +<% } -%> + <% if (licenseName && licenseUrl) { -%> ## 📝 License diff --git a/templates/default.md b/templates/default.md index 42481d9..0425007 100644 --- a/templates/default.md +++ b/templates/default.md @@ -113,6 +113,11 @@ Give a ⭐️ if this project helped you! <% } -%> + +<% if (projectFundingUrl) { -%> +You can also support this project [here.](<%= projectFundingUrl %>) +<% } -%> + <% if (licenseName && licenseUrl) { -%> ## 📝 License