mirror of https://github.com/feross/funding
Compare commits
16 Commits
Author | SHA1 | Date |
---|---|---|
![]() |
56f8887088 | |
![]() |
9460c64a43 | |
![]() |
58b090c51c | |
![]() |
b12b311554 | |
![]() |
4a04573bc8 | |
![]() |
7238cd97d6 | |
![]() |
d07b9af505 | |
![]() |
03937d3f11 | |
![]() |
2485ab553e | |
![]() |
8115da8aa9 | |
![]() |
427bb8ffb6 | |
![]() |
356655d985 | |
![]() |
705e7c9c23 | |
![]() |
67746f78f2 | |
![]() |
ebce9a2a28 | |
![]() |
4593e982d6 |
|
@ -1,2 +1,3 @@
|
||||||
.travis.yml
|
.travis.yml
|
||||||
test/
|
test/
|
||||||
|
tools/
|
||||||
|
|
23
README.md
23
README.md
|
@ -11,6 +11,8 @@
|
||||||
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
|
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
|
||||||
[standard-url]: https://standardjs.com
|
[standard-url]: https://standardjs.com
|
||||||
|
|
||||||
|
### UPDATE: The experiment is over – Feross posted [a recap](https://feross.org/funding-experiment-recap/) on his blog
|
||||||
|
|
||||||
This is an open source funding experiment! The current model of sustaining open source is not working. We desperately need more experimentation. This is one such experiment.
|
This is an open source funding experiment! The current model of sustaining open source is not working. We desperately need more experimentation. This is one such experiment.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
@ -19,20 +21,13 @@ This is an open source funding experiment! The current model of sustaining open
|
||||||
npm install funding
|
npm install funding
|
||||||
```
|
```
|
||||||
|
|
||||||
- Maintainers: [Apply to join the experiment](https://forms.gle/4agtnXJLS9E6qLaX9)
|
### UPDATE: The experiment is over – Feross posted [a recap](https://feross.org/funding-experiment-recap/) on his blog
|
||||||
- Companies: [Post a terminal ad](https://forms.gle/hoJ9fJhP86kSGcvT6)
|
|
||||||
|
|
||||||
## See it action
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx funding
|
|
||||||
```
|
|
||||||
|
|
||||||
## What is this?
|
## What is this?
|
||||||
|
|
||||||
This is an open source funding experiment! ✨
|
This is an open source funding experiment! ✨
|
||||||
|
|
||||||
Whenever users install open source software, this package will display a message from a company that supports open source. Currently, these are [Linode](https://welcome.linode.com/standardjs) and [LogRocket](https://logrocket.com/term). The sponsorship pays directly for maintainer time. That is, writing new features, fixing bugs, answering user questions, and improving documentation.
|
Whenever users install open source software, this package will display a message from a company that supports open source. The sponsorship pays directly for maintainer time. That is, writing new features, fixing bugs, answering user questions, and improving documentation.
|
||||||
|
|
||||||
The goal is to make sure that packages are well-maintained now and for the foreseeable future, with regular releases, improved reliability, and timely security patches. Healthy open source packages benefit users and maintainers alike.
|
The goal is to make sure that packages are well-maintained now and for the foreseeable future, with regular releases, improved reliability, and timely security patches. Healthy open source packages benefit users and maintainers alike.
|
||||||
|
|
||||||
|
@ -46,6 +41,8 @@ This experiment is currently running on a few open source projects that [Feross]
|
||||||
|
|
||||||
- [`standard`](https://standardjs.com)
|
- [`standard`](https://standardjs.com)
|
||||||
|
|
||||||
|
### UPDATE: The experiment is over – Feross posted [a recap](https://feross.org/funding-experiment-recap/) on his blog
|
||||||
|
|
||||||
## Who is Feross?
|
## Who is Feross?
|
||||||
|
|
||||||
Hey there, I'm Feross!
|
Hey there, I'm Feross!
|
||||||
|
@ -71,3 +68,11 @@ The funds raised so far ($2,000) have paid for Feross's time to [release Standar
|
||||||
## Where can I provide feedback about this experiment?
|
## Where can I provide feedback about this experiment?
|
||||||
|
|
||||||
You can open an issue. But please be kind. I'm a human with feelings. ❤️
|
You can open an issue. But please be kind. I'm a human with feelings. ❤️
|
||||||
|
|
||||||
|
## How can I disable this?
|
||||||
|
|
||||||
|
Just to be super clear: **This package does no tracking or data collecting — and it will always stay this way.** It's just a fancy `console.log()`.
|
||||||
|
|
||||||
|
If you support open source through direct contributions, donations, or however else you see fit, you can permanently silence `funding` by adding an environment variable `OPEN_SOURCE_CONTRIBUTOR=true` to your terminal environment.
|
||||||
|
|
||||||
|
Note, `funding` also respects npm's `loglevel` setting, so e.g. `npm install --silent` and `npm install --quiet` will be respected.
|
||||||
|
|
3
index.js
3
index.js
|
@ -90,6 +90,9 @@ function printMessage () {
|
||||||
// Do not print message when one has been shown recently
|
// Do not print message when one has been shown recently
|
||||||
if (isShownRecently()) return
|
if (isShownRecently()) return
|
||||||
|
|
||||||
|
// Skip running if no messages are available
|
||||||
|
if (messages.length === 0) return
|
||||||
|
|
||||||
// Select a random message
|
// Select a random message
|
||||||
const i = Math.floor(Math.random() * messages.length)
|
const i = Math.floor(Math.random() * messages.length)
|
||||||
const message = messages[i]
|
const message = messages[i]
|
||||||
|
|
|
@ -7,7 +7,8 @@ const ciInfo = require('ci-info')
|
||||||
|
|
||||||
const {
|
const {
|
||||||
TERM_PROGRAM,
|
TERM_PROGRAM,
|
||||||
npm_config_loglevel: NPM_CONFIG_LOGLEVEL
|
npm_config_loglevel: NPM_CONFIG_LOGLEVEL,
|
||||||
|
OPEN_SOURCE_CONTRIBUTOR
|
||||||
} = process.env
|
} = process.env
|
||||||
|
|
||||||
// Is Hyper (Mac)?
|
// Is Hyper (Mac)?
|
||||||
|
@ -25,9 +26,14 @@ const isCI = () => ciInfo.isCI
|
||||||
// Is silent mode enabled?
|
// Is silent mode enabled?
|
||||||
const isSilentMode = () => (
|
const isSilentMode = () => (
|
||||||
['silent', 'error'].includes(NPM_CONFIG_LOGLEVEL) ||
|
['silent', 'error'].includes(NPM_CONFIG_LOGLEVEL) ||
|
||||||
(NPM_CONFIG_LOGLEVEL === 'warn' && !process.version.startsWith('v6.'))
|
(NPM_CONFIG_LOGLEVEL === 'warn' && !process.version.startsWith('v6.')) ||
|
||||||
|
isEnabled(OPEN_SOURCE_CONTRIBUTOR)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
function isEnabled (value) {
|
||||||
|
return !!value && value !== '0' && value !== 'false'
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isHyper,
|
isHyper,
|
||||||
isITerm,
|
isITerm,
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"title": "Linode cloud computing",
|
"title": "npm install funding",
|
||||||
"text": "Deploy a server in seconds with your choice of Linux distro, resources, and host location. For a $20 credit, enter promo code STANDARDJS19 at sign up.",
|
"text": "I appreciate the thoughtful discussion and feedback from the community. I shared some thoughts about how this experiment went from my perspective.",
|
||||||
"url": "https://welcome.linode.com/standardjs"
|
"url": "https://feross.org/funding-experiment-recap/"
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "LogRocket",
|
|
||||||
"text": "Stop guessing why bugs happen. LogRocket lets you replay what users do on your web app or website, helping you reproduce bugs and fix issues faster.",
|
|
||||||
"url": "https://logrocket.com/term"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "funding",
|
"name": "funding",
|
||||||
"description": "Get open source maintainers paid",
|
"description": "Get open source maintainers paid",
|
||||||
"version": "1.0.6",
|
"version": "1.0.9",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Feross Aboukhadijeh",
|
"name": "Feross Aboukhadijeh",
|
||||||
"email": "feross@feross.org",
|
"email": "feross@feross.org",
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"standard": "*",
|
"standard": "*",
|
||||||
"tape": "^4.11.0"
|
"tape": "^5.0.0"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/feross/funding",
|
"homepage": "https://github.com/feross/funding",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "node bin/funding.js",
|
"postinstall": "node bin/funding.js",
|
||||||
"start": "node bin/funding.js",
|
"start": "node tools/clear.js && node bin/funding.js",
|
||||||
"test": "standard && tape test/*.js"
|
"test": "standard && npm start && tape test/*.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ test('`npm --loglevel error` prevents output', t => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('`npm --loglevel error` prevents output', t => {
|
test('deduplication / rate-limiting', t => {
|
||||||
t.plan(7)
|
t.plan(7)
|
||||||
|
|
||||||
clearShown()
|
clearShown()
|
||||||
|
@ -97,3 +97,19 @@ test('`npm --loglevel error` prevents output', t => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('OPEN_SOURCE_CONTRIBUTOR=true prevents output', t => {
|
||||||
|
t.plan(3)
|
||||||
|
|
||||||
|
const opts = {
|
||||||
|
env: Object.assign({}, process.env, {
|
||||||
|
OPEN_SOURCE_CONTRIBUTOR: 'true'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
cp.execFile(FUNDING_BIN_PATH, [], opts, (err, stdout, stderr) => {
|
||||||
|
t.error(err)
|
||||||
|
t.equal(stdout.length, 0, 'no stdout ouput')
|
||||||
|
t.equal(stderr.length, 0, 'no stderr output')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const { clearShown } = require('../lib/limit')
|
||||||
|
|
||||||
|
clearShown()
|
Loading…
Reference in New Issue