-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support env.SUPPRESS_SUPPORT (#1334)
Show request for help once a week/install and support process.env.SUPPRESS_SUPPORT to hide entirely.
- Loading branch information
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env node | ||
|
||
function main() { | ||
if (process.env.SUPPRESS_SUPPORT) { | ||
return; | ||
} | ||
|
||
try { | ||
const Configstore = require('configstore'); | ||
const pkg = require(__dirname + '/../package.json'); | ||
const now = Date.now(); | ||
|
||
var week = 1000 * 60 * 60 * 24 * 7; | ||
|
||
// create a Configstore instance with an unique ID e.g. | ||
// Package name and optionally some default values | ||
const conf = new Configstore(pkg.name); | ||
const last = conf.get('lastCheck'); | ||
|
||
if (!last || now - week > last) { | ||
console.log('\u001b[32mLove nodemon? You can now support the project via the open collective:\u001b[22m\u001b[39m\n > \u001b[96m\u001b[1mhttps://opencollective.com/nodemon/donate\u001b[0m\n'); | ||
conf.set('lastCheck', now); | ||
} | ||
} catch (e) { | ||
console.log('\u001b[32mLove nodemon? You can now support the project via the open collective:\u001b[22m\u001b[39m\n > \u001b[96m\u001b[1mhttps://opencollective.com/nodemon/donate\u001b[0m\n'); | ||
} | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters