Skip to content

Commit aed4a80

Browse files
tmorehouseTheAlexLichter
authored andcommitted
feat: add opt out compatibility with opencollective-postinstall (closes #7) (#8)
1 parent 24eaec1 commit aed4a80

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ production or running a CI pipeline. That's why the message is
9393
- `CI`
9494
- `CONTINUOUS_INTEGRATION`
9595
- `NODE_ENV` (set and **not** `dev` or `development`)
96+
- `DISABLE_OPENCOLLECTIVE` (set to any string value that is not `'false'` or `'0'`,
97+
for compatability with
98+
[opencollective-postinatall](https://github.com/opencollective/opencollective-postinstall))
9699

97100
## Development
98101

src/utils/misc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ export const hideMessage = (env = process.env) => {
2727
return true
2828
}
2929

30+
// Compatability with opencollective-postinstall
31+
if (
32+
!!env.DISABLE_OPENCOLLECTIVE &&
33+
env.DISABLE_OPENCOLLECTIVE !== '0' &&
34+
env.DISABLE_OPENCOLLECTIVE !== 'false'
35+
) {
36+
return true
37+
}
38+
3039
// Don't show if on CI
3140
if (env.CI || env.CONTINUOUS_INTEGRATION) {
3241
return true

test/utils/misc/hideEnv.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ test(tHideMessage, { CONTINUOUS_INTEGRATION: true }, true)
2525
test(tHideMessage, { NODE_ENV: 'production' }, true)
2626
test(tHideMessage, { NODE_ENV: 'dev' }, false)
2727
test(tHideMessage, { NODE_ENV: 'development' }, false)
28+
// `opencollective-postinstall` compatability
29+
test(tHideMessage, { DISABLE_OPENCOLLECTIVE: 'true' }, true)
30+
test(tHideMessage, { DISABLE_OPENCOLLECTIVE: 'false' }, false)
31+
test(tHideMessage, { DISABLE_OPENCOLLECTIVE: '0' }, false)
32+
test(tHideMessage, { DISABLE_OPENCOLLECTIVE: '1' }, true)
33+
test(tHideMessage, { DISABLE_OPENCOLLECTIVE: '' }, false)

0 commit comments

Comments
 (0)