refactor: define the message in one place (#1847)

[skip ci]
This commit is contained in:
Utku Gultopu
2021-03-31 05:39:09 -04:00
committed by GitHub
parent aa03cd7659
commit 90f1cffa4e

View File

@@ -4,6 +4,8 @@ function main() {
if (process.env.SUPPRESS_SUPPORT || process.env.OPENCOLLECTIVE_HIDE || process.env.CI) {
return;
}
const message = '\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';
try {
const Configstore = require('configstore');
@@ -18,11 +20,11 @@ function main() {
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');
console.log(message);
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');
console.log(message);
}
}