1 | "use strict";
|
2 |
|
3 |
|
4 | function printSupportMessage() {
|
5 | console.log("\u001b[32mLove TypeGraphQL or use it at work? \nYou can now support the project via the Open Collective:\u001b[22m\u001b[39m\n > \u001b[96m\u001b[1mhttps://opencollective.com/typegraphql\u001b[0m\n");
|
6 | }
|
7 | if (!process.env.SUPPRESS_SUPPORT) {
|
8 | try {
|
9 | const Configstore = require("configstore");
|
10 | const pkg = require("../package.json");
|
11 | const now = Date.now();
|
12 | const week = 1000 * 60 * 60 * 24 * 7;
|
13 | const conf = new Configstore(pkg.name);
|
14 | const last = conf.get("lastCheck");
|
15 | if (!last || now - week > last) {
|
16 | printSupportMessage();
|
17 | conf.set("lastCheck", now);
|
18 | }
|
19 | }
|
20 | catch (e) {
|
21 | printSupportMessage();
|
22 | }
|
23 | }
|