Skip to content

Commit 1d2a9b9

Browse files
committed
Remove sponsor logging
1 parent 6f786ce commit 1d2a9b9

File tree

1 file changed

+47
-51
lines changed

1 file changed

+47
-51
lines changed

src/utils/logSponsor.js

Lines changed: 47 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,65 @@
11
/* eslint-disable no-use-before-define */
22
/* eslint-disable no-console */
3-
import process from "node:process"
3+
// import process from "node:process"
44

5-
import boxen from "boxen"
6-
import { gray, dodgerblue } from "../config/colors.js"
5+
// const boxenOptions = {
6+
// borderColor: "blue",
7+
// margin: 1,
8+
// padding: 1,
9+
// }
710

8-
const boxenOptions = {
9-
borderColor: "blue",
10-
margin: 1,
11-
padding: 1,
12-
}
13-
14-
// Promotion starts on August 22, 2024
15-
const startAt = new Date("2024-08-22T00:00:00.000Z")
16-
// By October 22, 2024, the promotion will be displayed to 100% of users
17-
const endAt = new Date("2024-10-22T00:00:00.000Z")
18-
const nDays = diffDays(startAt, endAt)
11+
// // Promotion starts on August 22, 2024
12+
// const startAt = new Date("2024-08-22T00:00:00.000Z")
13+
// // By October 22, 2024, the promotion will be displayed to 100% of users
14+
// const endAt = new Date("2024-10-22T00:00:00.000Z")
15+
// const nDays = diffDays(startAt, endAt)
1916

2017
function logSponsor() {
21-
if (!shouldDisplaySponsor()) {
22-
console.log()
23-
24-
return
25-
}
26-
27-
console.log(
28-
boxen(
29-
`Sponsored by ${dodgerblue("Arccode, the RPG for developers")}\nhttps://arccode.dev?ref=so\n${gray.dim(
30-
"Disable with --noSponsor",
31-
)}`,
32-
boxenOptions,
33-
),
34-
)
18+
// if (!shouldDisplaySponsor()) {
19+
// console.log()
20+
// return
21+
// }
22+
// console.log(
23+
// boxen(
24+
// `Sponsored by ${dodgerblue("Arccode, the RPG for developers")}\nhttps://arccode.dev?ref=so\n${gray.dim(
25+
// "Disable with --noSponsor",
26+
// )}`,
27+
// boxenOptions,
28+
// ),
29+
// )
3530
}
3631

3732
// Display the message progressively over time to 100% of users
38-
function shouldDisplaySponsor() {
39-
const ratio = diffDays(startAt, new Date()) / nDays
33+
// function shouldDisplaySponsor() {
34+
// const ratio = diffDays(startAt, new Date()) / nDays
4035

41-
if (ratio >= 1) return true
36+
// if (ratio >= 1) return true
4237

43-
try {
44-
const nonce = Number(
45-
encodeStringToNumber(process.cwd()).toString().padStart(2, "0").slice(-2),
46-
)
38+
// try {
39+
// const nonce = Number(
40+
// encodeStringToNumber(process.cwd()).toString().padStart(2, "0").slice(-2),
41+
// )
4742

48-
return nonce <= ratio * 100
49-
} catch {
50-
//
51-
}
43+
// return nonce <= ratio * 100
44+
// } catch {
45+
// //
46+
// }
5247

53-
return false
54-
}
48+
// return false
49+
// }
5550

56-
function encodeStringToNumber(string) {
57-
let sum = 0
51+
// function encodeStringToNumber(string) {
52+
// let sum = 0
5853

59-
for (let i = 0; i < string.length; i += 1) {
60-
sum += Number(string.codePointAt(i).toString(10))
61-
}
54+
// for (let i = 0; i < string.length; i += 1) {
55+
// sum += Number(string.codePointAt(i).toString(10))
56+
// }
6257

63-
return sum
64-
}
58+
// return sum
59+
// }
60+
61+
// function diffDays(a, b) {
62+
// return Math.round((b - a) / (1000 * 60 * 60 * 24))
63+
// }
6564

66-
function diffDays(a, b) {
67-
return Math.round((b - a) / (1000 * 60 * 60 * 24))
68-
}
6965
export default logSponsor

0 commit comments

Comments
 (0)