Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add using npm funding field 馃捀 #191

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ Feel free to check [issues page](https://github.com/kefranabg/readme-md-generato
<td align="center"><a href="https://github.com/anku255"><img src="https://avatars1.githubusercontent.com/u/22813027?v=4" width="75px;" alt="Ankit Tiwari"/><br /><sub><b>Ankit Tiwari</b></sub></a><br /><a href="https://github.com/kefranabg/readme-md-generator/commits?author=anku255" title="Code">馃捇</a> <a href="https://github.com/kefranabg/readme-md-generator/commits?author=anku255" title="Tests">鈿狅笍</a> <a href="https://github.com/kefranabg/readme-md-generator/issues?q=author%3Aanku255" title="Bug reports">馃悰</a></td>
<td align="center"><a href="https://github.com/Zenigata"><img src="https://avatars1.githubusercontent.com/u/1022393?v=4" width="75px;" alt="Johan Bonneau"/><br /><sub><b>Johan Bonneau</b></sub></a><br /><a href="https://github.com/kefranabg/readme-md-generator/commits?author=Zenigata" title="Code">馃捇</a></td>
<td align="center"><a href="https://github.com/hgwood/blog"><img src="https://avatars0.githubusercontent.com/u/1656170?v=4" width="75px;" alt="Hugo Wood"/><br /><sub><b>Hugo Wood</b></sub></a><br /><a href="https://github.com/kefranabg/readme-md-generator/commits?author=hgwood" title="Code">馃捇</a></td>
<td align="center"><a href="https://github.com/MIKOLAJW197"><img src="https://avatars3.githubusercontent.com/u/42266201?v=4" width="75px;" alt="Miko艂aj Wolicki"/><br /><sub><b>Miko艂aj Wolicki</b></sub></a><br /><a href="https://github.com/kefranabg/readme-md-generator/commits?author=MIKOLAJW197" title="Code">馃捇</a></td>
</tr>
</table>

Expand Down
3 changes: 3 additions & 0 deletions src/__snapshots__/readme.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ Give a 猸愶笍 if this project helped you!
<img src=\\"https://c5.patreon.com/external/logo/[email protected]\\" width=\\"160\\">
</a>



## 馃摑 License

Copyright 漏 2019 [Franck Abgrall](https://github.com/kefranabg).<br />
Expand Down Expand Up @@ -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).
Expand Down
4 changes: 3 additions & 1 deletion src/project-infos.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -178,7 +179,8 @@ const getProjectInfos = async () => {
isGithubRepos,
usage,
testCommand,
isJSProject
isJSProject,
fundingUrl
}
}

Expand Down
1 change: 1 addition & 0 deletions src/questions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
1 change: 1 addition & 0 deletions src/questions/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('questions', () => {
'askProjectHomepage',
'askProjectDemoUrl',
'askProjectDocumentationUrl',
'askProjectFundingUrl',
'askAuhtorName',
'askAuthorGithub',
'askAuthorWebsite',
Expand Down
6 changes: 6 additions & 0 deletions src/questions/project-funding-url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = projectInfos => ({
type: 'input',
message: '馃捀 Project funding url (use empty value to skip)',
name: 'projectFundingUrl',
default: projectInfos.fundingUrl
})
17 changes: 17 additions & 0 deletions src/questions/project-funding.spec-url.js
Original file line number Diff line number Diff line change
@@ -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
})
})
})
1 change: 1 addition & 0 deletions src/readme.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 4 additions & 0 deletions templates/default-no-html.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions templates/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ Give a 猸愶笍 if this project helped you!
<img src="https://c5.patreon.com/external/logo/[email protected]" width="160">
</a>
<% } -%>

<% if (projectFundingUrl) { -%>
You can also support this project [here.](<%= projectFundingUrl %>)
<% } -%>

<% if (licenseName && licenseUrl) { -%>

## 馃摑 License
Expand Down