chore: replace all cn comments of fe to en version by volc api (#320)

This commit is contained in:
tecvan
2025-07-31 10:32:15 +08:00
committed by GitHub
parent 716ec0cba8
commit 71f6245a01
2960 changed files with 15545 additions and 15545 deletions

View File

@@ -39,7 +39,7 @@ const updateDTS = ({
envVarName,
outputFileName,
}: TUpdateDTSParams) => {
// 初始化一个 ts-morph 项目
// Initialize a ts-morph project
const project = new Project({
compilerOptions: {
incremental: true,
@@ -49,20 +49,20 @@ const updateDTS = ({
noEmitOnError: true,
},
});
// 添加想要解析的文件
// Add the file you want to parse
const file = project.addSourceFileAtPath(inputFileName);
// 获取你想要解析的变量
// Get the variable you want to parse
const envs = file.getVariableDeclarationOrThrow(envVarName);
// 获取 envs 变量的初始值
// Get the initial value of the envs variable
const initializer = envs.getInitializerIfKindOrThrow(
SyntaxKind.ObjectLiteralExpression,
);
// 获取 envs 对象的属性
// Get the properties of the envs object
const properties = initializer.getProperties();
const baseDir = path.resolve(__dirname, '../');
// 创建一个新的文件,用来保存生成的类型定义
// Create a new file to hold the generated type definition
const typeDefs = project.createSourceFile(
outputFileName,
`/*
@@ -82,7 +82,7 @@ const updateDTS = ({
*/
/* eslint-disable */
/* prettier-ignore */
// 基于${path.relative(baseDir, inputFileName)}自动生成,请勿手动修改`,
// Automatically generated based on ${path.relative(baseDir, inputFileName)}, do not modify manually `,
{
overwrite: true,
},
@@ -97,7 +97,7 @@ const updateDTS = ({
});
};
// 遍历每一个属性
// Iterate through each attribute
properties.forEach(property => {
if (
property instanceof PropertyAssignment ||
@@ -109,9 +109,9 @@ const updateDTS = ({
const type = expression.getType();
if (type.isObject()) {
// 如果类型是一个对象类型,获取其属性
// If the type is an object type, obtain its properties
const spreadProperties = type.getProperties();
// 遍历属性
// traversal properties
for (const spreadProperty of spreadProperties) {
const declaration = spreadProperty.getDeclarations()?.[0];
if (declaration) {
@@ -129,7 +129,7 @@ const updateDTS = ({
}
}
});
// 保存文件
// Save file
typeDefs.addVariableStatements(
declarations
.sort((a, b) => (a.name > b.name ? 1 : -1))

View File

@@ -29,21 +29,21 @@ const processEnvs = {
REGION: (process.env.REGION || 'cn') as 'cn' | 'sg' | 'va',
NODE_ENV: process.env.NODE_ENV as 'production' | 'development' | 'test',
CDN_PATH_PREFIX: (process.env.CDN_PATH_PREFIX ?? '/') as string,
// vmok 生产者使用,用来将生产者的 sourcemap 文件上传至对应的消费者版本下面
// Used by vmok producers to upload the producer's sourcemap file to the corresponding consumer version
CONSUMER_BUILD_VERSION: (process.env.CONSUMER_BUILD_VERSION ?? '') as string,
};
const IS_OVERSEA = Boolean(process.env.REGION) && process.env.REGION !== 'cn';
const IS_CN_REGION = process.env.REGION === 'cn';
const IS_VA_REGION = process.env.REGION === 'va';
const IS_RELEASE_VERSION = processEnvs.CUSTOM_VERSION === 'release'; // 为 ture 表示对外版本
const IS_RELEASE_VERSION = processEnvs.CUSTOM_VERSION === 'release'; // Show external version for ture
const IS_OVERSEA_RELEASE = IS_OVERSEA && IS_RELEASE_VERSION;
const IS_PROD =
processEnvs.BUILD_TYPE === 'online' ||
process.env.CUSTOM_BUILD_TYPE === 'online'; // 是否是线上
process.env.CUSTOM_BUILD_TYPE === 'online'; // Is it online?
const IS_BOE = processEnvs.BUILD_TYPE === 'offline';
const IS_DEV_MODE = processEnvs.NODE_ENV === 'development'; // 本地开发
const IS_BOT_OP = false; // 是否是 bot 运营平台,默认都是 false从运营平台构建会设置成 true
const IS_DEV_MODE = processEnvs.NODE_ENV === 'development'; // local development
const IS_BOT_OP = false; // Whether it is a bot operation platform, the default is false, and the build from the operation platform will be set to true.
const IS_OPEN_SOURCE = (process.env.IS_OPEN_SOURCE ?? 'false') === 'true';
const judgements = {
@@ -74,14 +74,14 @@ const getCDN = () => {
}
}
if (IS_RELEASE_VERSION && processEnvs.BUILD_TYPE === 'online') {
// 海外正式版使用独立业务线
// Overseas official version uses independent business lines
return getOuterCDN();
} else {
return getInnerCDN();
}
};
/** 对应CDN资源上传平台上的CDN地址 */
/** Corresponding to the CDN address on the CDN resource upload platform */
const getUploadCDN = () => {
const uploadCDNPrefixes = {
UPLOAD_CDN_CN: '',
@@ -101,7 +101,7 @@ export const base = {
...processEnvs,
...judgements,
CDN: getCDN(),
// release 环境下外部静态域名
// External static domain name in the release environment
OUTER_CDN: getOuterCDN(),
...getUploadCDN(),
};

View File

@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable max-lines -- 待拆分 */
/* eslint-disable max-lines -- to be split */
import { extractEnvValue } from './utils/config-helper';
import { volcanoConfigs } from './configs/volcano';
@@ -98,9 +98,9 @@ const SEC_SDK_ASSERT_URL = extractEnvValue<string | null>({
release: null,
},
sg: {
// 非 release 环境使用默认内网公用 SCM tos 无上传权限,也无脱敏需要,直接使用风控提供的 tos 地址
// The non-release environment uses the default intranet public SCM, tos has no upload permission and no desensitization need. Directly use the tos address provided by risk control
inhouse: '',
// release 上传至独立 SCM CDN
// Release and upload to the independent SCM CDN
release: '',
},
va: {
@@ -239,7 +239,7 @@ const BYTE_UPLOADER_REGION = extractEnvValue<
| 'gcp'
>({
cn: {
// TODO 确认下这里
// TODO confirm here.
boe: 'boe',
inhouse: 'cn-north-1',
release: 'cn-north-1',
@@ -255,7 +255,7 @@ const BYTE_UPLOADER_REGION = extractEnvValue<
const IMAGE_FALLBACK_HOST = extractEnvValue<string>({
cn: {
// TODO 确认下这里
// TODO confirm here.
boe: '',
inhouse: '',
release: '',
@@ -299,7 +299,7 @@ const GOOGLE_PLATFORM_ID = extractEnvValue<null | number>({
},
});
// 曾经计划 facebook 登录 然后需求变动后没有了
// I used to plan to log in to Facebook, but after the requirements changed, it was gone.
const FACEBOOK_APP_ID = extractEnvValue<null | string>({
cn: {
boe: null,

View File

@@ -17,7 +17,7 @@
import { base } from './base';
const { IS_RELEASE_VERSION, IS_OVERSEA, IS_BOE } = base;
export const features = {
// 与志强&产品沟通后下掉boe环境的sso
// After communicating with Zhiqiang & products, remove the sso of boe environment.
FEATURE_ENABLE_SSO: !IS_RELEASE_VERSION && !IS_BOE,
FEATURE_ENABLE_APP_GUIDE: !IS_RELEASE_VERSION || IS_OVERSEA,
FEATURE_ENABLE_FEEDBACK_MAILTO: IS_RELEASE_VERSION,
@@ -27,47 +27,47 @@ export const features = {
// FEATURE_ENABLE_RUYI_CARD: false,
FEATURE_ENABLE_VARIABLE: false,
/**
* 是否开启新的注销流程目前只有cn开启
* Whether to start a new cancellation process? Currently only cn is open.
*/
FEATURE_ENABLE_NEW_DELETE_ACCOUNT: !IS_OVERSEA,
FEATURE_AWEME_LOGIN: !IS_OVERSEA,
FEATURE_GOOGLE_LOGIN: IS_OVERSEA,
/**
* @description 只在boe环境和inhouse-cn环境支持 workflow code 节点编辑 python 代码
* @Description Only supports workflow code node editing python code in boe environment and inhouse-cn environment
*/
FEATURE_ENABLE_CODE_PYTHON: !IS_OVERSEA && !IS_RELEASE_VERSION,
/**
* 暂时隐藏banner后续可能用于运营位置
* Temporarily hide the banner, it may be used later to operate the location
*/
FEATURE_ENABLE_BANNER: false,
/**
* Database tooltip示例区分图海外和国内
* Database tooltip example distinguishes between overseas and domestic
*/
FEATURE_ENABLE_DATABASE_TABLE: !IS_OVERSEA,
/**
* bot市场中国区入口
* Bot Market China Entrance
*/
FEATURE_ENABLE_BOT_STORE: true,
/**
* workflow llm 计费只在海外或者 in-house 显示
* Workflow llm billing is only displayed overseas or in-house.
*/
FEATURE_ENABLE_WORKFLOW_LLM_PAYMENT: IS_OVERSEA || !IS_RELEASE_VERSION,
/**
* 豆包 cici 特殊需求,只在inhouse上线
* Bean bag cici special needs, only online in inhouse
*/
FEATURE_ENABLE_QUERY_ENTRY: !IS_RELEASE_VERSION,
/**
* coze接入审核增加用于发布机审弹窗提前、版本历史Publish类审核结果展示。目前仅CN生效。
* Coze access audit has been added, which is used for the advance of the publishing machine audit pop-up window and the display of the version history Publishing audit results. Currently only CN is effective.
*/
FEATURE_ENABLE_TCS: !IS_OVERSEA,
/**
* Tea 上报数据增加 UG 线索回传参数,仅 cn release 需要
* Add UG clue return parameters to the data reported by Tea, which is only required for cn release.
*
*/
FEATURE_ENABLE_TEA_UG: IS_RELEASE_VERSION && !IS_OVERSEA,

View File

@@ -15,7 +15,7 @@
*/
/* eslint-disable */
/* prettier-ignore */
// 基于src/index.ts自动生成请勿手动修改
// Automatically generated based on src/index.ts, do not modify manually
declare const APP_ID: number;
declare const APP_KEY: string;
declare const AWEME_ORIGIN: string;
@@ -108,3 +108,4 @@ declare const VOLCANO_PLATFORM_APP_KEY: string | null;
declare const VOLCANO_PLATFORM_ID: number | null;
declare const VOLC_PRIVATE_POLICY: string;
declare const VOLC_TERMS_OF_SERVICE: string;

View File

@@ -17,26 +17,26 @@
import { execSync } from 'child_process';
/**
* 获取当前 git 分支名称
* @returns 当前分支名称,如果不在 git 仓库中或发生错误则返回 undefined
* Get the current git branch name
* @Returns the current branch name, or undefined if not in the git repository or an error occurs
*/
export function getCurrentBranch(): string | undefined {
try {
// 使用 git rev-parse 获取当前分支名
// --abbrev-ref 参数返回分支名而不是 commit hash
// HEAD 表示当前位置
// Use git rev-parse to get the current branch name
// --Abbrev-ref parameter returns branch name instead of commit hash
// HEAD represents the current location
const branch = execSync('git rev-parse --abbrev-ref HEAD', {
encoding: 'utf-8',
}).trim();
// 如果在 detached HEAD 状态,返回 undefined
// If in the detached HEAD state, return undefined
if (branch === 'HEAD') {
return undefined;
}
return branch;
} catch (error) {
// 如果执行出错(比如不在 git 仓库中),返回 undefined
// If there is an execution error (e.g. not in the git repository), return undefined.
return '';
}
}