@workskills/getskill 1.1.2 → 1.1.4
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/index.js +8 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -362,7 +362,7 @@ async function searchSkills(keyword, options = {}) {
|
|
|
362
362
|
limit = 20
|
|
363
363
|
} = options;
|
|
364
364
|
|
|
365
|
-
const url = `${BASE_URL}/
|
|
365
|
+
const url = `${BASE_URL}/api/v1/repos/search?q=${encodeURIComponent(keyword)}&sort=${sort}&order=${order}&page=${page}&limit=${limit}`;
|
|
366
366
|
|
|
367
367
|
try {
|
|
368
368
|
const response = await request(url, { timeout: 15000 });
|
|
@@ -408,15 +408,15 @@ async function searchSkills(keyword, options = {}) {
|
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
// 提取需要的字段
|
|
411
|
+
// 新 API 数据直接在根层级,不再嵌套在 repository 中
|
|
411
412
|
return result.data.map(item => {
|
|
412
|
-
const repo = item.repository || {};
|
|
413
413
|
return {
|
|
414
|
-
name:
|
|
415
|
-
full_name:
|
|
416
|
-
description:
|
|
417
|
-
html_url:
|
|
418
|
-
git_url:
|
|
419
|
-
clone_url:
|
|
414
|
+
name: item.full_name || item.name || '',
|
|
415
|
+
full_name: item.full_name || '',
|
|
416
|
+
description: item.description || '',
|
|
417
|
+
html_url: item.html_url || '',
|
|
418
|
+
git_url: item.clone_url || (item.html_url ? `${item.html_url}.git` : ''),
|
|
419
|
+
clone_url: item.clone_url || ''
|
|
420
420
|
};
|
|
421
421
|
}).filter(item => item.full_name); // 过滤掉没有 full_name 的项
|
|
422
422
|
|