diff --git a/frontend/apps/coze-studio/rsbuild.config.ts b/frontend/apps/coze-studio/rsbuild.config.ts index a92e459b..91916f56 100644 --- a/frontend/apps/coze-studio/rsbuild.config.ts +++ b/frontend/apps/coze-studio/rsbuild.config.ts @@ -83,7 +83,7 @@ const mergedConfig = defineConfig({ source: { define: { 'process.env.IS_REACT18': JSON.stringify(true), - // arcosite editor sdk 内部使用 + // Arcosite editor sdk internal use 'process.env.ARCOSITE_SDK_REGION': JSON.stringify( GLOBAL_ENVS.IS_OVERSEA ? 'VA' : 'CN', ), @@ -99,7 +99,7 @@ const mergedConfig = defineConfig({ include: [ path.resolve(__dirname, '../../packages'), path.resolve(__dirname, '../../infra/flags-devtool'), - // 以下几个包包含未降级的 ES 2022 语法(private methods)需要参与打包 + // The following packages contain undegraded ES 2022 syntax (private methods) that need to be packaged /\/node_modules\/(marked|@dagrejs|@tanstack)\//, ], alias: { diff --git a/frontend/apps/coze-studio/src/index.tsx b/frontend/apps/coze-studio/src/index.tsx index 7debde66..8ede3aa5 100644 --- a/frontend/apps/coze-studio/src/index.tsx +++ b/frontend/apps/coze-studio/src/index.tsx @@ -31,15 +31,15 @@ const initFlags = () => { }; const main = () => { - // 初始化功能开关的值 + // Initialize the value of the function switch initFlags(); - // 初始化i18n + // Initialize i18n initI18nInstance({ lng: (localStorage.getItem('i18next') ?? (IS_OVERSEA ? 'en' : 'zh-CN')) as | 'en' | 'zh-CN', }); - // 动态导入mdbox 样式 + // Import mdbox styles dynamically dynamicImportMdBoxStyle(); const $root = document.getElementById('root'); diff --git a/frontend/apps/coze-studio/src/routes/async-components.tsx b/frontend/apps/coze-studio/src/routes/async-components.tsx index daec62ac..f812a0c8 100644 --- a/frontend/apps/coze-studio/src/routes/async-components.tsx +++ b/frontend/apps/coze-studio/src/routes/async-components.tsx @@ -16,128 +16,128 @@ import { lazy } from 'react'; -// 登录页面 +// login page export const LoginPage = lazy(() => import('@coze-foundation/account-ui-adapter').then(res => ({ default: res.LoginPage, })), ); -// 文档页面 +// documentation page export const Redirect = lazy(() => import('../pages/redirect')); -// 工作空间侧边栏组件 +// Workspace Sidebar Component export const spaceSubMenu = lazy(() => import('@coze-foundation/space-ui-adapter').then(exps => ({ default: exps.WorkspaceSubMenu, })), ); -// 工作空间布局组件 +// Workspace Layout Component export const SpaceLayout = lazy(() => import('@coze-foundation/space-ui-adapter').then(exps => ({ default: exps.SpaceLayout, })), ); -// 某个具体的工作空间布局组件 +// A specific workspace layout component export const SpaceIdLayout = lazy(() => import('@coze-foundation/space-ui-base').then(exps => ({ default: exps.SpaceIdLayout, })), ); -// 项目开发页面 +// project development page export const Develop = lazy(() => import('../pages/develop')); -// 资源库页面 +// resource library page export const Library = lazy(() => import('../pages/library')); -// Agent IDE布局组件 +// Agent IDE Layout Component export const AgentIDELayout = lazy( () => import('@coze-agent-ide/layout-adapter'), ); -// Agent IDE页面 +// Agent IDE page export const AgentIDE = lazy(() => import('@coze-agent-ide/entry-adapter').then(res => ({ default: res.BotEditor, })), ); -// Agent IDE发布页面 +// Agent IDE Release Page export const AgentPublishPage = lazy(() => import('@coze-agent-ide/agent-publish').then(exps => ({ default: exps.AgentPublishPage, })), ); -// Project IDE页面 +// Project IDE Page export const ProjectIDE = lazy(() => import('@coze-project-ide/main').then(exps => ({ default: exps.IDELayout, })), ); -// Project IDE发布页面 +// Project IDE Release Page export const ProjectIDEPublish = lazy(() => import('@coze-studio/project-publish').then(exps => ({ default: exps.ProjectPublish, })), ); -// 知识库预览页面 +// Knowledge Base Preview Page export const KnowledgePreview = lazy(() => import('@coze-studio/workspace-base/knowledge-preview').then(exps => ({ default: exps.KnowledgePreviewPage, })), ); -// 知识库上传页面 +// Knowledge base upload page export const KnowledgeUpload = lazy(() => import('@coze-studio/workspace-base/knowledge-upload').then(exps => ({ default: exps.KnowledgeUploadPage, })), ); -// 数据库资源页面 +// database resource page export const DatabaseDetail = lazy(() => import('@coze-studio/workspace-base').then(exps => ({ default: exps.DatabaseDetailPage, })), ); -// 工作流页面 +// workflow page export const WorkflowPage = lazy(() => import('@coze-workflow/playground-adapter').then(res => ({ default: res.WorkflowPage, })), ); -// 插件资源页面布局组件 +// plugin resource page layout component export const PluginLayout = lazy(() => import('../pages/plugin/layout')); -// 插件资源页面 +// plugin resource page export const PluginPage = lazy(() => import('../pages/plugin/page')); -// 插件工具页面 +// plugin tool page export const PluginToolPage = lazy(() => import('../pages/plugin/tool/page')); -// 探索体验页面二级导航组件 +// Explore the experience page secondary navigation component export const exploreSubMenu = lazy(() => import('@coze-community/explore').then(exps => ({ default: exps.ExploreSubMenu, })), ); -// 模版页面 +// template page export const ExploreTemplatePage = lazy(() => import('@coze-community/explore').then(exps => ({ default: exps.TemplatePage, })), ); -// 插件商店页面 +// plugin store page export const ExplorePluginPage = lazy(() => import('@coze-community/explore').then(exps => ({ default: exps.PluginPage, diff --git a/frontend/apps/coze-studio/src/routes/index.tsx b/frontend/apps/coze-studio/src/routes/index.tsx index 6a918a30..db73e97a 100644 --- a/frontend/apps/coze-studio/src/routes/index.tsx +++ b/frontend/apps/coze-studio/src/routes/index.tsx @@ -48,7 +48,7 @@ import { export const router: ReturnType = createBrowserRouter([ - // 文档路由 + // Document routing { path: '/open/docs/*', Component: Redirect, @@ -73,7 +73,7 @@ export const router: ReturnType = requireAuth: false, }), }, - // 主应用路由 + // main application route { path: '/', Component: Layout, @@ -83,7 +83,7 @@ export const router: ReturnType = index: true, element: , }, - // 登录页路由 + // login page routing { path: 'sign', Component: LoginPage, @@ -94,7 +94,7 @@ export const router: ReturnType = }), }, - // 工作空间路由 + // Workspace Routing { path: 'space', Component: SpaceLayout, @@ -114,7 +114,7 @@ export const router: ReturnType = element: , }, - // 项目开发 + // Project Development { path: 'develop', Component: Develop, @@ -171,7 +171,7 @@ export const router: ReturnType = }), }, - // 资源库 + // resource library { path: 'library', Component: Library, @@ -180,7 +180,7 @@ export const router: ReturnType = }), }, - // 知识库资源 + // Knowledge Base Resources { path: 'knowledge', children: [ @@ -198,7 +198,7 @@ export const router: ReturnType = }), }, - // 数据库资源 + // database resources { path: 'database', children: [ @@ -213,7 +213,7 @@ export const router: ReturnType = }), }, - // 插件资源 + // plugin resources { path: 'plugin/:plugin_id', Component: PluginLayout, @@ -238,7 +238,7 @@ export const router: ReturnType = ], }, - // 工作流路由 + // workflow routing { path: 'work_flow', Component: WorkflowPage, @@ -248,7 +248,7 @@ export const router: ReturnType = }), }, - // 探索 + // explore { path: 'explore', Component: null, @@ -263,7 +263,7 @@ export const router: ReturnType = index: true, element: , }, - // 插件商店 + // plugin store { path: 'plugin', element: , @@ -271,7 +271,7 @@ export const router: ReturnType = type: 'plugin', }), }, - // 模版 + // template { path: 'template', element: , diff --git a/frontend/apps/coze-studio/tailwind.config.ts b/frontend/apps/coze-studio/tailwind.config.ts index 15488f1c..f04210ca 100644 --- a/frontend/apps/coze-studio/tailwind.config.ts +++ b/frontend/apps/coze-studio/tailwind.config.ts @@ -27,7 +27,7 @@ console.log(`Got ${contents.length} contents for tailwind`); export default { content: contents, - // safelist的内容可以允许动态生成tailwind className + // Safelist content can allow dynamic tailwind className safelist: [ { pattern: /(gap-|grid-).+/, @@ -47,7 +47,7 @@ export default { }, }, corePlugins: { - preflight: false, // 关闭@tailwind base默认样式,避免对现有样式影响 + preflight: false, // Turn off @tailwind base default styles to avoid affecting existing styles }, // eslint-disable-next-line @typescript-eslint/no-require-imports plugins: [require('@coze-arch/tailwind-config/coze')], diff --git a/frontend/config/eslint-config/eslint.config.web.js b/frontend/config/eslint-config/eslint.config.web.js index f84b14e3..f98c06af 100644 --- a/frontend/config/eslint-config/eslint.config.web.js +++ b/frontend/config/eslint-config/eslint.config.web.js @@ -5,7 +5,7 @@ module.exports = [ ...require('./eslint.config.base.js'), { plugins: { - // TODO: 需要根据不同类型配置plugin?需要阅读源码确认是否影响性能 + // TODO: Need to configure plugins according to different types? You need to read the source code to confirm whether it affects performance 'react-hooks': require('eslint-plugin-react-hooks'), react: require('eslint-plugin-react'), risxss: require('eslint-plugin-risxss'), diff --git a/frontend/config/eslint-config/rules/common-standard.js b/frontend/config/eslint-config/rules/common-standard.js index 1050f460..4183bfd0 100644 --- a/frontend/config/eslint-config/rules/common-standard.js +++ b/frontend/config/eslint-config/rules/common-standard.js @@ -28,7 +28,7 @@ const readBlockList = () => /** @type {(import('eslint').Linter.Config)[]} */ module.exports = [ - // NOTE: 不能和下一项配置合并 + // NOTE: Cannot be merged with the next configuration { ignores: [ '**/*.d.ts', @@ -68,7 +68,7 @@ module.exports = [ ...require('@coze-arch/eslint-plugin').configs.recommended, require('@coze-arch/eslint-plugin/zustand').configs.recommended, { - files: ['**/*.?(m|c)?(j|t)s?(x)'], // 排除规则对package.json生效 + files: ['**/*.?(m|c)?(j|t)s?(x)'], // Exclusion rules take effect for package.json plugins: { prettier: require('eslint-plugin-prettier'), '@babel': require('@babel/eslint-plugin'), diff --git a/frontend/config/eslint-config/rules/import.js b/frontend/config/eslint-config/rules/import.js index 9da7d5d2..6c1b42fa 100644 --- a/frontend/config/eslint-config/rules/import.js +++ b/frontend/config/eslint-config/rules/import.js @@ -5,7 +5,7 @@ module.exports = [ { files: ['**/*.?(m|c)?(j|t)s?(x)'], settings: { - // TODO: 全局保留一份配置 + // TODO: Keep a configuration globally 'import/resolver': { node: { moduleDirectory: ['node_modules', 'src'], @@ -72,8 +72,8 @@ module.exports = [ }, }, rules: { - // TODO: 目前由于 edenx 会动态生成一些插件模块,因此启动会报错 - // 后续需要修复问题,启动下述规则 + // TODO: At present, because edenx will dynamically generate some plug-in modules, an error will be reported when starting. + // You need to fix the problem later, and start the following rules. // "import/no-unresolved": "error" }, }, diff --git a/frontend/config/eslint-config/rules/ts-standard.js b/frontend/config/eslint-config/rules/ts-standard.js index e8b9d073..7571bdd8 100644 --- a/frontend/config/eslint-config/rules/ts-standard.js +++ b/frontend/config/eslint-config/rules/ts-standard.js @@ -59,9 +59,9 @@ module.exports = [ { vars: 'all', args: 'none', // function arguments should not force to match this rule. - argsIgnorePattern: '^_', // 规范允许下划线 - ignoreRestSiblings: true, //使用rest语法(如 `var { foo, ...rest } = data`) 忽略foo。 - destructuredArrayIgnorePattern: '^_', //结构数组允许使用_ + argsIgnorePattern: '^_', // Specifications allow underlining + ignoreRestSiblings: true, //Use rest syntax (such as'var {foo,... rest} = data ') to ignore foo. + destructuredArrayIgnorePattern: '^_', //Structural arrays allow _ caughtErrors: 'none', // "caughtErrorsIgnorePattern": "^e$" }, @@ -314,7 +314,7 @@ module.exports = [ }, }, - // TODO: 之前overides的内容,后需可考虑直接合入上面标准配置 + // TODO: The content of overides before can be considered to be directly integrated into the above standard configuration later { files: ['**/*.?(m|c)ts?(x)'], rules: { @@ -324,8 +324,8 @@ module.exports = [ fixStyle: 'inline-type-imports', }, ], - // 这些规则都是从 packages/config/.eslintrc.react.js 复制迁移过来 - // 后续在做调整 + // These rules are copied and migrated from packages/config/.eslintrc.react.js + // Adjustments are being made later. '@typescript-eslint/no-redundant-type-constituents': 0, '@typescript-eslint/no-throw-literal': 'off', '@typescript-eslint/no-unnecessary-condition': 0, @@ -335,14 +335,14 @@ module.exports = [ '@typescript-eslint/explicit-function-return-type': 'off', 'no-shadow': 'off', '@typescript-eslint/no-shadow': 'error', - // TODO: 后续开启 + // TODO: Follow-up opening // 'import/no-cycle': 'error', '@typescript-eslint/prefer-string-starts-ends-with': 0, '@typescript-eslint/no-unnecessary-boolean-literal-compare': 0, '@typescript-eslint/no-implied-eval': 0, // warning - // TODO: 打开下面这些配置 + // TODO: Open the following configurations // fix: https://stackoverflow.com/questions/63961803/eslint-says-all-enums-in-typescript-app-are-already-declared-in-the-upper-scope // 'no-shadow': 'off', // '@typescript-eslint/no-shadow': ['error'], @@ -364,7 +364,7 @@ module.exports = [ // }, // ], // complexity: ['error', { max: 15 }], - // 后面统一使用CustomError后 再开启 + // After using CustomError uniformly later, open it again. '@coze-arch/no-new-error': 'off', }, }, diff --git a/frontend/config/eslint-config/scripts/reslint.sh b/frontend/config/eslint-config/scripts/reslint.sh index 13944a4e..4f2c6082 100755 --- a/frontend/config/eslint-config/scripts/reslint.sh +++ b/frontend/config/eslint-config/scripts/reslint.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash BASE_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") -# 某些系统可能没有 realpath 命令, +# Some systems may not have the realpath command. if ! command -v realpath &>/dev/null; then echo "未找到 realpath 命令" echo "请执行以下命令安装必要依赖" diff --git a/frontend/config/eslint-config/scripts/rprettier.sh b/frontend/config/eslint-config/scripts/rprettier.sh index 213727ca..e56c5c40 100755 --- a/frontend/config/eslint-config/scripts/rprettier.sh +++ b/frontend/config/eslint-config/scripts/rprettier.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash BASE_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") -# 某些系统可能没有 realpath 命令, +# Some systems may not have the realpath command. if ! command -v realpath &>/dev/null; then echo "未找到 realpath 命令" echo "请执行以下命令安装必要依赖" diff --git a/frontend/config/eslint-config/src/index.js b/frontend/config/eslint-config/src/index.js index 2f1d137e..d47833ac 100644 --- a/frontend/config/eslint-config/src/index.js +++ b/frontend/config/eslint-config/src/index.js @@ -2,9 +2,9 @@ require('sucrase/register/ts'); const { defineConfig } = require('./define-config'); -// node@16 没有 structuredClone 方法导致报错: +// node@16 no structuredClone method causes an error: // ReferenceError: Error while loading rule '@typescript-eslint/naming-convention': structuredClone is not defined -// 此处做个简单 polyfill +// Make a simple polyfill here if (typeof structuredClone === 'undefined') { global.structuredClone = obj => JSON.parse(JSON.stringify(obj)); } diff --git a/frontend/config/rsbuild-config/src/index.ts b/frontend/config/rsbuild-config/src/index.ts index 462cd3b9..776fb841 100644 --- a/frontend/config/rsbuild-config/src/index.ts +++ b/frontend/config/rsbuild-config/src/index.ts @@ -28,7 +28,7 @@ import { SemiRspackPlugin } from '@douyinfe/semi-rspack-plugin'; const getDefine = () => { const define = {}; Object.keys(GLOBAL_ENVS).forEach(key => { - // 在rspack的define中,字符串需要前后拼接上双引号,才能在代码中作为字符串使用。 + // In the definition of rspack, strings need to be enclosed in double quotes before they can be used as strings in code. if (typeof GLOBAL_ENVS[key] === 'string') { define[key] = `"${GLOBAL_ENVS[key]}"`; } else { @@ -115,7 +115,7 @@ export const defineConfig = (options: Partial) => { ), }, include: [ - // 以下几个包包含未降级的 ES 2022 语法(private methods)需要参与打包 + // The following packages contain undegraded ES 2022 syntax (private methods) that need to be packaged /\/node_modules\/(marked|@dagrejs|@tanstack)\//, ], }, diff --git a/frontend/config/stylelint-config/.stylelintrc.js b/frontend/config/stylelint-config/.stylelintrc.js index 448fa2ef..6a5cb666 100644 --- a/frontend/config/stylelint-config/.stylelintrc.js +++ b/frontend/config/stylelint-config/.stylelintrc.js @@ -6,9 +6,9 @@ module.exports = { ], plugins: ['./plugins/plugin-disallow-nesting-level-one-global.js'], rules: { - // 变量命名规则,适应仓库内的代码风格 + // Variable naming rules to adapt to the code style in the warehouse 'custom-property-pattern': '^([A-Za-z0-9]*)([-_]+[A-Za-z0-9]+)*$', - // 对于less函数判断有问题 + // There is a problem with judging the less function 'less/no-duplicate-variables': null, 'media-feature-range-notation': null, 'max-nesting-depth': [ diff --git a/frontend/config/tailwind-config/src/coze.js b/frontend/config/tailwind-config/src/coze.js index 90111b3c..26dae8f4 100644 --- a/frontend/config/tailwind-config/src/coze.js +++ b/frontend/config/tailwind-config/src/coze.js @@ -5,7 +5,7 @@ const plugin = require('tailwindcss/plugin'); const lightModeVariables = require('./light'); const darkModeVariables = require('./dark'); -// 用于生成 CSS 变量的帮助函数 +// Helper functions for generating CSS variables function generateCssVariables(variables, theme) { return Object.entries(variables).reduce((acc, [key, value]) => { acc[`--${key}`] = theme ? theme(value) : value; @@ -13,7 +13,7 @@ function generateCssVariables(variables, theme) { }, {}); } -// 样式语义化 +// style semantics function generateSemanticVariables(semantics, theme, property) { return Object.entries(semantics).map(([key, value]) => ({ [`.${key}`]: { diff --git a/frontend/config/tailwind-config/src/dark.js b/frontend/config/tailwind-config/src/dark.js index 3792812c..7f4f62bb 100644 --- a/frontend/config/tailwind-config/src/dark.js +++ b/frontend/config/tailwind-config/src/dark.js @@ -1,4 +1,4 @@ -// 暗色模式的 CSS 变量 +// CSS Variables for Dark Mode const darkModeVariables = { background: '2, 8, 23', foreground: '249, 249, 249', diff --git a/frontend/config/tailwind-config/src/design-token.ts b/frontend/config/tailwind-config/src/design-token.ts index 6aecebe6..e36b6fdf 100644 --- a/frontend/config/tailwind-config/src/design-token.ts +++ b/frontend/config/tailwind-config/src/design-token.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -// 消费者和生产者公共的 tailwind 配置和工具函数 +// Common tailwind configurations and tool functions for consumers and producers export function designTokenToTailwindConfig( tokenJson: Record, @@ -103,6 +103,6 @@ function borderRadiusTransformer(borderRadiusObj: Record) { return res; } -// 获取其他packages,并且拼接上 /src/**/*.{ts,tsx} +// Get other packages and splice /src /**/*.{ ts, tsx} export { getTailwindContents } from './tailwind-contents'; diff --git a/frontend/config/tailwind-config/src/light.js b/frontend/config/tailwind-config/src/light.js index 8d214eb5..0d6251bf 100644 --- a/frontend/config/tailwind-config/src/light.js +++ b/frontend/config/tailwind-config/src/light.js @@ -1,4 +1,4 @@ -// 浅色模式的 CSS 变量 +// CSS Variables for Light Mode const lightModeVariables = { background: '255, 255, 255', foreground: '28, 28, 35', @@ -27,7 +27,7 @@ const lightModeVariables = { 'coze-fg-3': '15, 21, 40', 'coze-fg-2': '32, 41, 69', 'coze-fg-1': '55, 67, 106', - // TODO: 需要删除bg9 + // TODO: need to remove bg9 'coze-bg-9': '6, 7, 9', 'coze-bg-8': '68, 83, 130', 'coze-bg-7': '75, 90, 140', @@ -151,7 +151,7 @@ const lightModeVariables = { 'coze-3': '3px', 'coze-2': '2px', 'coze-1': '1px', - // TODO: rspress编译不出来,需要通过一些工具处理,目前没有用到,暂时注释处理 + // TODO: rspress cannot be compiled, and it needs to be processed by some tools. It is not used at present. Temporary comment processing // 'coze-0.5': '0.5px', 'coze-0-5': '0.5px', @@ -174,7 +174,7 @@ const lightModeVariables = { 'coze-bg-6-alpha': '0.13', 'coze-bg-7-alpha': '0.19', 'coze-bg-8-alpha': '0.25', - // TODO: 需要删除bg9 + // TODO: need to remove bg9 'coze-bg-9-alpha': '0.16', 'coze-stroke-5-alpha': '0.13', 'coze-stroke-6-alpha': '0.25', diff --git a/frontend/config/tailwind-config/src/tailwind-contents.ts b/frontend/config/tailwind-config/src/tailwind-contents.ts index 588ee4ce..9281c296 100644 --- a/frontend/config/tailwind-config/src/tailwind-contents.ts +++ b/frontend/config/tailwind-config/src/tailwind-contents.ts @@ -46,7 +46,7 @@ export const getTailwindContents = (projectRoot: string) => { .map(location => path.resolve(location, 'src/**/*.{ts,tsx}')), ); - // 兼容 coze-design 内部 tailwind 样式 + // Compatible with coze-design internal tailwind style contents.push('./node_modules/@coze-arch/coze-design/**/*.{js,jsx}'); return contents; diff --git a/frontend/config/ts-config/scripts/rtsc.sh b/frontend/config/ts-config/scripts/rtsc.sh index 3eaaffd7..53020592 100755 --- a/frontend/config/ts-config/scripts/rtsc.sh +++ b/frontend/config/ts-config/scripts/rtsc.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash BASE_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") -# 某些系统可能没有 realpath 命令, +# Some systems may not have the realpath command. if ! command -v realpath &>/dev/null; then echo "未找到 realpath 命令" echo "请执行以下命令安装必要依赖" diff --git a/frontend/config/ts-config/tsconfig.base.json b/frontend/config/ts-config/tsconfig.base.json index 32bd7034..e44af0ea 100644 --- a/frontend/config/ts-config/tsconfig.base.json +++ b/frontend/config/ts-config/tsconfig.base.json @@ -16,7 +16,7 @@ "moduleResolution": "node", "module": "CommonJS", "noFallthroughCasesInSwitch": true, - // 这个普遍反馈会让代码变得啰嗦,暂定遵循原本 bot 的设置,关闭 + // This general feedback will make the code verbose, tentatively follow the original bot's settings, close "noImplicitReturns": false, "removeComments": false, "resolveJsonModule": true, diff --git a/frontend/config/vitest-config/src/define-config.ts b/frontend/config/vitest-config/src/define-config.ts index d7631e05..0c45abad 100644 --- a/frontend/config/vitest-config/src/define-config.ts +++ b/frontend/config/vitest-config/src/define-config.ts @@ -46,7 +46,7 @@ const calBasePreset = (preset: string) => { export interface OtherConfig { /** - * 用于修复semi的package.json导出的配置问题 + * Used to fix the configuration issue of semi's package.json export */ fixSemi: boolean; } diff --git a/frontend/config/vitest-config/src/preset-default.ts b/frontend/config/vitest-config/src/preset-default.ts index 49fd2fbe..d7a2ee63 100644 --- a/frontend/config/vitest-config/src/preset-default.ts +++ b/frontend/config/vitest-config/src/preset-default.ts @@ -20,7 +20,7 @@ import tsconfigPaths from 'vite-tsconfig-paths'; export const defaultVitestConfig: UserConfig = { plugins: [tsconfigPaths()], resolve: { - // 优先识别 main,如果没有配置 main,则识别 module + // Priority to identify main, if main is not configured, identify the module mainFields: ['main', 'module', 'exports'], }, server: { @@ -38,14 +38,14 @@ export const defaultVitestConfig: UserConfig = { }, }, sequence: { - // vitest 2.0之后,所有钩子默认串行运行 + // After vitest 2.0, all hooks run serially by default hooks: 'parallel', }, globals: true, mockReset: false, silent: process.env.CI === 'true', coverage: { - // 逐步对各包开启 + // Gradually open each package all: false, include: ['src/**/*.ts', 'src/**/*.tsx'], exclude: coverageConfigDefaults.exclude, diff --git a/frontend/disallowed_3rd_libraries.json b/frontend/disallowed_3rd_libraries.json index c2676b61..f8919a1a 100644 --- a/frontend/disallowed_3rd_libraries.json +++ b/frontend/disallowed_3rd_libraries.json @@ -1,16 +1,16 @@ [ - // 可使用 @vitest/coverage-v8 替代 + // Can be replaced by @vitest/coverage-v8 ["@vitest/coverage-c8", null, "请使用 @vitest/coverage-v8"], "husky", "lint-staged", "jest", ["jsdom", null, "请使用 happy-dom 代替"], - // TODO: 等待完全修复后开启@tanjizhen + // TODO: Open @tanjizhen after waiting for full repair // "@oceanos/logger", ["inquirer", null, "请使用 @inquirer/prompts 代替"], ["pdfjs-dist", null, "请使用 @coze-arch/pdfjs-shadow 代替"], // todo: should turn on this - // ["valtio", null, "请使用 zustand"], - // ["jotai", null, "请使用 zustand"] + // ["Valtio", null, "Please use zustand"], + // ["Jotai", null, "Please use zustand"] ["@flow-web/md-box", null, "请使用 @coze-arch/bot-md-box-adapter 代替"] ] diff --git a/frontend/infra/eslint-plugin/src/index.ts b/frontend/infra/eslint-plugin/src/index.ts index 62e06bad..28f8d51e 100644 --- a/frontend/infra/eslint-plugin/src/index.ts +++ b/frontend/infra/eslint-plugin/src/index.ts @@ -48,7 +48,7 @@ export const flowPreset = { '@coze-arch/tsx-no-leaked-render': 'warn', '@coze-arch/no-pkg-dir-import': 'error', '@coze-arch/no-duplicated-deps': 'error', - // 不允许超过 4 层的相对应用 + // Relative applications with more than 4 layers are not allowed '@coze-arch/no-deep-relative-import': [ 'error', { @@ -56,7 +56,7 @@ export const flowPreset = { }, ], '@coze-arch/package-require-author': 'error', - // 函数代码行不要超过 150 + // Function code lines should not exceed 150. '@coze-arch/max-line-per-function': [ 'error', { @@ -73,11 +73,11 @@ export const flowPreset = { files: ['package.json'], processor: '@coze-arch/json-processor', rules: { - // TODO: 需要重构为直接解析json,否则全局规则都会对processor处理后的文件`package.js`生效. + // TODO: It needs to be refactored to parse json directly, otherwise the global rules will take effect on the file'package.js' processed by the processor. //https://github.com/eslint/json '@coze-arch/package-require-author': 'error', '@coze-arch/package-disallow-deps': 'error', - // 关闭prettier规则,因为该规则lint package.js存在bug + // Close the prettier rule because there is a bug in the rule lint package.js 'prettier/prettier': 'off', }, }, diff --git a/frontend/infra/eslint-plugin/src/rules/max-lines-per-function/index.ts b/frontend/infra/eslint-plugin/src/rules/max-lines-per-function/index.ts index b8861b9b..07647d38 100644 --- a/frontend/infra/eslint-plugin/src/rules/max-lines-per-function/index.ts +++ b/frontend/infra/eslint-plugin/src/rules/max-lines-per-function/index.ts @@ -36,7 +36,7 @@ const getStaticStringValue = node => { * * @param node * @returns - * 为什么需要这个判断,对于下面这种函数 + * Why is this judgment necessary for a function such as * ``` * var obj1 = { * set @@ -46,9 +46,9 @@ const getStaticStringValue = node => { * } * } *``` - * 如果不采用下面这个判断,函数判断将得到3,实际应该为5. 类似的还有 + * If you don't use the following judgment, the function judgment will get 3, which should actually be 5. Similarly, there are * ``` - * //如果不采用下面这个判断,函数判断将得到3,实际应该为8 + * //If the following judgment is not used, the function judgment will get 3, which should actually be 8ing judgment, the function judgment will get 3, which should actually be 8. * class A { static [ @@ -85,14 +85,14 @@ const isEmbedded = node => { * * @param node * @returns function name - * Q:为什么不直接用 node.id.value获取函数名称 ? - * A:这种方式对于 传统的函数写法没问题,但是对于 + * Q: Why not get the function name directly with node.id? + * A: This method is fine for traditional function writing, but for * const tips = { * fun: () => {} * }; - * 或者 + * or * const fun2 = () => {} - * 方式书写函数得到的名称为null,所以采取下面这种方式获取, + * The name of the function written in the following way is null, so it is obtained in the following way. * */ @@ -192,7 +192,7 @@ const getStaticPropertyName = node => { case 'VariableDeclarator': prop = node.id; break; - //TODO: CallExpression 场景较为复杂,目前应该没有完全覆盖 + //TODO: The CallExpression scenario is more complex and should not be fully covered at present case 'CallExpression': prop = node.callee; break; @@ -240,7 +240,7 @@ export const maxLinePerFunctionRule: Rule.RuleModule = { function checkFunctionLength(funcNode) { const node = isEmbedded(funcNode) ? funcNode.parent : funcNode; - // 针对函数声明,函数表达式,箭头函数,函数定义四种类型 + // Four types of function declarations, function expressions, arrow functions, and function definitions if ( node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression' || diff --git a/frontend/infra/eslint-plugin/src/rules/no-duplicated-deps/index.ts b/frontend/infra/eslint-plugin/src/rules/no-duplicated-deps/index.ts index 72bd8142..6e846150 100644 --- a/frontend/infra/eslint-plugin/src/rules/no-duplicated-deps/index.ts +++ b/frontend/infra/eslint-plugin/src/rules/no-duplicated-deps/index.ts @@ -40,7 +40,7 @@ export const noDuplicatedDepsRule: Rule.RuleModule = { if (!properties) { return; } - // 对比 dependencies 与 devDependencies 之间是否存在重复依赖 + // Compare dependencies with devDependencies for duplicate dependencies const dependencies = properties.find( p => p.key.value === 'dependencies', ); diff --git a/frontend/infra/eslint-plugin/src/rules/no-pkg-dir-import/index.ts b/frontend/infra/eslint-plugin/src/rules/no-pkg-dir-import/index.ts index c2f90b9f..cda8c9e8 100644 --- a/frontend/infra/eslint-plugin/src/rules/no-pkg-dir-import/index.ts +++ b/frontend/infra/eslint-plugin/src/rules/no-pkg-dir-import/index.ts @@ -40,7 +40,7 @@ export const noPkgDirImport: Rule.RuleModule = { const modulePath = resolve(importPath, context); if (!modulePath) { - // 解析不到的情况,暂不处理 + // If it cannot be resolved, it will not be dealt with for the time being. return; } @@ -56,15 +56,15 @@ export const noPkgDirImport: Rule.RuleModule = { return; } - // 本地link会解析到node_modules目录,需要拿到pkg name再次解析。 + // The local link will resolve to the node_modules directory, and you need to get the pkg name to resolve it again. const moduleRealPath = resolve(pkg.name, context); if ( - // 包名称就是引用路径 + // The package name is the reference path pkg.name === importPath || - // 解析到其他包,如@type + // Parse to other packages, such as @type !importPath.startsWith(pkg.name) || - // 解析到自己包的文件 + // Parse to the file of your own package currentPkgPath === importPkgPath || !moduleRealPath || moduleRealPath.includes('node_modules') diff --git a/frontend/infra/eslint-plugin/src/rules/no-pkg-dir-import/test/index.test.ts b/frontend/infra/eslint-plugin/src/rules/no-pkg-dir-import/test/index.test.ts index 4c3ee690..46f64890 100644 --- a/frontend/infra/eslint-plugin/src/rules/no-pkg-dir-import/test/index.test.ts +++ b/frontend/infra/eslint-plugin/src/rules/no-pkg-dir-import/test/index.test.ts @@ -32,7 +32,7 @@ vi.mock('eslint-module-utils/readPkgUp', () => ({ const validCases = [ { code: 'import "xxx"', - modulePath: undefined, // modulePath 为 空 + modulePath: undefined, // modulePath is empty moduleRealPath: undefined, importPkgPath: 'path/to/import/pkg', currentPkgPath: 'path/to/current/pkg', @@ -48,7 +48,7 @@ const validCases = [ importPkgPath: 'path/to/import/pkg', currentPkgPath: 'path/to/current/pkg', pkg: { - name: 'some/pkg', // 包名称与引用路径相同 + name: 'some/pkg', // The package name is the same as the reference path exports: {}, }, }, @@ -59,7 +59,7 @@ const validCases = [ importPkgPath: 'path/to/import/pkg', currentPkgPath: 'path/to/current/pkg', pkg: { - name: undefined, // 解析到不规范配置的package.json + name: undefined, // Parse to the non-canonical package.json }, }, { @@ -69,7 +69,7 @@ const validCases = [ importPkgPath: 'path/to/import/pkg', currentPkgPath: 'path/to/current/pkg', pkg: { - name: '@types/pkg', // 解析到类型包 + name: '@types/pkg', // Parse to type package exports: {}, }, }, @@ -77,7 +77,7 @@ const validCases = [ code: "import pkg from 'pkg';", modulePath: 'path/to/module', moduleRealPath: 'path/to/module', - importPkgPath: 'path/to/same/pkg', // 相同路径 + importPkgPath: 'path/to/same/pkg', // same path currentPkgPath: 'path/to/same/pkg', pkg: { name: '@types/pkg', @@ -98,7 +98,7 @@ const validCases = [ { code: "import pkg from 'pkg';", modulePath: 'path/to/module', - moduleRealPath: 'path/to/node_modules/pkg', // 解析到node_modules + moduleRealPath: 'path/to/node_modules/pkg', // Parse to node_modules importPkgPath: 'path/to/import/pkg', currentPkgPath: 'path/to/current/pkg', pkg: { @@ -134,7 +134,7 @@ const validCases = [ if (!c.modulePath) { return { code: c.code, - // TODO: 避免eslint duplication检测。可能需要改为其他方式 + // TODO: Avoid eslint duplication. It may need to be changed to another way settings: c, }; } @@ -167,7 +167,7 @@ const invalidCases = [ currentPkgPath: 'path/to/current/pkg', pkg: { name: 'pkg', - exports: undefined, // 为空 + exports: undefined, // empty }, messageId: 'noExportsCfg', }, diff --git a/frontend/infra/eslint-plugin/src/rules/package-disallow-deps/index.ts b/frontend/infra/eslint-plugin/src/rules/package-disallow-deps/index.ts index 378293c9..56981f59 100644 --- a/frontend/infra/eslint-plugin/src/rules/package-disallow-deps/index.ts +++ b/frontend/infra/eslint-plugin/src/rules/package-disallow-deps/index.ts @@ -56,7 +56,7 @@ export const disallowDepRule: Rule.RuleModule = { return; } const [, blockVersion, tips] = definition; - // 没有提供 version 参数,判定为不允许所有版本号 + // No version parameter is provided, and it is determined that all version numbers are not allowed if (typeof blockVersion !== 'string' || blockVersion.length <= 0) { context.report({ node, diff --git a/frontend/infra/eslint-plugin/src/rules/tsx-no-leaked-render/index.ts b/frontend/infra/eslint-plugin/src/rules/tsx-no-leaked-render/index.ts index 2598c9ba..ab5a7476 100644 --- a/frontend/infra/eslint-plugin/src/rules/tsx-no-leaked-render/index.ts +++ b/frontend/infra/eslint-plugin/src/rules/tsx-no-leaked-render/index.ts @@ -20,12 +20,12 @@ import reactPlugin from 'eslint-plugin-react'; const originRule = reactPlugin.rules['jsx-no-leaked-render']; -// 扩展react/jsx-no-leaked-render。增加判断 「&&」 表达式左边为 boolean 、 null 、 undefined TS类型,则不报错。 +// Expand the react/jsx-no-leaked-render. If the left side of the "& &" expression is boolean, null, undefined TS type, no error will be reported. export const tsxNoLeakedRender = ruleComposer.filterReports( originRule, problem => { const { parent } = problem.node; - // 如果表达式是用于jsx属性,则不需要修复。 如 + // If the expression is used for jsx properties, it does not need to be fixed. Such as < Comp prop = {{foo: 1} & & obj}/> if ( parent?.type === AST_NODE_TYPES.JSXExpressionContainer && parent?.parent?.type === AST_NODE_TYPES.JSXAttribute diff --git a/frontend/infra/eslint-plugin/src/zustand/rules/prefer-shallow/index.test.ts b/frontend/infra/eslint-plugin/src/zustand/rules/prefer-shallow/index.test.ts index 6b556570..24c317a5 100644 --- a/frontend/infra/eslint-plugin/src/zustand/rules/prefer-shallow/index.test.ts +++ b/frontend/infra/eslint-plugin/src/zustand/rules/prefer-shallow/index.test.ts @@ -25,7 +25,7 @@ ruleTester.run('prefer-shallow', preferShallow, { 'new Foo()', 'useShallowedFooStore()', 'useFooStore((s) => s.value)', - 'useFooStore(selector)', // 暂时豁免 + 'useFooStore(selector)', // Temporary exemption 'useShallowFooStore(() => ({}))', 'useFooStore(useShallow(() => ({})))', 'useFooStore(useShallow(() => ([])))', diff --git a/frontend/infra/idl/idl-parser/__tests__/demo.thrift.ts b/frontend/infra/idl/idl-parser/__tests__/demo.thrift.ts index 117741aa..8bd1582c 100644 --- a/frontend/infra/idl/idl-parser/__tests__/demo.thrift.ts +++ b/frontend/infra/idl/idl-parser/__tests__/demo.thrift.ts @@ -32,8 +32,8 @@ struct UserDeleteDataMap { We */ enum AvatarMetaType { - UNKNOWN = 0, // 没有数据, 错误数据或者系统错误降级 - RANDOM = 1, // 在修改 or 创建时,用户未指定 name 或者选中推荐的文字时,程序随机选择的头像 + UNKNOWN = 0, // No data, incorrect data, or system error downgrade + RANDOM = 1, // When modifying or creating, the user does not specify a name or select the recommended text, the program randomly selects the avatar } `; diff --git a/frontend/infra/idl/idl-parser/__tests__/demo.unify.ts b/frontend/infra/idl/idl-parser/__tests__/demo.unify.ts index 19565b21..8457b7e1 100644 --- a/frontend/infra/idl/idl-parser/__tests__/demo.unify.ts +++ b/frontend/infra/idl/idl-parser/__tests__/demo.unify.ts @@ -46,8 +46,8 @@ enum Gender { } // const map genderMap = { -// Gender.Male: '男性', -// Gender.Female: '女性', +// Gender. Male: 'Male', +// Gender. Female: 'Female', // } union FuncRequest { diff --git a/frontend/infra/idl/idl-parser/src/unify/proto.ts b/frontend/infra/idl/idl-parser/src/unify/proto.ts index 08e37998..4a5f0187 100644 --- a/frontend/infra/idl/idl-parser/src/unify/proto.ts +++ b/frontend/infra/idl/idl-parser/src/unify/proto.ts @@ -686,7 +686,7 @@ function convertFieldDefinition( if (!isProto3) { requiredness = optional ? 'optional' : 'required'; } else if (rule === 'required') { - // TODO: 处理 optional 的情况,需要修改 proto-parser + // TODO: Handle optional cases, need to modify proto-parser requiredness = 'required'; } diff --git a/frontend/infra/idl/idl2ts-cli/src/mock-dev.ts b/frontend/infra/idl/idl2ts-cli/src/mock-dev.ts index efc4e8e5..421cdf0e 100644 --- a/frontend/infra/idl/idl2ts-cli/src/mock-dev.ts +++ b/frontend/infra/idl/idl2ts-cli/src/mock-dev.ts @@ -25,7 +25,7 @@ function requiredWithoutCache(src, onError?) { // eslint-disable-next-line @typescript-eslint/no-require-imports const { Module } = require('module'); try { - // disable 了 require 的缓存,这样可以改变了 mock 数据后,无需重启服务。 + // Disable the required cache so that you can change the mock data without restarting the service. const originCache = Module._cache; Module._cache = {}; // eslint-disable-next-line security/detect-non-literal-require, @typescript-eslint/no-require-imports diff --git a/frontend/infra/idl/idl2ts-cli/src/plugins/filter-types-plugin.ts b/frontend/infra/idl/idl2ts-cli/src/plugins/filter-types-plugin.ts index e6081483..0fe19788 100644 --- a/frontend/infra/idl/idl2ts-cli/src/plugins/filter-types-plugin.ts +++ b/frontend/infra/idl/idl2ts-cli/src/plugins/filter-types-plugin.ts @@ -186,7 +186,7 @@ export class FilterTypesPlugin { } else if (isIdentifier(fieldType)) { const statement = getStatementById(fieldType, current); if (isEnumDefinition(statement)) { - // 强制转位 number + // Forced indexing number // @ts-expect-error fixme late fieldType.type = SyntaxType.I32Keyword; let namespace = current.unifyNamespace; diff --git a/frontend/infra/idl/idl2ts-cli/src/plugins/mock-plugin.ts b/frontend/infra/idl/idl2ts-cli/src/plugins/mock-plugin.ts index 53d6c901..0f2cbd97 100644 --- a/frontend/infra/idl/idl2ts-cli/src/plugins/mock-plugin.ts +++ b/frontend/infra/idl/idl2ts-cli/src/plugins/mock-plugin.ts @@ -55,15 +55,15 @@ export class MockPlugin implements IPlugin { if (context) { const { fieldDefinition } = context; const fieldName = fieldDefinition.name.value; - // 各类 ID + // various types of ID if (fieldName.toLocaleUpperCase().endsWith('ID')) { value = String(faker.number.int()); } - // email 处理 + // Email processing if (fieldName.includes('Email')) { value = `${faker.person.lastName()}@foo.com`; } - // 直接映射值 + // direct mapping value value = StrMapper[fieldName] || value; } ctx.output = t.stringLiteral(value); @@ -76,20 +76,20 @@ export class MockPlugin implements IPlugin { const { fieldDefinition } = context; const fieldName = fieldDefinition.name.value; const formatName = fieldName.toLocaleUpperCase(); - // 各类 ID + // various types of ID if (formatName.endsWith('ID')) { value = faker.number.int(); } - // 时间戳 + // timestamp if (formatName.endsWith('TIME') || formatName.includes('TIMESTAMP')) { value = dayjs(faker.date.anytime()).valueOf(); } - // 类型状态 + // type state if (formatName.endsWith('STATUS') || formatName.includes('TYPE')) { value = faker.number.int({ min: 0, max: 1 }); } - // 直接映射值 + // direct mapping value const mapVal = NumMapper[fieldName]; value = typeof mapVal !== 'undefined' ? mapVal : value; } diff --git a/frontend/infra/idl/idl2ts-cli/src/types.ts b/frontend/infra/idl/idl2ts-cli/src/types.ts index 4a05be7e..08a82849 100644 --- a/frontend/infra/idl/idl2ts-cli/src/types.ts +++ b/frontend/infra/idl/idl2ts-cli/src/types.ts @@ -17,27 +17,27 @@ import { type IPlugin } from '@coze-arch/idl2ts-generator'; export interface ApiConfig { - // idl 入口 + // IDL entrance entries: Record; - // idl 根目录 + // IDL root directory idlRoot: string; - // 服务别名 - // 自定义 api 方法 + // service alias + // Custom API method commonCodePath: string; - // api 产物目录 + // API Product Catalog output: string; - // 仓库信息设置 + // Warehouse information settings repository?: { - // 仓库地址 + // Warehouse address url: string; - // clone 到本地的位置 + // Clone to local location dest: string; }; - // 插件 + // plugin plugins?: IPlugin[]; - // 聚合导出的文件名 + // aggregate exported filename aggregationExport?: string; - // 格式化文件 + // Format file formatter: (name: string, content: string) => string; idlFetchConfig?: { source: string; @@ -48,6 +48,6 @@ export interface ApiConfig { } export interface ApiTypeConfig extends ApiConfig { - // 需要过滤的方法 + // Methods that require filtering filters: Record; } diff --git a/frontend/infra/idl/idl2ts-generator/src/core.ts b/frontend/infra/idl/idl2ts-generator/src/core.ts index 09de230d..188e80c2 100644 --- a/frontend/infra/idl/idl2ts-generator/src/core.ts +++ b/frontend/infra/idl/idl2ts-generator/src/core.ts @@ -163,7 +163,7 @@ export class ClientGenerator { private processIdlAst(ast: IParseResultItem) { try { - // 新的解析器貌似不是按原来位置排序的,这里要重新排序 + // The new parser doesn't seem to be sorted by the original position, so it needs to be reordered here. // eslint-disable-next-line @typescript-eslint/no-non-null-assertion ast.statements.sort((a, b) => a.loc!.start.line - b.loc!.start.line); } catch (error) { diff --git a/frontend/infra/idl/idl2ts-generator/src/plugin/adapter-plugin.ts b/frontend/infra/idl/idl2ts-generator/src/plugin/adapter-plugin.ts index 91c513be..2aeddf81 100644 --- a/frontend/infra/idl/idl2ts-generator/src/plugin/adapter-plugin.ts +++ b/frontend/infra/idl/idl2ts-generator/src/plugin/adapter-plugin.ts @@ -139,14 +139,14 @@ export class AdapterPlugin implements IPlugin { getAnnotation(f.annotations, 'api.converter') === 'atoi_comp_empty' ) { if (isInt(f.fieldType)) { - // 类型转换为 string + // Type conversion to string f.fieldType.type = SyntaxType.StringKeyword; } } - // api.converter 对 int 以及 map 类型生效 + // Api.converter works for int and map types if (getAnnotation(f.annotations, 'api.converter') === 'itoa') { if (isInt(f.fieldType)) { - // 类型转换为 string + // Type conversion to string f.fieldType.type = SyntaxType.StringKeyword; } if (isMapType(f.fieldType)) { @@ -156,7 +156,7 @@ export class AdapterPlugin implements IPlugin { } } } - // item_converter 对 list 类型生效 + // item_converter for list types if ( ['atoi_comp_empty', 'itoa'].includes( // eslint-disable-next-line @typescript-eslint/no-non-null-assertion @@ -168,24 +168,24 @@ export class AdapterPlugin implements IPlugin { } } - // 收集 decode encode 注解处理 + // Collection decoding encoding annotation processing if (getTypeFromDynamicJsonAnnotation(f.annotations)) { decodeEncodeFields.push(f.name.value); } - // api.json 注解处理 + // api.json annotation processing const jsonAnnotation = getAnnotation(f.annotations, 'api.json'); if (jsonAnnotation) { f.extensionConfig = f.extensionConfig || {}; f.extensionConfig.key = jsonAnnotation; } - // api.json_string 注解处理 + // API. json_string annotation handling const jsonStrAnnotation = getAnnotation( f.annotations, 'api.json_string', ); if (jsonStrAnnotation) { if (isInt(f.fieldType)) { - // 类型转换为 string + // Type conversion to string f.fieldType.type = SyntaxType.StringKeyword; f.extensionConfig = f.extensionConfig || {}; f.extensionConfig.key = jsonStrAnnotation; diff --git a/frontend/infra/idl/idl2ts-generator/src/plugin/client-plugin.ts b/frontend/infra/idl/idl2ts-generator/src/plugin/client-plugin.ts index 0d84f342..19352c4f 100644 --- a/frontend/infra/idl/idl2ts-generator/src/plugin/client-plugin.ts +++ b/frontend/infra/idl/idl2ts-generator/src/plugin/client-plugin.ts @@ -403,7 +403,7 @@ export class ClientPlugin implements IPlugin { }); const enumAst = t.tsEnumDeclaration(t.identifier(name.value), enumArr); - // 从后向前删除枚举项,避免索引变化影响 + // Delete enumeration items from back to front to avoid the impact of index changes enumItemIndexArray .sort((a, b) => b - a) .forEach(index => { diff --git a/frontend/infra/idl/idl2ts-generator/src/plugin/comment-format-plugin.ts b/frontend/infra/idl/idl2ts-generator/src/plugin/comment-format-plugin.ts index 47f403e2..487dc1f3 100644 --- a/frontend/infra/idl/idl2ts-generator/src/plugin/comment-format-plugin.ts +++ b/frontend/infra/idl/idl2ts-generator/src/plugin/comment-format-plugin.ts @@ -21,7 +21,7 @@ import { type Contexts, HOOK } from '../context'; const MAGIC_COMMENT_KEY = '\n*@magic-comment'; -// 忽略 struct 中的字段 +// Ignore fields in struct export class CommentFormatPlugin { apply(p: Program) { p.register(after('PARSE_ENTRY'), ctx => { diff --git a/frontend/infra/idl/idl2ts-generator/src/plugin/ignore-struct-field.ts b/frontend/infra/idl/idl2ts-generator/src/plugin/ignore-struct-field.ts index a92f0f80..83225775 100644 --- a/frontend/infra/idl/idl2ts-generator/src/plugin/ignore-struct-field.ts +++ b/frontend/infra/idl/idl2ts-generator/src/plugin/ignore-struct-field.ts @@ -26,7 +26,7 @@ interface IPops { filter: Filter; } -// 忽略 struct 中的字段 +// Ignore fields in struct export class IgnoreStructFiledPlugin { private filter: Filter; constructor({ filter }: IPops) { diff --git a/frontend/infra/idl/idl2ts-generator/src/plugin/meta-plugin.ts b/frontend/infra/idl/idl2ts-generator/src/plugin/meta-plugin.ts index 479e9f23..f84d1c08 100644 --- a/frontend/infra/idl/idl2ts-generator/src/plugin/meta-plugin.ts +++ b/frontend/infra/idl/idl2ts-generator/src/plugin/meta-plugin.ts @@ -56,7 +56,7 @@ export class MetaPlugin implements IPlugin { ctx => { const node = ctx.node as ServiceDefinition; node.functions.forEach(fun => { - // 过滤非泛化接口 + // Filtering non-generalized interfaces if (!fun.extensionConfig?.method) { return; } @@ -103,7 +103,7 @@ export class MetaPlugin implements IPlugin { schemaRoot: getSchemaRootByPath(ast.idlPath, this.options.idlRoot), service, } as IMeta; - // 不是 json 时,需要加上 serializer 标识 + // When not json, you need to add the serializer flag. if (extensionConfig?.serializer && extensionConfig?.serializer !== 'json') { res.serializer = extensionConfig?.serializer; } @@ -117,7 +117,7 @@ export class MetaPlugin implements IPlugin { if (isStructDefinition(statement)) { const wholeBody = statement.fields.find(isFullBody); if (wholeBody) { - // 处理 api.body="." 以及 api.full_body='' + // Handle api.body = "." and api.full_body = " return `${id.value}['${getFieldsAlias(wholeBody)}']`; } else { return id.value; @@ -184,7 +184,7 @@ export class MetaPlugin implements IPlugin { } }); } - // 如果没有指定,根据method默认指定为query 或者 body + // If not specified, it is specified as query or body by default according to method. if (!specificPositionFiled.has(alias)) { const filedMapping = mapping[defaultPosition]; mapping[defaultPosition] = filedMapping diff --git a/frontend/infra/idl/idl2ts-generator/src/plugin/mock-transformer.ts b/frontend/infra/idl/idl2ts-generator/src/plugin/mock-transformer.ts index 7d8f3c4e..8a9357be 100644 --- a/frontend/infra/idl/idl2ts-generator/src/plugin/mock-transformer.ts +++ b/frontend/infra/idl/idl2ts-generator/src/plugin/mock-transformer.ts @@ -110,7 +110,7 @@ export class MockTransformerPlugin implements IPlugin { nextOrder[name] = index; } }); - // 按照 mock 文件中的顺序优先排序 + // Prioritize in order in the mock file const getOrder = (name: string) => typeof mockVarOrder[name] !== 'undefined' ? mockVarOrder[name] @@ -210,7 +210,7 @@ export class MockTransformerPlugin implements IPlugin { if (isStructDefinition(statement)) { const wholeBody = statement.fields.find(isFullBody); if (wholeBody) { - // 处理 api.body="." + // Processing api.body = "." const { annotations } = wholeBody; if (hasDynamicJsonAnnotation(annotations)) { return '{}'; @@ -273,7 +273,7 @@ export class MockTransformerPlugin implements IPlugin { if (!fieldNames.has(fieldName)) { return; } - // 没有的,需要重新生成 + // No, it needs to be regenerated. newPros.push( t.objectProperty( fieldName.includes('-') @@ -351,11 +351,11 @@ export class MockTransformerPlugin implements IPlugin { const { valueType } = fieldType; output = t.arrayExpression([this.processValue(valueType)]); } else if (isSetType(fieldType)) { - // set 处理成array校验 + // Set to array validation const { valueType } = fieldType; output = t.arrayExpression([this.processValue(valueType)]); } else if (isIdentifier(fieldType)) { - // 引用类型 + // reference type const { refName, namespace } = parseIdFiledType(fieldType); if (!namespace) { output = t.callExpression(t.identifier(refName), []); @@ -375,7 +375,7 @@ export class MockTransformerPlugin implements IPlugin { throw new Error(`can not process fieldType : ${fieldType.type}`); } private processConst(constVal: ConstValue) { - // 暂时统一处理成0 + // Temporarily unified processing to 0 if (isStringLiteral(constVal)) { return t.stringLiteral(constVal.value); } @@ -410,11 +410,11 @@ export class MockTransformerPlugin implements IPlugin { const comment = { type: 'CommentLine', value: commentValues } as any; const target = this.findTarget(name.value, ctx); if (target) { - // 需要更新注释 + // Comments need to be updated // target.trailingComments = [comment]; return; } - // 枚举类型统一处理成常量 + // Enumeration types are uniformly processed into constants const builder = template(`var ${name.value}= () => %%value%% `); const node = builder({ value: t.numericLiteral(values[0] || 0), @@ -437,7 +437,7 @@ export class MockTransformerPlugin implements IPlugin { // const variableDeclaration = t.addComment( // , // 'leading', - // '暂时对const默认处理为0,如有需要请自行重新赋值' + // 'Temporarily, the default processing for const is 0, please reassign it yourself if necessary ' // ); return node; } diff --git a/frontend/infra/idl/idl2ts-generator/src/plugin/pkg-entry-plugin.ts b/frontend/infra/idl/idl2ts-generator/src/plugin/pkg-entry-plugin.ts index c227572e..f9b85254 100644 --- a/frontend/infra/idl/idl2ts-generator/src/plugin/pkg-entry-plugin.ts +++ b/frontend/infra/idl/idl2ts-generator/src/plugin/pkg-entry-plugin.ts @@ -29,7 +29,7 @@ import { type Options } from '../types'; import { type Contexts, HOOK } from '../context'; /** - * 提供统一 api 入口 + * Provide unified API entry */ export class PkgEntryPlugin implements IPlugin { private options: Options; @@ -52,7 +52,7 @@ export class PkgEntryPlugin implements IPlugin { ); this.funcs.set( relativePath, - // 只支持单 service + // Only single service supported meta[0].service, ); return ctx; diff --git a/frontend/infra/idl/idl2ts-generator/src/plugin/schema-plugin.ts b/frontend/infra/idl/idl2ts-generator/src/plugin/schema-plugin.ts index 0b02c7eb..b321a6c1 100644 --- a/frontend/infra/idl/idl2ts-generator/src/plugin/schema-plugin.ts +++ b/frontend/infra/idl/idl2ts-generator/src/plugin/schema-plugin.ts @@ -223,7 +223,7 @@ export class SchemaPlugin implements IPlugin { }; return schema; } else if (isSetType(fieldType)) { - // set 处理成array校验 + // Set to array validation const { valueType } = fieldType; const schema: ListType = { type: 'array', @@ -231,7 +231,7 @@ export class SchemaPlugin implements IPlugin { }; return schema; } else if (isIdentifier(fieldType)) { - // 引用类型 + // reference type const { refName, namespace } = parseIdFiledType(fieldType); if (!namespace) { const schema: RefType = { $ref: `#/definitions/${refName}` }; @@ -249,7 +249,7 @@ export class SchemaPlugin implements IPlugin { throw new Error(`can not process fieldType : ${fieldType.type}`); } private processConst(constVal: ConstValue) { - // 暂时统一处理成0 + // Temporarily unified processing to 0 const schema = {} as ConstType; if (isStringLiteral(constVal)) { schema.const = constVal.value; diff --git a/frontend/infra/idl/idl2ts-generator/src/types.ts b/frontend/infra/idl/idl2ts-generator/src/types.ts index 850657a7..48184b12 100644 --- a/frontend/infra/idl/idl2ts-generator/src/types.ts +++ b/frontend/infra/idl/idl2ts-generator/src/types.ts @@ -29,11 +29,11 @@ export interface Options { genMock: boolean; genClient: boolean; entryName?: string; - // createAPI 所在文件路径 + // createAPI file path commonCodePath?: string; - // decode encode 会丢失类型,这里提供一种方式,业务手动补充上对应的类型 + // Decoding encoding will lose the type, here provides a way to manually add the corresponding type patchTypesOutput?: string; - // patchTypesOutput 的别名,patch type 需要使用额外的 pkg 组织时需要提供 + // PatchTypesOutput alias, patch type needs to be provided when using additional pkg organization patchTypesAliasOutput?: string; } diff --git a/frontend/infra/idl/idl2ts-helper/src/ctx.ts b/frontend/infra/idl/idl2ts-helper/src/ctx.ts index 143e0ec5..469fa962 100644 --- a/frontend/infra/idl/idl2ts-helper/src/ctx.ts +++ b/frontend/infra/idl/idl2ts-helper/src/ctx.ts @@ -42,11 +42,11 @@ export interface IMeta { type Fields = string[]; export interface IHttpRpcMapping { - path?: Fields; // path参数 - query?: Fields; // query参数 - body?: Fields; // body 参数 - header?: Fields; // header 参数 - status_code?: Fields; // http状态码 + path?: Fields; // path parameter + query?: Fields; // query parameters + body?: Fields; // Body parameters + header?: Fields; // header parameter + status_code?: Fields; // HTTP status code cookie?: Fields; // cookie entire_body?: Fields; raw_body?: Fields; diff --git a/frontend/infra/idl/idl2ts-helper/src/helper.ts b/frontend/infra/idl/idl2ts-helper/src/helper.ts index b8e68cb4..3b730d5d 100644 --- a/frontend/infra/idl/idl2ts-helper/src/helper.ts +++ b/frontend/infra/idl/idl2ts-helper/src/helper.ts @@ -68,7 +68,7 @@ export function formatCode(code: string, root = '.') { printWidth: 120, singleQuote: true, }; - const file = path.resolve(process.cwd(), root, './for-prettier-bug'); // 这里一定要加多一级目录 + const file = path.resolve(process.cwd(), root, './for-prettier-bug'); // Be sure to add an extra level catalog here. const config = prettier.resolveConfig(file, { editorconfig: true }); return prettier.format(code, { ...(config || defaultConfig), @@ -166,7 +166,7 @@ export function parseId(id: string) { export function uniformNs(ns: string) { if (ReservedKeyWord.includes(ns)) { - // 命中保留字,处理为下划线开头 + // Hit the reserved word, treated as an underscore return `_${ns}`; } return ns.replace(/\./g, '_'); @@ -182,7 +182,7 @@ export function getValuesFromEnum(params: h.EnumDefinition) { if (h.isIntegerLiteral(initializer.value)) { currentVal = Number(initializer.value.value); } else if (h.isHexLiteral(initializer.value)) { - // 16进制 + // hexadecimal currentVal = Number(initializer.value.value); } enumArr.push(currentVal); @@ -322,8 +322,8 @@ export function hasDynamicJsonAnnotation(annotations?: h.Annotations) { } /** - * 从 api.(request|response).converter 中解析出前端与网关之间的真实类型, - * 能搞出这两个注解来,这个协议着实恶心😭 + * Parse the real type between the front end and the gateway from api. (request | response).converter. + * To be able to come up with these two annotations, this protocol is disgusting😭 * @param annotations * @returns */ diff --git a/frontend/infra/idl/idl2ts-plugin/src/program.ts b/frontend/infra/idl/idl2ts-plugin/src/program.ts index 70b2d6d1..ed77fa20 100644 --- a/frontend/infra/idl/idl2ts-plugin/src/program.ts +++ b/frontend/infra/idl/idl2ts-plugin/src/program.ts @@ -42,7 +42,7 @@ export class Program { } = {}; /** - * 加载插件 + * Load plugin * @param plugins */ loadPlugins(plugins: IPlugin[]) { @@ -51,10 +51,10 @@ export class Program { } } /** - * 注册钩子 - * @param event 事件名称 - * @param handler 钩子 - * @param priority 优先级,数值越小,优先级越高 + * registration hook + * @param event name + * @param handler hook + * @Param priority, the smaller the value, the higher the priority */ register< K extends keyof C, @@ -87,7 +87,7 @@ export class Program { } } /** - * 触发事件 + * trigger event * @param event * @param args * @returns diff --git a/frontend/infra/idl/idl2ts-runtime/src/create-api.ts b/frontend/infra/idl/idl2ts-runtime/src/create-api.ts index 72f21651..f69b8018 100644 --- a/frontend/infra/idl/idl2ts-runtime/src/create-api.ts +++ b/frontend/infra/idl/idl2ts-runtime/src/create-api.ts @@ -20,20 +20,20 @@ import type { IMeta, CustomAPIMeta } from './types'; export interface ApiLike { (req: T, option?: O extends object ? IOptions & O : IOptions): Promise; meta: IMeta; - /** fork 一份实例,该实例具有可中止请求的能力 */ + /** Fork an instance that has the ability to abort requests */ withAbort: () => CancelAbleApi; } export interface CancelAbleApi extends ApiLike { - // 中止请求 + // abort request abort: () => void; - // 是否是取消 + // Is it cancelled? isAborted: () => boolean; } /** - * 自定义构建 api 方法 + * Custom build API method * @param meta * @param cancelable * @param useCustom @@ -56,7 +56,7 @@ export function createAPI meta.reqMapping[key]) @@ -98,12 +98,12 @@ export function createAPI; } export interface IdlConfig { - // client 工厂方法,要求返回一个 fetchClient 函数,使用 meta 总的信息,可实现灵活的 client 配置 + // The client factory method requires a fetchClient function to be returned, which uses the meta total information to achieve flexible client configuration clientFactory?: ( meta: IMeta, ) => (uri: string, init: RequestInit, opt: any) => any; - // uri 前缀,如果 client 中设置了,这里可以不设置 + // URI prefix, if set in client, you can leave it unset here uriPrefix?: string; getParams?: (key: string) => string; - // 服务级别的配置 + // Service level configuration services?: ServiceConfig; - // 开发时,如果本地校验失败,这里可回调,通常是弹 toast + // During development, if the local verification fails, it can be called back here, usually by playing toast. onVerifyReqError?: (message: string, ctx: any) => void; } export interface IOptions { config?: IdlConfig; - // 透传 request options 的选项 + // Passthrough request options requestOptions?: Record; [key: string]: any; } @@ -52,7 +52,7 @@ export interface PathPrams { } export function getConfig(service: string, method: string): IdlConfig { - // 手动注册的配置优先级比全局变量高 + // Manually registered configuration takes precedence over global variables let config: IdlConfig | undefined = configCenter.getConfig(service); if (!config) { config = {}; @@ -137,7 +137,7 @@ export function normalizeRequest( ); const { uriPrefix = '', clientFactory } = config; if (!clientFactory) { - // todo 这里考虑给个默认的 client,防止某些公共 package 在一些异常情况下使用 + // Todo here considers giving a default client to prevent some public packages from being used in some abnormal cases throw new Error('Lack of clientFactory config'); } let uri = uriPrefix + apiUri; @@ -149,11 +149,11 @@ export function normalizeRequest( : 'application/json'; if (option?.requestOptions?.headers) { headers = { ...headers, ...option.requestOptions.headers }; - // 合并了 header,可删除 + // Merged headers, can be deleted delete option.requestOptions.headers; } if (meta.reqMapping.query && meta.reqMapping.query.length > 0) { - // 这里默认 skipNulls,网关后端需要忽略 null + // The default here is skipNulls, and the gateway backend needs to ignore null. uri = `${uri}?${qs.stringify(getValue(req, meta.reqMapping.query), { skipNulls: true, arrayFormat: 'comma', @@ -168,7 +168,7 @@ export function normalizeRequest( if (meta.reqMapping.entire_body && meta.reqMapping.entire_body.length > 0) { if (meta.reqMapping.entire_body.length === 1) { - // 默认处理为 json ,如有其他场景需要支持,后需要再支持 + // The default processing is json. If there are other scenarios that need to be supported, they need to be supported later. requestOption.body = req[meta.reqMapping.entire_body[0]]; } else { throw new Error('idl invalid entire_body should be only one filed'); @@ -203,7 +203,7 @@ export function normalizeRequest( }; } - // 旧版的 ferry 中,即使 idl 没有声明body,也需要加一个 空的 body + // In the old version of ferry, even if idl does not declare body, you need to add an empty body. if ( !requestOption.body && ['POST', 'PUT', 'PATCH'].includes( diff --git a/frontend/infra/plugins/pkg-root-webpack-plugin/__tests__/index.test.ts b/frontend/infra/plugins/pkg-root-webpack-plugin/__tests__/index.test.ts index 25fbfd1a..97117c02 100644 --- a/frontend/infra/plugins/pkg-root-webpack-plugin/__tests__/index.test.ts +++ b/frontend/infra/plugins/pkg-root-webpack-plugin/__tests__/index.test.ts @@ -89,17 +89,17 @@ describe('PkgRootWebpackPlugin', () => { new PkgRootWebpackPlugin(customOptions); - // 注意:Object.assign 中后面的对象会覆盖前面的对象,所以默认配置会覆盖用户配置 + // Note: Subsequent objects in Object.assign overwrite the preceding objects, so the default configuration overrides the user configuration expect(OriginPkgRootWebpackPlugin).toHaveBeenCalledWith({ customProp: 'customValue', - root: '@', // 被默认值覆盖 + root: '@', // Overwritten by default packagesDirs: [ 'packages/project1', 'packages/project2', 'apps/app1', 'apps/app2', ], - excludeFolders: [], // 被默认值覆盖 + excludeFolders: [], // Overwritten by default }); }); @@ -110,9 +110,9 @@ describe('PkgRootWebpackPlugin', () => { new PkgRootWebpackPlugin(customOptions); - // Object.assign 的行为:后面的对象会覆盖前面的对象属性 + // Object.assign behavior: subsequent objects overwrite previous object properties expect(OriginPkgRootWebpackPlugin).toHaveBeenCalledWith({ - root: '@', // 被默认值覆盖 + root: '@', // Overwritten by default packagesDirs: [ 'packages/project1', 'packages/project2', @@ -139,7 +139,7 @@ describe('PkgRootWebpackPlugin', () => { }); it('验证所有导出都正确', () => { - // 验证模块导出了正确的类和默认导出 + // Verify that the module exported the correct class and the default export expect(PkgRootWebpackPlugin).toBeDefined(); expect(typeof PkgRootWebpackPlugin).toBe('function'); }); @@ -147,7 +147,7 @@ describe('PkgRootWebpackPlugin', () => { it('应该正确处理 Rush 配置中的项目文件夹', () => { new PkgRootWebpackPlugin(); - // 验证传递给父类的 packagesDirs 包含所有项目文件夹 + // Verify that the packagesDirs passed to the parent class contain all project folders const call = (OriginPkgRootWebpackPlugin as any).mock.calls[0]; const options = call[0]; @@ -160,10 +160,10 @@ describe('PkgRootWebpackPlugin', () => { }); it('测试插件基本功能正常工作', () => { - // 这个测试验证插件能正常实例化并调用父类构造函数 + // This test verifies that the plugin can instantiate and call the parent class constructor normally new PkgRootWebpackPlugin(); - // 验证确实调用了父类构造函数 + // Verify that the parent class constructor is indeed called expect(OriginPkgRootWebpackPlugin).toHaveBeenCalled(); }); }); diff --git a/frontend/infra/plugins/pkg-root-webpack-plugin/lib/index.js b/frontend/infra/plugins/pkg-root-webpack-plugin/lib/index.js index c5e282ce..7953619e 100644 --- a/frontend/infra/plugins/pkg-root-webpack-plugin/lib/index.js +++ b/frontend/infra/plugins/pkg-root-webpack-plugin/lib/index.js @@ -38,7 +38,7 @@ class PkgRootWebpackPlugin extends pkg_root_webpack_plugin_origin_1.default { const mergedOptions = Object.assign({}, options || {}, { root: '@', packagesDirs: rushJsonPackagesDir, - // 排除apps/*,减少处理时间 + // Exclude apps/* to reduce processing time excludeFolders: [], }); super(mergedOptions); diff --git a/frontend/infra/plugins/pkg-root-webpack-plugin/src/index.ts b/frontend/infra/plugins/pkg-root-webpack-plugin/src/index.ts index 8e8ea94b..8497d3e2 100644 --- a/frontend/infra/plugins/pkg-root-webpack-plugin/src/index.ts +++ b/frontend/infra/plugins/pkg-root-webpack-plugin/src/index.ts @@ -41,7 +41,7 @@ class PkgRootWebpackPlugin extends OriginPkgRootWebpackPlugin { const mergedOptions = Object.assign({}, options || {}, { root: '@', packagesDirs: rushJsonPackagesDir, - // 排除apps/*,减少处理时间 + // Exclude apps/* to reduce processing time excludeFolders: [], }); super(mergedOptions); diff --git a/frontend/infra/utils/monorepo-kits/docs/llms.txt b/frontend/infra/utils/monorepo-kits/docs/llms.txt index 03dd944e..6842672c 100644 --- a/frontend/infra/utils/monorepo-kits/docs/llms.txt +++ b/frontend/infra/utils/monorepo-kits/docs/llms.txt @@ -1,79 +1,79 @@ # @coze-arch/monorepo-kits -## 功能概述 +/* Function Overview */ -`@coze-arch/monorepo-kits` 是一个用于管理 monorepo 项目的工具包,提供了基于 Rush 框架的项目查找、依赖分析和配置管理功能。 +/* "@Coze-arch/monorepo-kits" is a toolkit for managing monorepo projects, providing project lookup, dependency analysis, and configuration management capabilities based on the Rush framework. */ -## 主要功能模块 +/* Main Functional Modules */ -### 1. 子包管理 (sub-packages.ts) +/* ###1. Subpackage management (sub-packages.ts) */ #### lookupSubPackages(packageName: string): string[] -- **功能**: 递归查找指定包的所有子依赖包 -- **特性**: 使用缓存机制避免重复计算 -- **返回**: 所有依赖包的名称数组(去重后) +/* - ** Function **: Recursively find all child dependencies of the specified package */ +/* - ** Features **: Use caching mechanism to avoid double counting */ +/* - ** Returns **: Array of names of all dependent packages (after deduplicate) */ #### getPackageLocation(packageName: string): string -- **功能**: 获取指定包的文件系统路径 -- **返回**: 包的项目文件夹路径 +/* - ** Function **: Get the file system path of the specified package */ +/* - ** return **: the project folder path of the package */ #### getPackageJson(packageName: string): RushConfigurationProject['packageJson'] -- **功能**: 获取指定包的 package.json 配置信息 -- **返回**: 包的 package.json 对象 +/* - ** Function **: Get the package.json configuration information of the specified package */ +/* - ** returns **: package's package.json object */ -### 2. Rush 配置管理 (rush-config.ts) +/* ###2. Rush configuration management (rush-config.ts) */ #### getRushConfiguration(): RushConfiguration -- **功能**: 获取 Rush 配置实例 -- **特性**: 单例模式,首次调用时从默认位置加载配置,后续调用复用实例 -- **返回**: RushConfiguration 对象 +/* - ** Features **: Get Rush Configuration Instance */ +/* - ** Features **: Singleton mode, first call loads configuration from default location, subsequent calls reuse instance */ +/* - ** returns **: RushConfiguration object */ -### 3. 项目查找 (lookup.ts) +/* ###3. Project lookup (lookup.ts) */ #### lookupTo(to: string): string[] -- **功能**: 查找指定包的直接依赖项 -- **参数**: 目标包名称 -- **返回**: 依赖包名称数组 +/* - ** Features **: Find direct dependencies of a specified package */ +/* - ** Parameter **: Target package name */ +/* - ** Returns **: Array of dependency package names */ #### lookupFrom(from: string): void -- **功能**: 查找从指定包出发的相关信息(当前实现不完整) -- **参数**: 源包名称 +/* - ** Features **: Find information about outgoing from a specified package (current implementation is incomplete) */ +/* - ** parameter **: source package name */ #### lookupOnly(packageName: string): RushConfigurationProject -- **功能**: 查找并返回指定包的项目配置对象 -- **参数**: 包名称 -- **返回**: 完整的项目配置对象 +/* - ** Features **: Find and return the project configuration object of the specified package */ +/* - ** parameter **: package name */ +/* - ** Return **: complete project configuration object */ -## 依赖关系 +/* ##dependencies */ -- **主要依赖**: `@rushstack/rush-sdk@5.100.2` -- **开发依赖**: 包含 ESLint、TypeScript、Vitest 等工具链 +/* - ** Major dependencies **: '@rushstack/rush-sdk@5.100.2' */ +/* - ** Development dependencies **: Includes ESLint, TypeScript, Vitest and other toolchains */ -## 使用场景 +/* ##usage scenario */ -1. **依赖分析**: 分析 monorepo 中包之间的依赖关系 -2. **路径解析**: 获取包在文件系统中的实际位置 -3. **配置查询**: 查询包的配置信息和元数据 -4. **自动化工具**: 为构建脚本、部署工具等提供 monorepo 项目信息 +/* 1. ** Dependency Analysis **: Analyze the dependencies between packages in Monorepo */ +/* 2. ** Path parsing **: Get the actual location of the package in the file system */ +/* 3. ** Configuration query **: Query the configuration information and metadata of the package */ +/* 4. ** Automation Tools **: Provide monorepo project information for build scripts, deployment tools, etc */ -## 架构特点 +/* ##Architecture Features */ -- **缓存优化**: 对递归依赖查找进行缓存,提高性能 -- **错误处理**: 包含完善的包不存在异常处理 -- **单例模式**: Rush 配置采用单例模式,避免重复加载 -- **类型安全**: 基于 TypeScript,提供完整的类型定义 +/* - ** Cache optimization **: Cache recursive dependency lookups to improve performance */ +/* - ** Error Handling **: Includes perfect package without exception handling */ +/* - ** Singleton mode **: Rush configuration adopts singleton mode to avoid repeated loading */ +/* Type safety: Based on TypeScript, complete type definition is provided */ -## 代码结构 +/* ##Code structure */ ``` src/ -├── index.ts # 主入口文件,导出所有公共 API -├── sub-packages.ts # 子包管理和依赖查找功能 -├── rush-config.ts # Rush 配置管理 -└── lookup.ts # 项目查找相关功能 +/* < unk > ─ index.ts #Main entry file, export all public APIs */ +/* < unk > ─ Sub-packages.ts #Subpackage management and dependency lookup function */ +/* 🥰 ─ rush-config.ts #Rush configuration management */ +/* 🥰 ─ ─ lookup.ts #Project lookup related functions */ ``` -## API 导出 +/* ##API export */ ```typescript export { @@ -87,4 +87,4 @@ export { getRushConfiguration } from './rush-config'; export { lookupTo, lookupFrom, lookupOnly } from './lookup'; ``` -这个工具包为 monorepo 环境下的包管理、依赖分析和自动化工具开发提供了基础支持。 +/* This toolkit provides fundamental support for package management, dependency analysis, and automated tool development in Monorepo environments. */ diff --git a/frontend/infra/utils/rush-logger/src/index.ts b/frontend/infra/utils/rush-logger/src/index.ts index 15ab9521..e657ec62 100644 --- a/frontend/infra/utils/rush-logger/src/index.ts +++ b/frontend/infra/utils/rush-logger/src/index.ts @@ -80,5 +80,5 @@ const logger = new Logger(); export { logger }; -/** @deprecated 该使用方式已废弃,请使用`import { logger } from '@coze-arch/rush-logger' */ +/** @Deprecated This usage is deprecated, please use'import {logger} from '@code-arch/rush-logger' */ export default logger; diff --git a/frontend/packages/agent-ide/agent-publish/src/components/bot-publish/hooks/use-auth-fail.ts b/frontend/packages/agent-ide/agent-publish/src/components/bot-publish/hooks/use-auth-fail.ts index f73dc861..d5a37574 100644 --- a/frontend/packages/agent-ide/agent-publish/src/components/bot-publish/hooks/use-auth-fail.ts +++ b/frontend/packages/agent-ide/agent-publish/src/components/bot-publish/hooks/use-auth-fail.ts @@ -22,7 +22,7 @@ import { I18n } from '@coze-arch/i18n'; import { UIModal } from '@coze-arch/bot-semi'; import { useResetLocationState } from '@coze-arch/bot-hooks'; -// 三方授权失败,callback至发布页需要显式阻塞弹窗 +// Tripartite authorization failed, callback to the release page needs to explicitly block the pop-up window export const useAuthFail = () => { const { state } = useLocation(); const { authFailMessage = '', authStatus } = (state ?? diff --git a/frontend/packages/agent-ide/agent-publish/src/components/bot-publish/hooks/use-get-bot-info.ts b/frontend/packages/agent-ide/agent-publish/src/components/bot-publish/hooks/use-get-bot-info.ts index eebd3584..285f9bef 100644 --- a/frontend/packages/agent-ide/agent-publish/src/components/bot-publish/hooks/use-get-bot-info.ts +++ b/frontend/packages/agent-ide/agent-publish/src/components/bot-publish/hooks/use-get-bot-info.ts @@ -41,7 +41,7 @@ const DEFAULT_BOT_INFO: PublisherBotInfo = { prompt: '', }; -// 获取plugin收费插件信息 +// Get plugin charging plugin information const getPricingRules: ( pluginApiDetailMap?: Record, ) => Promise = async pluginApiDetailMap => { @@ -58,7 +58,7 @@ const getPricingRules: ( return pricing_rules; }; -// 是否有plugin +// Is there a plugin? const hasPluginApi: ( pluginApiDetailMap?: Record, ) => boolean = pluginApiDetailMap => @@ -113,7 +113,7 @@ export const useGetPublisherInitInfo: () => { bot_option_data, } = botInfoResp?.data ?? {}; - // 获取plugin扣费信息 + // Get plugin deduction information let pluginPricingRules: Array = []; if ( hasPluginApi(bot_option_data?.plugin_api_detail_map) && diff --git a/frontend/packages/agent-ide/agent-publish/src/components/bot-publish/index.tsx b/frontend/packages/agent-ide/agent-publish/src/components/bot-publish/index.tsx index 5fcec6b9..55139b6b 100644 --- a/frontend/packages/agent-ide/agent-publish/src/components/bot-publish/index.tsx +++ b/frontend/packages/agent-ide/agent-publish/src/components/bot-publish/index.tsx @@ -126,7 +126,7 @@ export const AgentPublishPage = () => { const publishBtn = (