kup-cli 0.1.0-beta.3 → 0.1.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/lib/repo.js +1 -1
- package/lib/sync.js +2 -2
- package/lib/token.js +7 -4
- package/package.json +8 -7
package/lib/repo.js
CHANGED
package/lib/sync.js
CHANGED
|
@@ -38,7 +38,7 @@ async function updateIssue(fileInfo, repo, id) {
|
|
|
38
38
|
try {
|
|
39
39
|
response = await ghGot(api, {
|
|
40
40
|
method,
|
|
41
|
-
|
|
41
|
+
json: data,
|
|
42
42
|
token: process.env.GITHUB_TOKEN,
|
|
43
43
|
...proxyOptionsForGot,
|
|
44
44
|
})
|
|
@@ -84,7 +84,7 @@ async function postIssue(fileInfo, repo) {
|
|
|
84
84
|
try {
|
|
85
85
|
response = await ghGot(api, {
|
|
86
86
|
method,
|
|
87
|
-
|
|
87
|
+
json: data,
|
|
88
88
|
token: process.env.GITHUB_TOKEN,
|
|
89
89
|
...proxyOptionsForGot,
|
|
90
90
|
})
|
package/lib/token.js
CHANGED
|
@@ -9,7 +9,7 @@ async function getToken() {
|
|
|
9
9
|
process.env.GITHUB_TOKEN = token
|
|
10
10
|
} else if (!_validateToken(token)) {
|
|
11
11
|
console.error('[Kup] [Error] The GitHub token you provide is invalid!')
|
|
12
|
-
console.error('[Kup] [Error]
|
|
12
|
+
console.error('[Kup] [Error] It must be a classic (ghp_...) or fine-grained (github_pat_...) PAT.')
|
|
13
13
|
process.exit(1)
|
|
14
14
|
}
|
|
15
15
|
return token
|
|
@@ -29,15 +29,18 @@ async function _askToken() {
|
|
|
29
29
|
process.exit(1)
|
|
30
30
|
} else if (!_validateToken(token)) {
|
|
31
31
|
console.error('[Kup] [Error] The GitHub token you provide is invalid!')
|
|
32
|
-
console.error('[Kup] [Error]
|
|
32
|
+
console.error('[Kup] [Error] It must be a classic (ghp_...) or fine-grained (github_pat_...) PAT.')
|
|
33
33
|
process.exit(1)
|
|
34
34
|
}
|
|
35
35
|
return token
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function _validateToken(token) {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
if (typeof token !== 'string' || token.length < 20) return false
|
|
40
|
+
// classic PAT:ghp_...
|
|
41
|
+
// fine-grained PAT:github_pat_...
|
|
42
|
+
const RE = /^(ghp_[A-Za-z0-9_]+|github_pat_[A-Za-z0-9_]+)$/
|
|
43
|
+
return RE.test(token.trim())
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kup-cli",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "A CLI tool to sync local Markdown files to GitHub issues.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -27,20 +27,21 @@
|
|
|
27
27
|
"node": ">=18"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"find-up": "^
|
|
31
|
-
"gh-got": "^
|
|
32
|
-
"inquirer": "^
|
|
33
|
-
"yaml": "^2.
|
|
34
|
-
"yargs": "^
|
|
30
|
+
"find-up": "^8.0.0",
|
|
31
|
+
"gh-got": "^12.0.0",
|
|
32
|
+
"inquirer": "^13.4.1",
|
|
33
|
+
"yaml": "^2.8.3",
|
|
34
|
+
"yargs": "^18.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"https-proxy-agent": "^
|
|
37
|
+
"https-proxy-agent": "^9.0.0"
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
40
|
"*.js",
|
|
41
41
|
"lib/",
|
|
42
42
|
"bin/"
|
|
43
43
|
],
|
|
44
|
+
"packageManager": "pnpm@10.33.0",
|
|
44
45
|
"publishConfig": {
|
|
45
46
|
"registry": "https://registry.npmjs.org/"
|
|
46
47
|
}
|