mirror of
https://github.com/SrIzan10/nodemon.git
synced 2026-05-01 10:55:09 +00:00
fix: show request for help once a week/install
This commit is contained in:
20
bin/postinstall.js
Normal file
20
bin/postinstall.js
Normal file
@@ -0,0 +1,20 @@
|
||||
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 (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) {
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
|
||||
"prepush": "npm run lint",
|
||||
"killall": "ps auxww | grep node | grep -v grep | awk '{ print $2 }' | xargs kill -9",
|
||||
"postinstall": "node -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')\" || exit 0"
|
||||
"postinstall": "node bin/postinstall || exit 0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^3.1.3",
|
||||
|
||||
Reference in New Issue
Block a user