From c27d31d7bfaa690bd57dc6427ad85de74ca8f12c Mon Sep 17 00:00:00 2001 From: wblx <904653630@qq.com> Date: Sun, 21 Jul 2024 15:20:12 +0800 Subject: [PATCH 1/9] feat:Added functionality to retrieve and save GitHub token (#812) Signed-off-by: wblx <904653630@qq.com> --- src/api/githubApi.ts | 35 +++++++++++ src/pages/Options/GitHubToken.tsx | 97 +++++++++++++++++++++++++++++++ src/pages/Options/Options.css | 57 ++++++++++++++++++ src/pages/Options/Options.tsx | 14 +++++ 4 files changed, 203 insertions(+) create mode 100644 src/api/githubApi.ts create mode 100644 src/pages/Options/GitHubToken.tsx diff --git a/src/api/githubApi.ts b/src/api/githubApi.ts new file mode 100644 index 00000000..46c33ec5 --- /dev/null +++ b/src/api/githubApi.ts @@ -0,0 +1,35 @@ +// src/api/githubApi.ts +let githubToken = ''; + +export const saveToken = (token: string) => { + githubToken = token; + localStorage.setItem('github_token', token); // 保存 token 到 localStorage +}; + +export const getToken = () => { + if (!githubToken) { + githubToken = localStorage.getItem('github_token') || ''; + } + return githubToken; +}; + +export const githubRequest = async (endpoint: string, options: RequestInit = {}) => { + const token = getToken(); + if (!token) { + throw new Error('GitHub Token 未设置'); + } + + const response = await fetch(`https://api.github.com${endpoint}`, { + ...options, + headers: { + ...options.headers, + Authorization: `Bearer ${token}`, + }, + }); + + if (!response.ok) { + throw new Error(`GitHub 请求失败: ${response.statusText}`); + } + + return response.json(); +}; \ No newline at end of file diff --git a/src/pages/Options/GitHubToken.tsx b/src/pages/Options/GitHubToken.tsx new file mode 100644 index 00000000..9a13fc3e --- /dev/null +++ b/src/pages/Options/GitHubToken.tsx @@ -0,0 +1,97 @@ +// src/pages/Options/GitHubToken.tsx +import React, { useState, useEffect } from 'react'; +import TooltipTrigger from '../../components/TooltipTrigger'; +import { saveToken, getToken, githubRequest } from '../../api/githubApi'; // 引入保存和获取 token 的方法 + +const GitHubToken = () => { + const [token, setToken] = useState(''); + const [isCollapsed, setIsCollapsed] = useState(true); + + useEffect(() => { + const storedToken = getToken(); + if (storedToken) { + setToken(storedToken); + } + }, []); + + const handleSave = () => { + if (!token) { + console.error('Token 不能为空'); + return; + } + + saveToken(token); // 保存 token + alert('Token 已保存'); // 提示用户 token 已保存 + }; + + const handleTestToken = async () => { + try { + const userData = await githubRequest('/user'); + alert(`Token 有效,用户名: ${userData.login}`); + } catch (error) { + console.error('Token 测试失败:', error); + alert('Token 无效或请求失败'); + } + }; + + return ( +
+
+

GitHub Token 配置

+ +
+

提供 GitHub Token 可以确保 HyperCRX 安全、有效地访问和操作用户的 GitHub 数据并进行个性化分析。

+
+
setIsCollapsed(!isCollapsed)} + style={{ cursor: 'pointer', display: 'flex', alignItems: 'center' }} + > +

{'如何生成 GitHub Token?'}

+ {isCollapsed ? '▶' : '▼'} +
+ {!isCollapsed && ( +
+
    +
  • + 1. 登录 GitHub 并进入 Settings。 +
  • +
  • + 2. 选择 Developer settings。 +
  • +
  • + 3. 选择 Personal access tokens,点击 Fine-grained tokens,再点击{' '} + Generate a personal access token。 +
  • +
  • + 4. 设置 token 细节: +
      +
    • + Note:描述性名称,如 "HyperCrx Token"。 +
    • +
    • + Expiration:选择有效期。 +
    • +
    • + Scopes:选择权限范围,如 repoworkflow。 +
    • +
    +
  • +
  • + 5. 点击 Generate token 按钮。 +
  • +
  • 6. 复制生成的 token 并粘贴到下面的输入框中。
  • +
+
+ )} +
+ setToken(e.target.value)} placeholder="GitHub Token" /> + + +
+ ); +}; + +export default GitHubToken; \ No newline at end of file diff --git a/src/pages/Options/Options.css b/src/pages/Options/Options.css index 63af1803..66034b23 100644 --- a/src/pages/Options/Options.css +++ b/src/pages/Options/Options.css @@ -1,3 +1,4 @@ +/* src/pages/Options/Options.css */ .container { width: 98vw; min-height: calc(100vh - 100px); @@ -56,3 +57,59 @@ li { a { color: blue; } + +.github-token-options { + width: 75vw; + min-width: 350px; + max-width: 600px; + background-color: white; + border: 1px solid #e1e4e8; + border-radius: 6px; + margin-top: 20px; +} + +.github-token-options .Box-header { + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + padding: 0 25px; + margin: -1px -1px 0; + background-color: #242a2e; + color: white; + border: 1px solid #e1e4e8; + border-top-left-radius: 6px; + border-top-right-radius: 6px; +} + +.github-token-options .Box-title { + font-size: 18px; + font-weight: 600; + margin-right: 8px; +} + +.github-token-options p { + padding: 0 25px; +} + +.github-token-options input { + width: calc(100% - 50px); + padding: 8px; + margin: 10px 25px; + border: 1px solid #ccc; + border-radius: 4px; +} + +.github-token-options button { + padding: 8px 16px; + margin: 0 25px 20px; + background-color: #007bff; + color: #fff; + border: none; + border-radius: 4px; + cursor: pointer; +} + +.github-token-options button:hover { + background-color: #0056b3; +} \ No newline at end of file diff --git a/src/pages/Options/Options.tsx b/src/pages/Options/Options.tsx index b42adcaf..06a1adbd 100644 --- a/src/pages/Options/Options.tsx +++ b/src/pages/Options/Options.tsx @@ -1,3 +1,4 @@ +// src/pages/Options/index.tsx import React, { useState, useEffect } from 'react'; import { Checkbox, Radio, Space, Row, Col } from 'antd'; import { importedFeatures } from '../../../README.md'; @@ -7,6 +8,8 @@ import TooltipTrigger from '../../components/TooltipTrigger'; import './Options.css'; import { useTranslation } from 'react-i18next'; import '../../helpers/i18n'; +import GitHubToken from './GitHubToken'; // 引入 GitHubToken 组件 + const stacksStyleOptions = { headerStack: { paddingBottom: '10px', @@ -146,6 +149,16 @@ const Options = (): JSX.Element => { + + {/* 添加 GitHubToken 组件 */} + @@ -153,3 +166,4 @@ const Options = (): JSX.Element => { }; export default Options; + From b4a25edebc3c21d1746edb560e5aea3eee222386 Mon Sep 17 00:00:00 2001 From: wblx <904653630@qq.com> Date: Mon, 29 Jul 2024 15:51:30 +0800 Subject: [PATCH 2/9] solved all the problems Signed-off-by: wblx <904653630@qq.com> --- src/{api => helpers}/githubApi.ts | 5 +- src/locales/en/translation.json | 26 ++++- src/locales/zh_CN/translation.json | 26 ++++- src/pages/Options/GitHubToken.tsx | 97 --------------- src/pages/Options/Options.css | 3 +- src/pages/Options/Options.tsx | 12 +- src/pages/Options/components/GitHubToken.tsx | 117 +++++++++++++++++++ 7 files changed, 177 insertions(+), 109 deletions(-) rename src/{api => helpers}/githubApi.ts (87%) delete mode 100644 src/pages/Options/GitHubToken.tsx create mode 100644 src/pages/Options/components/GitHubToken.tsx diff --git a/src/api/githubApi.ts b/src/helpers/githubApi.ts similarity index 87% rename from src/api/githubApi.ts rename to src/helpers/githubApi.ts index 46c33ec5..24abc342 100644 --- a/src/api/githubApi.ts +++ b/src/helpers/githubApi.ts @@ -1,9 +1,8 @@ -// src/api/githubApi.ts let githubToken = ''; export const saveToken = (token: string) => { githubToken = token; - localStorage.setItem('github_token', token); // 保存 token 到 localStorage + localStorage.setItem('github_token', token); }; export const getToken = () => { @@ -32,4 +31,4 @@ export const githubRequest = async (endpoint: string, options: RequestInit = {}) } return response.json(); -}; \ No newline at end of file +}; diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index cf9b6f6a..b84caa86 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -60,5 +60,29 @@ "activity_icon": "activity", "openrank_icon": "openrank", "contributors_participants_icon": "contributors and participants", - "merged_lines_icon": "code lines change" + "merged_lines_icon": "code lines change", + "github_token_configuration": "GitHub Token Configuration", + "github_token_tooltip": "Enter your GitHub Token here for authentication.", + "github_token_description": "Providing a GitHub Token ensures that HyperCRX can securely and effectively access and operate on your GitHub data for personalized analysis.", + "github_token_how_to_generate": "How to generate a GitHub Token?", + "github_token_step1": "1. Log in to GitHub and go to Settings.", + "github_token_step2": "2. Select Developer settings.", + "github_token_step3": "3. Choose Personal access tokens, click Tokens(classic), then Generate a personal access token.", + "github_token_step4": "4. Set token details:", + "github_token_note": "Note", + "github_token_note_description": "A descriptive name, e.g., \"HyperCrx Token\".", + "github_token_expiration": "Expiration", + "github_token_expiration_description": "Choose the validity period.", + "github_token_scopes": "Scopes", + "github_token_scopes_description": "Select permission scopes, such as repo and workflow.", + "github_token_step5": "5. Click the Generate token button.", + "github_token_step6": "6. Copy the generated token and paste it into the input box below.", + "github_token_placeholder": "GitHub Token", + "github_token_save": "Save", + "github_token_edit": "Edit", + "github_token_test": "Test Token", + "github_token_error_empty": "Token cannot be empty", + "github_token_success_save": "Token saved successfully", + "github_token_success_valid": "Token is valid. Username: {{username}}", + "github_token_error_invalid": "Invalid token or request failed" } diff --git a/src/locales/zh_CN/translation.json b/src/locales/zh_CN/translation.json index f4181599..a229fa26 100644 --- a/src/locales/zh_CN/translation.json +++ b/src/locales/zh_CN/translation.json @@ -59,5 +59,29 @@ "activity_icon": "activity数", "openrank_icon": "openrank值", "contributors_participants_icon": "contributors和participants数", - "merged_lines_icon": "代码变化量" + "merged_lines_icon": "代码变化量", + "github_token_configuration": "GitHub 令牌配置", + "github_token_tooltip": "在此输入您的 GitHub 令牌以进行身份验证。", + "github_token_description": "提供 GitHub 令牌可确保 HyperCRX 能够安全有效地访问和操作您的 GitHub 数据以进行个性化分析。", + "github_token_how_to_generate": "如何生成 GitHub 令牌?", + "github_token_step1": "1. 登录 GitHub 并进入设置。", + "github_token_step2": "2. 选择开发者设置。", + "github_token_step3": "3. 选择个人访问令牌,Tokens(classic),然后生成个人访问令牌。", + "github_token_step4": "4. 设置令牌详细信息:", + "github_token_note": "注意", + "github_token_note_description": "描述性名称,例如“HyperCrx Token", + "github_token_expiration": "过期时间", + "github_token_expiration_description": "选择有效期。", + "github_token_scopes": "权限范围", + "github_token_scopes_description": "选择权限范围,例如 repo 和 workflow。", + "github_token_step5": "5. 点击生成令牌按钮。", + "github_token_step6": "6. 复制生成的令牌并将其粘贴到下面的输入框中。", + "github_token_placeholder": "GitHub 令牌", + "github_token_save": "保存", + "github_token_edit": "编辑", + "github_token_test": "测试令牌", + "github_token_error_empty": "令牌不能为空", + "github_token_success_save": "令牌保存成功", + "github_token_success_valid": "令牌有效。用户名:{{username}}", + "github_token_error_invalid": "令牌无效或请求失败" } diff --git a/src/pages/Options/GitHubToken.tsx b/src/pages/Options/GitHubToken.tsx deleted file mode 100644 index 9a13fc3e..00000000 --- a/src/pages/Options/GitHubToken.tsx +++ /dev/null @@ -1,97 +0,0 @@ -// src/pages/Options/GitHubToken.tsx -import React, { useState, useEffect } from 'react'; -import TooltipTrigger from '../../components/TooltipTrigger'; -import { saveToken, getToken, githubRequest } from '../../api/githubApi'; // 引入保存和获取 token 的方法 - -const GitHubToken = () => { - const [token, setToken] = useState(''); - const [isCollapsed, setIsCollapsed] = useState(true); - - useEffect(() => { - const storedToken = getToken(); - if (storedToken) { - setToken(storedToken); - } - }, []); - - const handleSave = () => { - if (!token) { - console.error('Token 不能为空'); - return; - } - - saveToken(token); // 保存 token - alert('Token 已保存'); // 提示用户 token 已保存 - }; - - const handleTestToken = async () => { - try { - const userData = await githubRequest('/user'); - alert(`Token 有效,用户名: ${userData.login}`); - } catch (error) { - console.error('Token 测试失败:', error); - alert('Token 无效或请求失败'); - } - }; - - return ( -
-
-

GitHub Token 配置

- -
-

提供 GitHub Token 可以确保 HyperCRX 安全、有效地访问和操作用户的 GitHub 数据并进行个性化分析。

-
-
setIsCollapsed(!isCollapsed)} - style={{ cursor: 'pointer', display: 'flex', alignItems: 'center' }} - > -

{'如何生成 GitHub Token?'}

- {isCollapsed ? '▶' : '▼'} -
- {!isCollapsed && ( -
-
    -
  • - 1. 登录 GitHub 并进入 Settings。 -
  • -
  • - 2. 选择 Developer settings。 -
  • -
  • - 3. 选择 Personal access tokens,点击 Fine-grained tokens,再点击{' '} - Generate a personal access token。 -
  • -
  • - 4. 设置 token 细节: -
      -
    • - Note:描述性名称,如 "HyperCrx Token"。 -
    • -
    • - Expiration:选择有效期。 -
    • -
    • - Scopes:选择权限范围,如 repoworkflow。 -
    • -
    -
  • -
  • - 5. 点击 Generate token 按钮。 -
  • -
  • 6. 复制生成的 token 并粘贴到下面的输入框中。
  • -
-
- )} -
- setToken(e.target.value)} placeholder="GitHub Token" /> - - -
- ); -}; - -export default GitHubToken; \ No newline at end of file diff --git a/src/pages/Options/Options.css b/src/pages/Options/Options.css index 66034b23..890cee97 100644 --- a/src/pages/Options/Options.css +++ b/src/pages/Options/Options.css @@ -1,4 +1,3 @@ -/* src/pages/Options/Options.css */ .container { width: 98vw; min-height: calc(100vh - 100px); @@ -112,4 +111,4 @@ a { .github-token-options button:hover { background-color: #0056b3; -} \ No newline at end of file +} diff --git a/src/pages/Options/Options.tsx b/src/pages/Options/Options.tsx index 06a1adbd..e0027977 100644 --- a/src/pages/Options/Options.tsx +++ b/src/pages/Options/Options.tsx @@ -1,4 +1,3 @@ -// src/pages/Options/index.tsx import React, { useState, useEffect } from 'react'; import { Checkbox, Radio, Space, Row, Col } from 'antd'; import { importedFeatures } from '../../../README.md'; @@ -8,7 +7,7 @@ import TooltipTrigger from '../../components/TooltipTrigger'; import './Options.css'; import { useTranslation } from 'react-i18next'; import '../../helpers/i18n'; -import GitHubToken from './GitHubToken'; // 引入 GitHubToken 组件 +import GitHubToken from './components/GitHubToken'; const stacksStyleOptions = { headerStack: { @@ -20,6 +19,9 @@ const stacksStyleOptions = { settingStack: { margin: '10px 25px', }, + tokenStack: { + margin: '10px 25px', + }, }; const Options = (): JSX.Element => { @@ -70,7 +72,7 @@ const Options = (): JSX.Element => { { display: 'flex', justifyContent: 'center', alignItems: 'center', + margin: stacksStyleOptions.tokenStack.margin, }} > - {/* 添加 GitHubToken 组件 */} + {/* Add GitHubToken component */} @@ -166,4 +169,3 @@ const Options = (): JSX.Element => { }; export default Options; - diff --git a/src/pages/Options/components/GitHubToken.tsx b/src/pages/Options/components/GitHubToken.tsx new file mode 100644 index 00000000..e1ea089f --- /dev/null +++ b/src/pages/Options/components/GitHubToken.tsx @@ -0,0 +1,117 @@ +import React, { useState, useEffect } from 'react'; +import TooltipTrigger from '../../../components/TooltipTrigger'; +import { saveToken, getToken, githubRequest } from '../../../helpers/githubApi'; +import { message } from 'antd'; +import { useTranslation } from 'react-i18next'; + +message.config({ + top: 1130, + duration: 2, + maxCount: 3, +}); + +const GitHubToken = () => { + const [token, setToken] = useState(''); + const [isCollapsed, setIsCollapsed] = useState(true); + const [isEditing, setIsEditing] = useState(false); + const { t } = useTranslation(); + + useEffect(() => { + const storedToken = getToken(); + if (storedToken) { + setToken(storedToken); + } + }, []); + + const handleSave = () => { + if (!token.trim()) { + message.error(t('github_token_error_empty')); + return; + } + saveToken(token); + message.success(t('github_token_success_save')); + setIsEditing(false); + }; + + const handleEdit = () => { + setIsEditing(true); + }; + + const handleTestToken = async () => { + try { + const userData = await githubRequest('/user', { + headers: { Authorization: `Bearer ${token}` } + }); + message.success(t('github_token_success_valid', { username: userData.login })); + } catch (error) { + console.error('Token test failed:', error); + message.error(t('github_token_error_invalid')); + } + }; + + const obfuscateToken = (token: string) => { + if (token.length <= 4) return token; + return `${token[0]}${'*'.repeat(token.length - 2)}${token[token.length - 1]}`; + }; + + return ( +
+
+

{t('github_token_configuration')}

+ +
+

{t('github_token_description')}

+
+
setIsCollapsed(!isCollapsed)} + style={{ cursor: 'pointer', display: 'flex', alignItems: 'center' }} + > +

{t('github_token_how_to_generate')}

+ {isCollapsed ? '▶' : '▼'} +
+ {!isCollapsed && ( +
+
    +
  1. {t('github_token_step1')}
  2. +
  3. {t('github_token_step2')}
  4. +
  5. {t('github_token_step3')}
  6. +
  7. + {t('github_token_step4')} +
      +
    • {t('github_token_note')}: {t('github_token_note_description')}
    • +
    • {t('github_token_expiration')}: {t('github_token_expiration_description')}
    • +
    • {t('github_token_scopes')}: {t('github_token_scopes_description')}
    • +
    +
  8. +
  9. {t('github_token_step5')}
  10. +
  11. {t('github_token_step6')}
  12. +
+
+ )} +
+
{/* Container for displaying messages */} +
+ setToken(e.target.value)} + placeholder={t('github_token_placeholder')} + style={{ marginRight: '10px', flex: 1 }} + disabled={!isEditing} + /> + {isEditing ? ( + + ) : ( + + )} + +
+
+ ); +}; + +export default GitHubToken; + + + From eaf662b4f832b1049d68de210beeb7b2f1f7b761 Mon Sep 17 00:00:00 2001 From: wblx <904653630@qq.com> Date: Mon, 29 Jul 2024 15:59:53 +0800 Subject: [PATCH 3/9] sync --- src/helpers/githubApi.ts | 2 +- src/pages/Options/Options.tsx | 6 +-- src/pages/Options/components/GitHubToken.tsx | 43 ++++++++++++-------- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/helpers/githubApi.ts b/src/helpers/githubApi.ts index 24abc342..61471adb 100644 --- a/src/helpers/githubApi.ts +++ b/src/helpers/githubApi.ts @@ -2,7 +2,7 @@ let githubToken = ''; export const saveToken = (token: string) => { githubToken = token; - localStorage.setItem('github_token', token); + localStorage.setItem('github_token', token); }; export const getToken = () => { diff --git a/src/pages/Options/Options.tsx b/src/pages/Options/Options.tsx index e0027977..1e8f05c4 100644 --- a/src/pages/Options/Options.tsx +++ b/src/pages/Options/Options.tsx @@ -69,11 +69,7 @@ const Options = (): JSX.Element => { - + { const handleTestToken = async () => { try { const userData = await githubRequest('/user', { - headers: { Authorization: `Bearer ${token}` } + headers: { Authorization: `Bearer ${token}` }, }); message.success(t('github_token_success_valid', { username: userData.login })); } catch (error) { @@ -79,9 +79,15 @@ const GitHubToken = () => {
  • {t('github_token_step4')}
      -
    • {t('github_token_note')}: {t('github_token_note_description')}
    • -
    • {t('github_token_expiration')}: {t('github_token_expiration_description')}
    • -
    • {t('github_token_scopes')}: {t('github_token_scopes_description')}
    • +
    • + {t('github_token_note')}: {t('github_token_note_description')} +
    • +
    • + {t('github_token_expiration')}: {t('github_token_expiration_description')} +
    • +
    • + {t('github_token_scopes')}: {t('github_token_scopes_description')} +
  • {t('github_token_step5')}
  • @@ -92,26 +98,29 @@ const GitHubToken = () => {
    {/* Container for displaying messages */}
    - setToken(e.target.value)} - placeholder={t('github_token_placeholder')} - style={{ marginRight: '10px', flex: 1 }} + setToken(e.target.value)} + placeholder={t('github_token_placeholder')} + style={{ marginRight: '10px', flex: 1 }} disabled={!isEditing} /> {isEditing ? ( - + ) : ( - + )} - +
    ); }; export default GitHubToken; - - - From 44e98e10608d62849c9e6a19a3deff5923b3a716 Mon Sep 17 00:00:00 2001 From: wblx <904653630@qq.com> Date: Tue, 30 Jul 2024 11:47:08 +0800 Subject: [PATCH 4/9] Resolve inconsistent margins Signed-off-by: wblx <904653630@qq.com> --- src/pages/Options/Options.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Options/Options.css b/src/pages/Options/Options.css index 890cee97..6c2e8777 100644 --- a/src/pages/Options/Options.css +++ b/src/pages/Options/Options.css @@ -64,7 +64,7 @@ a { background-color: white; border: 1px solid #e1e4e8; border-radius: 6px; - margin-top: 20px; + margin-top: -10px; } .github-token-options .Box-header { From 7c55b94cf28658d362c30fa98db25ca265a05c2e Mon Sep 17 00:00:00 2001 From: wblx <904653630@qq.com> Date: Tue, 30 Jul 2024 14:29:28 +0800 Subject: [PATCH 5/9] lol Signed-off-by: wblx <904653630@qq.com> --- src/api/githubApi.ts | 25 ++++++++++++++ src/helpers/github-token.ts | 8 +++++ src/helpers/githubApi.ts | 34 -------------------- src/pages/Options/components/GitHubToken.tsx | 24 ++++++++------ 4 files changed, 47 insertions(+), 44 deletions(-) create mode 100644 src/api/githubApi.ts create mode 100644 src/helpers/github-token.ts delete mode 100644 src/helpers/githubApi.ts diff --git a/src/api/githubApi.ts b/src/api/githubApi.ts new file mode 100644 index 00000000..f395de16 --- /dev/null +++ b/src/api/githubApi.ts @@ -0,0 +1,25 @@ +import { getToken, saveToken } from '../helpers/github-token'; + +export const githubRequest = async (endpoint: string, options: RequestInit = {}): Promise => { + const token = getToken(); + if (!token) { + return null; + } + + try { + const response = await fetch(`https://api.github.com${endpoint}`, { + ...options, + headers: { + ...options.headers, + Authorization: `Bearer ${token}`, + }, + }); + return response.json(); + } catch (error) { + return null; + } +}; + +export { saveToken, getToken }; + + diff --git a/src/helpers/github-token.ts b/src/helpers/github-token.ts new file mode 100644 index 00000000..81dc6942 --- /dev/null +++ b/src/helpers/github-token.ts @@ -0,0 +1,8 @@ +export const saveToken = (token: string) => { + localStorage.setItem('github_token', token); + }; + +export const getToken = (): string => { +return localStorage.getItem('github_token') || ''; +}; + diff --git a/src/helpers/githubApi.ts b/src/helpers/githubApi.ts deleted file mode 100644 index 61471adb..00000000 --- a/src/helpers/githubApi.ts +++ /dev/null @@ -1,34 +0,0 @@ -let githubToken = ''; - -export const saveToken = (token: string) => { - githubToken = token; - localStorage.setItem('github_token', token); -}; - -export const getToken = () => { - if (!githubToken) { - githubToken = localStorage.getItem('github_token') || ''; - } - return githubToken; -}; - -export const githubRequest = async (endpoint: string, options: RequestInit = {}) => { - const token = getToken(); - if (!token) { - throw new Error('GitHub Token 未设置'); - } - - const response = await fetch(`https://api.github.com${endpoint}`, { - ...options, - headers: { - ...options.headers, - Authorization: `Bearer ${token}`, - }, - }); - - if (!response.ok) { - throw new Error(`GitHub 请求失败: ${response.statusText}`); - } - - return response.json(); -}; diff --git a/src/pages/Options/components/GitHubToken.tsx b/src/pages/Options/components/GitHubToken.tsx index 30a5165a..5df6989a 100644 --- a/src/pages/Options/components/GitHubToken.tsx +++ b/src/pages/Options/components/GitHubToken.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import TooltipTrigger from '../../../components/TooltipTrigger'; -import { saveToken, getToken, githubRequest } from '../../../helpers/githubApi'; +import { saveToken, getToken, githubRequest } from '../../../api/githubApi'; import { message } from 'antd'; import { useTranslation } from 'react-i18next'; @@ -38,18 +38,18 @@ const GitHubToken = () => { }; const handleTestToken = async () => { - try { - const userData = await githubRequest('/user', { - headers: { Authorization: `Bearer ${token}` }, - }); - message.success(t('github_token_success_valid', { username: userData.login })); - } catch (error) { - console.error('Token test failed:', error); + const userData = await githubRequest('/user', { + headers: { Authorization: `Bearer ${token}` }, + }); + + if (userData === null || userData.message) { message.error(t('github_token_error_invalid')); + } else { + message.success(t('github_token_success_valid', { username: userData.login })); } }; - const obfuscateToken = (token: string) => { + const obfuscateToken = (token: string): string => { if (token.length <= 4) return token; return `${token[0]}${'*'.repeat(token.length - 2)}${token[token.length - 1]}`; }; @@ -96,7 +96,7 @@ const GitHubToken = () => { )} -
    {/* Container for displaying messages */} +
    { }; export default GitHubToken; + + + + From 732a649d3d2feaaf6e780d2f8b4819aa59d993c2 Mon Sep 17 00:00:00 2001 From: wblx <904653630@qq.com> Date: Tue, 30 Jul 2024 14:29:43 +0800 Subject: [PATCH 6/9] lol Signed-off-by: wblx <904653630@qq.com> --- src/api/githubApi.ts | 2 -- src/helpers/github-token.ts | 9 ++++----- src/pages/Options/components/GitHubToken.tsx | 4 ---- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/api/githubApi.ts b/src/api/githubApi.ts index f395de16..1a5b4925 100644 --- a/src/api/githubApi.ts +++ b/src/api/githubApi.ts @@ -21,5 +21,3 @@ export const githubRequest = async (endpoint: string, options: RequestInit = {}) }; export { saveToken, getToken }; - - diff --git a/src/helpers/github-token.ts b/src/helpers/github-token.ts index 81dc6942..3d649692 100644 --- a/src/helpers/github-token.ts +++ b/src/helpers/github-token.ts @@ -1,8 +1,7 @@ export const saveToken = (token: string) => { - localStorage.setItem('github_token', token); - }; - + localStorage.setItem('github_token', token); +}; + export const getToken = (): string => { -return localStorage.getItem('github_token') || ''; + return localStorage.getItem('github_token') || ''; }; - diff --git a/src/pages/Options/components/GitHubToken.tsx b/src/pages/Options/components/GitHubToken.tsx index 5df6989a..6000cfb4 100644 --- a/src/pages/Options/components/GitHubToken.tsx +++ b/src/pages/Options/components/GitHubToken.tsx @@ -124,7 +124,3 @@ const GitHubToken = () => { }; export default GitHubToken; - - - - From f25b081b4d697083c89f4beeb9d1b3c6bd1ee91b Mon Sep 17 00:00:00 2001 From: wblx <904653630@qq.com> Date: Wed, 31 Jul 2024 15:08:26 +0800 Subject: [PATCH 7/9] response problem Signed-off-by: wblx <904653630@qq.com> --- .../developer-networks/react-modal.scss | 4 +-- .../ContentScripts/features/oss-gpt/rcw.scss | 22 +++----------- src/pages/Options/Options.css | 4 +-- src/pages/Options/components/GitHubToken.tsx | 30 ++++++++++++------- 4 files changed, 25 insertions(+), 35 deletions(-) diff --git a/src/pages/ContentScripts/features/developer-networks/react-modal.scss b/src/pages/ContentScripts/features/developer-networks/react-modal.scss index 590bde38..a3e2ed2f 100644 --- a/src/pages/ContentScripts/features/developer-networks/react-modal.scss +++ b/src/pages/ContentScripts/features/developer-networks/react-modal.scss @@ -16,9 +16,7 @@ transform: translate(-50%, -50%); padding: 24px; box-sizing: border-box; - box-shadow: - rgba(0, 0, 0, 0.22) 0px 25.6px 57.6px 0px, - rgba(0, 0, 0, 0.18) 0px 4.8px 14.4px 0px; + box-shadow: rgba(0, 0, 0, 0.22) 0px 25.6px 57.6px 0px, rgba(0, 0, 0, 0.18) 0px 4.8px 14.4px 0px; outline: transparent solid 3px; border-radius: 2px; background: var(--bgColor-default, var(--color-canvas-default)); diff --git a/src/pages/ContentScripts/features/oss-gpt/rcw.scss b/src/pages/ContentScripts/features/oss-gpt/rcw.scss index efff5817..aeeed719 100644 --- a/src/pages/ContentScripts/features/oss-gpt/rcw.scss +++ b/src/pages/ContentScripts/features/oss-gpt/rcw.scss @@ -339,11 +339,7 @@ img.rcw-picker-icon { line-height: 1.15; } .emoji-mart { - font-family: - -apple-system, - BlinkMacSystemFont, - Helvetica Neue, - sans-serif; + font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, sans-serif; font-size: 16px; display: inline-block; color: #222427; @@ -509,13 +505,7 @@ img.rcw-picker-icon { box-shadow: none; } .emoji-mart-emoji-native { - font-family: - Segoe UI Emoji, - Segoe UI Symbol, - Segoe UI, - Apple Color Emoji, - Twemoji Mozilla, - Noto Color Emoji, + font-family: Segoe UI Emoji, Segoe UI Symbol, Segoe UI, Apple Color Emoji, Twemoji Mozilla, Noto Color Emoji, Android Emoji; } .emoji-mart-no-results { @@ -781,18 +771,14 @@ img.rcw-picker-icon { .rcw-conversation-container.active { opacity: 1; transform: translateY(0); - transition: - opacity 0.3s ease, - transform 0.3s ease; + transition: opacity 0.3s ease, transform 0.3s ease; } .rcw-conversation-container.hidden { z-index: -1; pointer-events: none; opacity: 0; transform: translateY(10px); - transition: - opacity 0.3s ease, - transform 0.3s ease; + transition: opacity 0.3s ease, transform 0.3s ease; } .rcw-conversation-resizer { cursor: col-resize; diff --git a/src/pages/Options/Options.css b/src/pages/Options/Options.css index ba26d071..6c2e8777 100644 --- a/src/pages/Options/Options.css +++ b/src/pages/Options/Options.css @@ -4,9 +4,7 @@ margin-top: 10px; opacity: 1; background: white; - box-shadow: - rgba(0, 0, 0, 0.14) 0px 2px 2px 0px, - rgba(0, 0, 0, 0.12) 0px 1px 5px 0px, + box-shadow: rgba(0, 0, 0, 0.14) 0px 2px 2px 0px, rgba(0, 0, 0, 0.12) 0px 1px 5px 0px, rgba(0, 0, 0, 0.2) 0px 3px 1px -2px; transition: all 0.2s ease 0s; border-radius: 3px; diff --git a/src/pages/Options/components/GitHubToken.tsx b/src/pages/Options/components/GitHubToken.tsx index 6000cfb4..6e919ba2 100644 --- a/src/pages/Options/components/GitHubToken.tsx +++ b/src/pages/Options/components/GitHubToken.tsx @@ -1,20 +1,15 @@ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useRef } from 'react'; import TooltipTrigger from '../../../components/TooltipTrigger'; import { saveToken, getToken, githubRequest } from '../../../api/githubApi'; import { message } from 'antd'; import { useTranslation } from 'react-i18next'; -message.config({ - top: 1130, - duration: 2, - maxCount: 3, -}); - const GitHubToken = () => { const [token, setToken] = useState(''); const [isCollapsed, setIsCollapsed] = useState(true); const [isEditing, setIsEditing] = useState(false); const { t } = useTranslation(); + const inputRef = useRef(null); useEffect(() => { const storedToken = getToken(); @@ -25,11 +20,11 @@ const GitHubToken = () => { const handleSave = () => { if (!token.trim()) { - message.error(t('github_token_error_empty')); + showMessage(t('github_token_error_empty'), 'error'); return; } saveToken(token); - message.success(t('github_token_success_save')); + showMessage(t('github_token_success_save'), 'success'); setIsEditing(false); }; @@ -43,9 +38,9 @@ const GitHubToken = () => { }); if (userData === null || userData.message) { - message.error(t('github_token_error_invalid')); + showMessage(t('github_token_error_invalid'), 'error'); } else { - message.success(t('github_token_success_valid', { username: userData.login })); + showMessage(t('github_token_success_valid', { username: userData.login }), 'success'); } }; @@ -54,6 +49,18 @@ const GitHubToken = () => { return `${token[0]}${'*'.repeat(token.length - 2)}${token[token.length - 1]}`; }; + const showMessage = (content: string, type: 'success' | 'error') => { + if (inputRef.current) { + const rect = inputRef.current.getBoundingClientRect(); + message.config({ + top: rect.top - 50, + duration: 2, + maxCount: 3, + }); + message[type](content); + } + }; + return (
    @@ -100,6 +107,7 @@ const GitHubToken = () => {
    setToken(e.target.value)} placeholder={t('github_token_placeholder')} From f9578e7480d7aba963829bf14d1629bcf0f87bee Mon Sep 17 00:00:00 2001 From: wblx <904653630@qq.com> Date: Thu, 1 Aug 2024 12:40:07 +0800 Subject: [PATCH 8/9] duplicated options Signed-off-by: wblx <904653630@qq.com> --- src/api/githubApi.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/api/githubApi.ts b/src/api/githubApi.ts index 1a5b4925..791a9a00 100644 --- a/src/api/githubApi.ts +++ b/src/api/githubApi.ts @@ -9,10 +9,6 @@ export const githubRequest = async (endpoint: string, options: RequestInit = {}) try { const response = await fetch(`https://api.github.com${endpoint}`, { ...options, - headers: { - ...options.headers, - Authorization: `Bearer ${token}`, - }, }); return response.json(); } catch (error) { From 9be7b654361750c410543652d59877380ffacd93 Mon Sep 17 00:00:00 2001 From: Harry Date: Fri, 2 Aug 2024 22:55:07 -0700 Subject: [PATCH 9/9] chore: run prettier to format Signed-off-by: Harry --- package.json | 2 +- .../developer-networks/react-modal.scss | 4 +- .../ContentScripts/features/oss-gpt/rcw.scss | 22 ++++-- src/pages/Options/Options.css | 4 +- yarn.lock | 70 ++++++++++--------- 5 files changed, 61 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index 67dd7aaf..451ed7f8 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "mini-css-extract-plugin": "^2.7.2", "mkdirp": "^1.0.4", "prettier": "^3.3.3", - "pretty-quick": "^3.1.3", + "pretty-quick": "^4.0.0", "querystring": "^0.2.1", "sass": "^1.52.1", "sass-loader": "^12.4.0", diff --git a/src/pages/ContentScripts/features/developer-networks/react-modal.scss b/src/pages/ContentScripts/features/developer-networks/react-modal.scss index a3e2ed2f..590bde38 100644 --- a/src/pages/ContentScripts/features/developer-networks/react-modal.scss +++ b/src/pages/ContentScripts/features/developer-networks/react-modal.scss @@ -16,7 +16,9 @@ transform: translate(-50%, -50%); padding: 24px; box-sizing: border-box; - box-shadow: rgba(0, 0, 0, 0.22) 0px 25.6px 57.6px 0px, rgba(0, 0, 0, 0.18) 0px 4.8px 14.4px 0px; + box-shadow: + rgba(0, 0, 0, 0.22) 0px 25.6px 57.6px 0px, + rgba(0, 0, 0, 0.18) 0px 4.8px 14.4px 0px; outline: transparent solid 3px; border-radius: 2px; background: var(--bgColor-default, var(--color-canvas-default)); diff --git a/src/pages/ContentScripts/features/oss-gpt/rcw.scss b/src/pages/ContentScripts/features/oss-gpt/rcw.scss index aeeed719..efff5817 100644 --- a/src/pages/ContentScripts/features/oss-gpt/rcw.scss +++ b/src/pages/ContentScripts/features/oss-gpt/rcw.scss @@ -339,7 +339,11 @@ img.rcw-picker-icon { line-height: 1.15; } .emoji-mart { - font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, sans-serif; + font-family: + -apple-system, + BlinkMacSystemFont, + Helvetica Neue, + sans-serif; font-size: 16px; display: inline-block; color: #222427; @@ -505,7 +509,13 @@ img.rcw-picker-icon { box-shadow: none; } .emoji-mart-emoji-native { - font-family: Segoe UI Emoji, Segoe UI Symbol, Segoe UI, Apple Color Emoji, Twemoji Mozilla, Noto Color Emoji, + font-family: + Segoe UI Emoji, + Segoe UI Symbol, + Segoe UI, + Apple Color Emoji, + Twemoji Mozilla, + Noto Color Emoji, Android Emoji; } .emoji-mart-no-results { @@ -771,14 +781,18 @@ img.rcw-picker-icon { .rcw-conversation-container.active { opacity: 1; transform: translateY(0); - transition: opacity 0.3s ease, transform 0.3s ease; + transition: + opacity 0.3s ease, + transform 0.3s ease; } .rcw-conversation-container.hidden { z-index: -1; pointer-events: none; opacity: 0; transform: translateY(10px); - transition: opacity 0.3s ease, transform 0.3s ease; + transition: + opacity 0.3s ease, + transform 0.3s ease; } .rcw-conversation-resizer { cursor: col-resize; diff --git a/src/pages/Options/Options.css b/src/pages/Options/Options.css index 6c2e8777..ba26d071 100644 --- a/src/pages/Options/Options.css +++ b/src/pages/Options/Options.css @@ -4,7 +4,9 @@ margin-top: 10px; opacity: 1; background: white; - box-shadow: rgba(0, 0, 0, 0.14) 0px 2px 2px 0px, rgba(0, 0, 0, 0.12) 0px 1px 5px 0px, + box-shadow: + rgba(0, 0, 0, 0.14) 0px 2px 2px 0px, + rgba(0, 0, 0, 0.12) 0px 1px 5px 0px, rgba(0, 0, 0, 0.2) 0px 3px 1px -2px; transition: all 0.2s ease 0s; border-radius: 3px; diff --git a/yarn.lock b/yarn.lock index 80d897c7..a37fb169 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2507,7 +2507,7 @@ cross-fetch@4.0.0: dependencies: node-fetch "^2.6.12" -cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.3: +cross-spawn@^7.0.1, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -2930,24 +2930,9 @@ events@^3.2.0: resolved "https://registry.npmjs.org/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== -execa@^4.1.0: - version "4.1.0" - resolved "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" - integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA== - dependencies: - cross-spawn "^7.0.0" - get-stream "^5.0.0" - human-signals "^1.1.1" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.0" - onetime "^5.1.0" - signal-exit "^3.0.2" - strip-final-newline "^2.0.0" - -execa@^5.0.0: +execa@^5.0.0, execa@^5.1.1: version "5.1.1" - resolved "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== dependencies: cross-spawn "^7.0.3" @@ -3099,7 +3084,7 @@ find-cache-dir@^3.3.1: make-dir "^3.0.2" pkg-dir "^4.1.0" -find-up@^4.0.0, find-up@^4.1.0: +find-up@^4.0.0: version "4.1.0" resolved "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== @@ -3107,6 +3092,14 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + flat@^5.0.2: version "5.0.2" resolved "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" @@ -3213,7 +3206,7 @@ get-pixels@^3.3.2: request "^2.44.0" through "^2.3.4" -get-stream@^5.0.0, get-stream@^5.1.0: +get-stream@^5.1.0: version "5.2.0" resolved "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== @@ -3552,11 +3545,6 @@ http2-wrapper@^2.1.10: quick-lru "^5.1.1" resolve-alpn "^1.2.0" -human-signals@^1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" - integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== - human-signals@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" @@ -3962,6 +3950,13 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + lodash-es@^4.17.21: version "4.17.21" resolved "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" @@ -4313,7 +4308,7 @@ normalize-url@^8.0.0: resolved "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.1.tgz#9b7d96af9836577c58f5883e939365fa15623a4a" integrity sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w== -npm-run-path@^4.0.0, npm-run-path@^4.0.1: +npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== @@ -4371,7 +4366,7 @@ once@^1.3.0, once@^1.3.1, once@^1.4.0: dependencies: wrappy "1" -onetime@^5.1.0, onetime@^5.1.2: +onetime@^5.1.2: version "5.1.2" resolved "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== @@ -4423,6 +4418,13 @@ p-locate@^4.1.0: dependencies: p-limit "^2.2.0" +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + p-map@^2.0.0: version "2.1.0" resolved "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" @@ -4643,13 +4645,13 @@ pretty-format@^27.0.0, pretty-format@^27.5.1: ansi-styles "^5.0.0" react-is "^17.0.1" -pretty-quick@^3.1.3: - version "3.3.1" - resolved "https://registry.npmjs.org/pretty-quick/-/pretty-quick-3.3.1.tgz#cfde97fec77a8d201a0e0c9c71d9990e12587ee2" - integrity sha512-3b36UXfYQ+IXXqex6mCca89jC8u0mYLqFAN5eTQKoXO6oCQYcIVYZEB/5AlBHI7JPYygReM2Vv6Vom/Gln7fBg== +pretty-quick@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-4.0.0.tgz#ea5cce85a5804bfbec7327b0e064509155d03f39" + integrity sha512-M+2MmeufXb/M7Xw3Afh1gxcYpj+sK0AxEfnfF958ktFeAyi5MsKY5brymVURQLgPLV1QaF5P4pb2oFJ54H3yzQ== dependencies: - execa "^4.1.0" - find-up "^4.1.0" + execa "^5.1.1" + find-up "^5.0.0" ignore "^5.3.0" mri "^1.2.0" picocolors "^1.0.0" @@ -5645,7 +5647,7 @@ side-channel@^1.0.4: get-intrinsic "^1.2.4" object-inspect "^1.13.1" -signal-exit@^3.0.2, signal-exit@^3.0.3: +signal-exit@^3.0.3: version "3.0.7" resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==