terminfo.dev 1.6.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/detect.ts +20 -10
- package/src/index.ts +10 -18
- package/src/probes/index.ts +894 -110
- package/src/submit.ts +27 -16
- package/src/tty.ts +4 -1
package/src/submit.ts
CHANGED
|
@@ -84,19 +84,19 @@ ${JSON.stringify(data, null, 2)}
|
|
|
84
84
|
const bodyFile = join(tmpdir(), `terminfo-submit-${Date.now()}.md`)
|
|
85
85
|
try {
|
|
86
86
|
writeFileSync(bodyFile, body)
|
|
87
|
-
const result = execFileSync("gh", [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"--body-file", bodyFile,
|
|
92
|
-
], { encoding: "utf-8", timeout: 30000 })
|
|
87
|
+
const result = execFileSync("gh", ["issue", "create", "--repo", REPO, "--title", title, "--body-file", bodyFile], {
|
|
88
|
+
encoding: "utf-8",
|
|
89
|
+
timeout: 30000,
|
|
90
|
+
})
|
|
93
91
|
return result.trim()
|
|
94
92
|
} catch (err) {
|
|
95
93
|
console.error(` \x1b[31mFailed to create issue\x1b[0m`)
|
|
96
94
|
console.error(` ${err instanceof Error ? err.message : String(err)}`)
|
|
97
95
|
return null
|
|
98
96
|
} finally {
|
|
99
|
-
try {
|
|
97
|
+
try {
|
|
98
|
+
unlinkSync(bodyFile)
|
|
99
|
+
} catch {}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -112,15 +112,26 @@ function hasGhCli(): boolean {
|
|
|
112
112
|
function checkDuplicate(terminal: string, version: string, os: string): string | null {
|
|
113
113
|
try {
|
|
114
114
|
const search = `[census] ${terminal}${version ? ` ${version}` : ""} on ${os}`
|
|
115
|
-
const result = execFileSync(
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
115
|
+
const result = execFileSync(
|
|
116
|
+
"gh",
|
|
117
|
+
[
|
|
118
|
+
"issue",
|
|
119
|
+
"list",
|
|
120
|
+
"--repo",
|
|
121
|
+
REPO,
|
|
122
|
+
"--search",
|
|
123
|
+
search,
|
|
124
|
+
"--state",
|
|
125
|
+
"all",
|
|
126
|
+
"--limit",
|
|
127
|
+
"1",
|
|
128
|
+
"--json",
|
|
129
|
+
"url,title",
|
|
130
|
+
"--jq",
|
|
131
|
+
'.[0] | .title + " " + .url',
|
|
132
|
+
],
|
|
133
|
+
{ encoding: "utf-8", timeout: 10000 },
|
|
134
|
+
)
|
|
124
135
|
return result.trim() || null
|
|
125
136
|
} catch {
|
|
126
137
|
return null
|
package/src/tty.ts
CHANGED
|
@@ -95,7 +95,10 @@ export async function queryMode(modeNumber: number): Promise<"set" | "reset" | "
|
|
|
95
95
|
*/
|
|
96
96
|
export async function drainStdin(ms = 300): Promise<void> {
|
|
97
97
|
return new Promise((resolve) => {
|
|
98
|
-
if (!process.stdin.readable) {
|
|
98
|
+
if (!process.stdin.readable) {
|
|
99
|
+
resolve()
|
|
100
|
+
return
|
|
101
|
+
}
|
|
99
102
|
process.stdin.resume()
|
|
100
103
|
let timer = setTimeout(done, ms)
|
|
101
104
|
function onData() {
|