Skip to content

Commit

Permalink
Merge branch 'master' into repo-collection-final
Browse files Browse the repository at this point in the history
  • Loading branch information
tyn1998 authored and andyhuang18 committed Oct 15, 2023
2 parents ec3bd59 + 578ada3 commit 2de5852
Show file tree
Hide file tree
Showing 20 changed files with 1,240 additions and 495 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
4 changes: 1 addition & 3 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ We welcome users to install and try our Hypertrons Chrome Extension. If you have

### Chrome / Edge

1. Install our extension from [Chrome Web Store](https://chrome.google.com/webstore/detail/hypercrx/ijchfbpdgeljmhnhokmekkecpbdkgabc) or [Edge Extensions Home](https://microsoftedge.microsoft.com/addons/detail/hypercrx/lbbajaehiibofpconjgdjonmkidpcome?hl=zh-CN)
1. Install our extension from [Chrome Web Store](https://chrome.google.com/webstore/detail/hypercrx/ijchfbpdgeljmhnhokmekkecpbdkgabc) or [Edge Extensions Home](https://microsoftedge.microsoft.com/addons/detail/hypercrx/lbbajaehiibofpconjgdjonmkidpcome?hl=zh-CN)

[Chrome] Visit [Chrome Web Store](https://chrome.google.com/webstore/detail/hypercrx/ijchfbpdgeljmhnhokmekkecpbdkgabc),and click **[Add to Chrome]**.

Expand Down Expand Up @@ -46,7 +46,6 @@ We welcome users to install and try our Hypertrons Chrome Extension. If you have
</tbody>
</table>


3. You can change configuration of hypertrons-crx by visiting the setting page:

<table>
Expand Down Expand Up @@ -74,7 +73,6 @@ We welcome users to install and try our Hypertrons Chrome Extension. If you have
</tbody>
</table>


## Install from released package

The latest release can be found on this page https://github.com/hypertrons/hypertrons-crx/releases , where `hypertrons.crx` and `hypertrons.zip` are available under `Assets`. Currently, the extension can be installed to multiple browsers that use the chromium kernel. Some common ones are listed as follows:
Expand Down
6 changes: 1 addition & 5 deletions INSTALLATION.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Hypertrons-crx 现已登陆 [Chrome 网上应用商店](https://chrome.google.co

### Chrome 浏览器 / Edge 浏览器

1. 安装Hypertrons-crx插件
1. 安装 Hypertrons-crx 插件

[Chrome]点击 [此链接](https://chrome.google.com/webstore/detail/hypercrx/ijchfbpdgeljmhnhokmekkecpbdkgabc) 访问 “Hypercrx” 扩展程序主页,点击 “添加至 Chrome” ,并确认。

Expand Down Expand Up @@ -50,9 +50,6 @@ Hypertrons-crx 现已登陆 [Chrome 网上应用商店](https://chrome.google.co
</tbody>
</table>




3. 如需对插件进行设置,请点击以下按钮,可以进入到插件设置页面。在设置页面,您可以更改相关配置。

<table>
Expand Down Expand Up @@ -80,7 +77,6 @@ Hypertrons-crx 现已登陆 [Chrome 网上应用商店](https://chrome.google.co
</tbody>
</table>


## 手动下载安装包

您可以在[这里](https://github.com/hypertrons/hypertrons-crx/releases)下载最新的安装包。 当前版本支持 Chromium 内核浏览器,如:
Expand Down
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ You can find these dashboards in:
</tbody>
</table>


### Project Related

<table>
Expand Down Expand Up @@ -93,8 +92,7 @@ You can find these dashboards in:
</td>
</tr>
</tbody>
</table>

</table>

- **Project Correlation Network**: Project Correlation Network shows the correlation between projects for a given time period. From this graph you can find the projects that are related to the given project.

Expand All @@ -104,7 +102,6 @@ You can find these dashboards in:

- **Repo Details**: Trends of Activity, OpenRank, Participants, Fork Events, Star Events, Open Issue Events, Issue Comment Events, Open PR Events, PR Merge Events, Review Comment Events, Merged Addition & Deletion Code Lines.


### Developer Related

<table>
Expand Down Expand Up @@ -133,9 +130,7 @@ You can find these dashboards in:
/> </td>
</tr>
</tbody>
</table>


</table>

- **Developer Collaboration Network**: Developer Collaboration Network shows the collaboration between developers for a given time period. From this graph you can find other developers who are closest to a given developer.
- **Developer's Most Participated Repos**: Developer's Most Participated Repos shows the active projects of developers in a given time period. From this graph you can find out the most active repositories for a given developer.
Expand All @@ -151,9 +146,10 @@ OSS-GPT is an open source project document answering robot integrated with [Docs
## Contributing

Please read [CONTRIBUTING](./CONTRIBUTING.md) if you are new here or not familiar with the basic rules of Git/GitHub world.

### Requirements

1. node >= 16.14
1. node >= 18

2. yarn

Expand Down
26 changes: 12 additions & 14 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ Language : [English](./README.md) | 中文

## 安装与使用 📢

<img src="https://raw.githubusercontent.com/alrra/browser-logos/90fdf03c/src/chrome/chrome.svg" width="48" alt="Chrome" valign="middle"> [前往Chrome商店安装插件](https://chrome.google.com/webstore/detail/hypercrx/ijchfbpdgeljmhnhokmekkecpbdkgabc)
<img src="https://raw.githubusercontent.com/alrra/browser-logos/90fdf03c/src/chrome/chrome.svg" width="48" alt="Chrome" valign="middle"> [前往 Chrome 商店安装插件](https://chrome.google.com/webstore/detail/hypercrx/ijchfbpdgeljmhnhokmekkecpbdkgabc)

<img src="https://raw.githubusercontent.com/alrra/browser-logos/90fdf03c/src/edge/edge.svg" width="48" alt="Edge" valign="middle"> [前往Edge商店安装插件](https://microsoftedge.microsoft.com/addons/detail/hypercrx/lbbajaehiibofpconjgdjonmkidpcome)
<img src="https://raw.githubusercontent.com/alrra/browser-logos/90fdf03c/src/edge/edge.svg" width="48" alt="Edge" valign="middle"> [前往 Edge 商店安装插件](https://microsoftedge.microsoft.com/addons/detail/hypercrx/lbbajaehiibofpconjgdjonmkidpcome)

获取更多信息,请查阅[安装指南](./INSTALLATION.zh-CN.md)

## 数据来源

`Hypercrx`呈现的所有数据都由[OpenDigger](https://github.com/X-lab2017/open-digger)产生。OpenDigger是一个聚焦于开源分析的开源项目。数据会在每个月第二天更新。
`Hypercrx`呈现的所有数据都由[OpenDigger](https://github.com/X-lab2017/open-digger)产生。OpenDigger 是一个聚焦于开源分析的开源项目。数据会在每个月第二天更新。

## 可视化看板 🔥🔥🔥

Expand Down Expand Up @@ -94,16 +94,15 @@ Language : [English](./README.md) | 中文
</td>
</tr>
</tbody>
</table>

</table>

- **项目关系网络图**: 项目关系网络图展示了在给定的时间段内,项目与项目之间的联结关系,**_用于项目间关系的追踪与挖掘_**。从该网络图中,可以找出与该项目有联结关系的其他项目。

- **项目活跃开发者协作网络图**: 项目活跃开发者协作网络图展示了在给定的时间段内,项目内部活跃的开发者之间的协作关系,**_用于项目内部开发者关系的追踪与挖掘_**。从该网络图中,可以找出该项目中最活跃的开发者,及开发者之间的协作关系。

- **项目活跃度&OpenRank趋势图**项目活跃度和OpenRank趋势图显示了项目成立至今的活跃度和OpenRank这两个指标的变化。您可以利用鼠标或触控板在图表内缩放和拖拽,此外,您还可以点击Legend按钮来控制图例的显示和隐藏
- **项目活跃度&OpenRank 趋势图**项目活跃度和 OpenRank 趋势图显示了项目成立至今的活跃度和 OpenRank 这两个指标的变化。您可以利用鼠标或触控板在图表内缩放和拖拽,此外,您还可以点击 Legend 按钮来控制图例的显示和隐藏

- **仓库详情**: 显示了以下统计指标的历史值。活跃度、OpenRank、参与人数、Fork事件、Star事件、Issue创建事件、Issue评论事件、PR创建事件、PR合入事件、Review评论事件、通过PR合入增加和删除的代码行数
- **仓库详情**: 显示了以下统计指标的历史值。活跃度、OpenRank、参与人数、Fork 事件、Star 事件、Issue 创建事件、Issue 评论事件、PR 创建事件、PR 合入事件、Review 评论事件、通过 PR 合入增加和删除的代码行数

### 开发者关系挖掘

Expand Down Expand Up @@ -133,17 +132,15 @@ Language : [English](./README.md) | 中文
/> </td>
</tr>
</tbody>
</table>

</table>


- **开发者协作网络图**: 开发者协作网络图展示了在给定的时间段内,开发者与开发者之间的协作关系, ***用于开发者关系的追踪与挖掘***。从该网络图中,可以找出与指定开发者联系较为紧密的其他开发者。
- **活跃仓库网络图**: 活跃仓库网络图展示了在给定的时间段内,开发者的活跃项目,***用于开发者行为的追踪与挖掘***。从该网络图中,可以找出该开发者在哪些项目中活跃。
- **开发者活跃度&OpenRank趋势图**:开发者活跃度和OpenRank趋势图显示了项目成立至今的活跃度和OpenRank这两个指标的变化。您可以利用鼠标或触控板在图表内缩放和拖拽,此外,您还可以点击Legend按钮来控制图例的显示和隐藏。
- **开发者协作网络图**: 开发者协作网络图展示了在给定的时间段内,开发者与开发者之间的协作关系, **_用于开发者关系的追踪与挖掘_**。从该网络图中,可以找出与指定开发者联系较为紧密的其他开发者。
- **活跃仓库网络图**: 活跃仓库网络图展示了在给定的时间段内,开发者的活跃项目,**_用于开发者行为的追踪与挖掘_**。从该网络图中,可以找出该开发者在哪些项目中活跃。
- **开发者活跃度&OpenRank 趋势图**:开发者活跃度和 OpenRank 趋势图显示了项目成立至今的活跃度和 OpenRank 这两个指标的变化。您可以利用鼠标或触控板在图表内缩放和拖拽,此外,您还可以点击 Legend 按钮来控制图例的显示和隐藏。

## OSS-GPT

OSS-GPT是集成了[DocsGPT](https://github.com/arc53/docsgpt)能力的开源项目文档问答机器人。对已经支持的项目,只需打开对应的项目仓库主页,即可询问有关于该仓库的任何问题。你可以通过[issue#609](https://github.com/hypertrons/hypertrons-crx/issues/609)以使你的开源项目获得OSS-GPT的支持
OSS-GPT 是集成了[DocsGPT](https://github.com/arc53/docsgpt)能力的开源项目文档问答机器人。对已经支持的项目,只需打开对应的项目仓库主页,即可询问有关于该仓库的任何问题。你可以通过[issue#609](https://github.com/hypertrons/hypertrons-crx/issues/609)以使你的开源项目获得 OSS-GPT 的支持

<img
src="https://user-images.githubusercontent.com/104072573/228415232-cc81eab2-5566-4775-bf27-c385881deb20.png"
Expand All @@ -158,6 +155,7 @@ OSS-GPT是集成了[DocsGPT](https://github.com/arc53/docsgpt)能力的开源项
1. node >= 16.14

2. yarn

### 快速开始

1. git clone https://github.com/hypertrons/hypertrons-crx
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hypercrx",
"version": "1.9.0",
"version": "1.9.2",
"type": "module",
"private": true,
"description": "Hypertrons Chromium Extension",
Expand All @@ -19,13 +19,15 @@
"update-version": "node scripts/bump-version.cjs"
},
"dependencies": {
"@ant-design/icons": "^5.2.6",
"@fluentui/react": "^8.62.0",
"@fluentui/react-hooks": "^8.3.13",
"@hot-loader/react-dom": "^17.0.2",
"@types/chrome": "^0.0.203",
"@uifabric/icons": "^7.6.2",
"antd": "^5.8.4",
"antd": "^5.9.1",
"buffer": "^6.0.3",
"colorthief": "^2.4.0",
"delay": "^5.0.0",
"dom-loaded": "^3.0.0",
"echarts": "^5.3.0",
Expand Down
6 changes: 3 additions & 3 deletions publish/update_information.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"chrome": {
"latest_version": "1.9.0",
"latest_version": "1.9.2",
"url": "https://chrome.google.com/webstore/detail/hypercrx/ijchfbpdgeljmhnhokmekkecpbdkgabc"
},
"edge": {
"latest_version": "1.9.0",
"latest_version": "1.9.2",
"url": "https://microsoftedge.microsoft.com/addons/detail/hypercrx/lbbajaehiibofpconjgdjonmkidpcome"
},
"develop": {
"latest_version": "1.9.0",
"latest_version": "1.9.2",
"url": "https://github.com/hypertrons/hypertrons-crx/releases"
}
}
27 changes: 18 additions & 9 deletions scripts/bump-version.cjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// according to https://github.com/TriPSs/conventional-changelog-action#pre-commit-hook
// this script should be a CommonJS module

const semver = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/i
const semver =
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/i;

function validate({version}) {
function validate({ version }) {
// validate if the given version conforms semver
return String(version).match(semver) === null;
}

function compare({oldVersion, newVersion}) {
function compare({ oldVersion, newVersion }) {
// compare oldVersion and newVersion number
// return -1 if oldVersion is greater;
// 0 if two versions are equal;
Expand All @@ -32,8 +33,10 @@ async function bump({ version, deploy }) {
// update package.json
const pkgPath = 'package.json';
const pkg = await readJson(pkgPath);
if (compare({oldVersion: pkg.version, newVersion: version}) <= 0) {
throw new Error('Input version number is not greater than the current version number!');
if (compare({ oldVersion: pkg.version, newVersion: version }) <= 0) {
throw new Error(
'Input version number is not greater than the current version number!'
);
}
pkg.version = version;
writeJson(pkgPath, pkg);
Expand All @@ -46,8 +49,15 @@ async function bump({ version, deploy }) {
update_info.chrome.latest_version = version;
update_info.edge.latest_version = version;
}
if (compare({oldVersion: update_info.develop.latest_version, newVersion: version}) <= 0) {
throw new Error('Input version number is not greater than the current version number!');
if (
compare({
oldVersion: update_info.develop.latest_version,
newVersion: version,
}) <= 0
) {
throw new Error(
'Input version number is not greater than the current version number!'
);
}
update_info.develop.latest_version = version;
writeJson(infoPath, update_info);
Expand All @@ -58,7 +68,7 @@ module.exports = { bump };
try {
const [nodePath, scriptPath, versionNumber, ...otherArgs] = process.argv;
if (versionNumber !== undefined) {
if (validate({version: versionNumber})) {
if (validate({ version: versionNumber })) {
// version number is not valid
throw new Error('Input version number is valid');
}
Expand All @@ -69,4 +79,3 @@ try {
return -1;
}
return 0;

3 changes: 0 additions & 3 deletions src/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@
"component_projectCorrelationNetwork_title": {
"message": "Project Correlation Network"
},
"component_projectRacingBar_ReplayButton": {
"message": "Replay"
},
"component_projectRacingBar_description": {
"message": "This chart shows how the activity values of contributors in this repository evolve."
},
Expand Down
3 changes: 0 additions & 3 deletions src/locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@
"component_projectCorrelationNetwork_title": {
"message": "项目关系网络图"
},
"component_projectRacingBar_ReplayButton": {
"message": "重播"
},
"component_projectRacingBar_description": {
"message": "贡献者活跃度滚榜展示了项目贡献者的活跃度演化过程。"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// @ts-ignore - TS7016: Could not find a declaration file for module 'colorthief'.
import ColorThief from 'colorthief';

type LoginId = string;
type Color = string;
type RGB = [number, number, number];
interface ColorCache {
colors: Color[];
lastUpdated: number; // timestamp
}

/** The number determines how many colors are extracted from the image */
const COLOR_COUNT = 2;
/** The number determines how many pixels are skipped before the next one is sampled. */
const COLOR_QUALITY = 1;
/** The number determines how long the cache is valid. */
const CACHE_EXPIRE_TIME = 1000 * 60 * 60 * 24 * 7;

/**
* A singleton class that stores the avatar colors of users.
*/
class AvatarColorStore {
private static instance: AvatarColorStore;
private colorThief = new ColorThief();

private loadAvatar(loginId: string): Promise<HTMLImageElement> {
return new Promise((resolve, reject) => {
const img = new Image();
img.crossOrigin = 'anonymous';
img.onload = () => resolve(img);
img.onerror = reject;
img.src = `https://avatars.githubusercontent.com/${loginId}?s=8&v=4`;
});
}

public async getColors(loginId: LoginId): Promise<Color[]> {
// Create a unique key for this user's cache entry.
const cacheKey = `color-cache:${loginId}`;

const now = new Date().getTime();
const colorCache: ColorCache = (await chrome.storage.local.get(cacheKey))[
cacheKey
];

// Check if the cache is stale or doesn't exist.
if (!colorCache || now - colorCache.lastUpdated > CACHE_EXPIRE_TIME) {
let colors: Color[];
// a single white color causes error: https://github.com/lokesh/color-thief/issues/40#issuecomment-802424484
try {
colors = await this.loadAvatar(loginId)
.then((img) =>
this.colorThief.getPalette(img, COLOR_COUNT, COLOR_QUALITY)
)
.then((rgbs) => {
return rgbs.map(
(rgb: RGB) => `rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`
);
});
// Store the updated cache entry with the unique key.
await chrome.storage.local.set({
[cacheKey]: {
colors,
lastUpdated: now,
},
});
} catch (error) {
console.error(
`Cannot extract colors of the avatar of ${loginId}, error info: `,
error
);
colors = Array(COLOR_COUNT).fill('rgb(255, 255, 255)');
}

return colors;
}

// Return the cached colors.
return colorCache.colors;
}

public static getInstance(): AvatarColorStore {
if (!AvatarColorStore.instance) {
AvatarColorStore.instance = new AvatarColorStore();
}
return AvatarColorStore.instance;
}
}

export const avatarColorStore = AvatarColorStore.getInstance();
Loading

0 comments on commit 2de5852

Please sign in to comment.