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’ll 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
Changes from 1 commit
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
Next Next commit
Add using funding field from npm (#176)
MIKOLAJW197 committed Nov 30, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit c618a0d6d843727f1acb011529adc9d1c26fce4e
3 changes: 3 additions & 0 deletions src/__snapshots__/readme.spec.js.snap
Original file line number Diff line number Diff line change
@@ -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 />
@@ -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).
4 changes: 3 additions & 1 deletion src/project-infos.js
Original file line number Diff line number Diff line change
@@ -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
}
}

1 change: 1 addition & 0 deletions src/questions/index.js
Original file line number Diff line number Diff line change
@@ -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'),
1 change: 1 addition & 0 deletions src/questions/index.spec.js
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ describe('questions', () => {
'askProjectHomepage',
'askProjectDemoUrl',
'askProjectDocumentationUrl',
'askProjectFundingUrl',
'askAuhtorName',
'askAuthorGithub',
'askAuthorWebsite',
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
@@ -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',
4 changes: 4 additions & 0 deletions templates/default-no-html.md
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions templates/default.md
Original file line number Diff line number Diff line change
@@ -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