chore: turn cn comment to en for common space (#376)
This commit is contained in:
@@ -33,7 +33,7 @@ export default class SelectTeamPlugin implements IPlugin {
|
||||
apply(hooks: IHooks): void {
|
||||
hooks.prompts.tap("SelectTeamPlugin", (prompts: IPromptsHookParams) => {
|
||||
|
||||
// 只留下以team-为前缀的
|
||||
// Leave only the prefix team-
|
||||
const teamNamePrefix = /^team-/;
|
||||
const choices = rushJson.allowedProjectTags.filter(
|
||||
teamName => teamNamePrefix.test(teamName)
|
||||
@@ -41,20 +41,20 @@ export default class SelectTeamPlugin implements IPlugin {
|
||||
teamName => teamName.replace(teamNamePrefix, '')
|
||||
);
|
||||
|
||||
// unshift一个问题,使得用户选择完模版后展示该问题。
|
||||
// Unshift an issue, causing the user to display the issue after selecting a template.
|
||||
prompts.promptQueue.unshift({
|
||||
type: "list",
|
||||
name: "team",
|
||||
message: "Select your team",
|
||||
choices,
|
||||
default: 0, // 默认选择choices[0]
|
||||
default: 0, // Default choices [0]
|
||||
});
|
||||
|
||||
const projectFolderPrompt = prompts.promptQueue.find(
|
||||
item => item.name === 'projectFolder'
|
||||
);
|
||||
projectFolderPrompt.default = (answers) => {
|
||||
// 文件夹名去除scope,如 @coze-arch/foo -> foo
|
||||
// Remove the scope from the folder name, such as @code-arch/foo - > foo
|
||||
const folderDir = answers.packageName.split('/').slice(-1)[0];
|
||||
return `frontend/packages/${answers.team}/${folderDir}`;
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ import type {
|
||||
IPromptsHookParams,
|
||||
} from 'rush-init-project-plugin';
|
||||
// FIXME:
|
||||
// 按照 https://github.com/bytemate/rush-plugins/blob/main/rush-plugins/rush-init-project-plugin/docs/init_project_configuration.md
|
||||
// 一文的指引,无法正确 resolve 到对应模块,暂时没找到解决方案,故此处先用相对路径引用
|
||||
// 未来需要调整为正常的 node_modules 引用方式
|
||||
// According to https://github.com/bytemate/rush-plugins/blob/main/rush-plugins/rush-init-project-plugin/docs/init_project_configuration.md
|
||||
// The guidelines of this article cannot be correctly resolved to the corresponding module, and a solution has not been found for the time being, so the relative path reference is used here first
|
||||
// Future needs to be adjusted to normal node_modules citation
|
||||
import { createLog } from '../../autoinstallers/plugins/node_modules/rush-init-project-plugin';
|
||||
import { exec } from './utils';
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ import type {
|
||||
IPromptsHookParams,
|
||||
} from 'rush-init-project-plugin';
|
||||
// FIXME:
|
||||
// 按照 https://github.com/bytemate/rush-plugins/blob/main/rush-plugins/rush-init-project-plugin/docs/init_project_configuration.md
|
||||
// 一文的指引,无法正确 resolve 到对应模块,暂时没找到解决方案,故此处先用相对路径引用
|
||||
// 未来需要调整为正常的 node_modules 引用方式
|
||||
// According to https://github.com/bytemate/rush-plugins/blob/main/rush-plugins/rush-init-project-plugin/docs/init_project_configuration.md
|
||||
// The guidelines of this article cannot be correctly resolved to the corresponding module, and a solution has not been found for the time being, so the relative path reference is used here first
|
||||
// Future needs to be adjusted to normal node_modules citation
|
||||
import {
|
||||
getTemplatesFolder,
|
||||
getTemplateNameList,
|
||||
|
||||
@@ -21,18 +21,18 @@ export function parseCommandLineArguments() {
|
||||
const args = process.argv.slice(2);
|
||||
const result: Record<string, string> = {};
|
||||
|
||||
// 循环遍历所有参数
|
||||
// Loop through all parameters
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
// 检查当前参数是否是一个选项(以 "--" 开头)
|
||||
// Check if the current argument is an option (starting with "--").
|
||||
if (args[i].startsWith('--')) {
|
||||
const key = args[i].substring(2); // 移除 "--" 前缀
|
||||
const key = args[i].substring(2); // Remove the "--" prefix
|
||||
|
||||
// 检查下一个参数是否存在,且不是另一个选项
|
||||
// Check if the next argument exists and is not another option
|
||||
if (i + 1 < args.length && !args[i + 1].startsWith('--')) {
|
||||
result[key] = args[i + 1]; // 将下一个参数作为当前选项的值
|
||||
i++; // 跳过下一个参数,因为它已经被处理为当前选项的值
|
||||
result[key] = args[i + 1]; // Set the next argument as the value of the current option
|
||||
i++; // Skip the next argument because it has already been processed to the value of the current option
|
||||
} else {
|
||||
result[key] = ''; // 如果没有值,只设置选项的键
|
||||
result[key] = ''; // If there is no value, only set the key of the option
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ export function DemoComponent(props: { name: string }): JSX.Element {
|
||||
const [foo] = useState('hello world');
|
||||
const { name } = props;
|
||||
return (
|
||||
// font-bold 来自 taiwindcss
|
||||
// 建议优先使用 taiwindcss
|
||||
// Font-bold from taiwindcss
|
||||
// It is recommended to use taiwindcss first.
|
||||
<div className={classNames(s.foo, 'font-bold')}>
|
||||
{foo} {name}!
|
||||
<div>
|
||||
|
||||
4
common/_templates/rspack-web/env/index.ts
vendored
4
common/_templates/rspack-web/env/index.ts
vendored
@@ -16,8 +16,8 @@
|
||||
|
||||
const { NODE_ENV } = process.env;
|
||||
|
||||
const IS_DEV_MODE = NODE_ENV === 'development'; // 本地环境
|
||||
const IS_PRODUCT_MODE = NODE_ENV === 'production'; // 生产环境
|
||||
const IS_DEV_MODE = NODE_ENV === 'development'; // local environment
|
||||
const IS_PRODUCT_MODE = NODE_ENV === 'production'; // production environment
|
||||
|
||||
const IS_CI = process.env.CI === 'true';
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ export const updateDTS = (
|
||||
) => {
|
||||
const start = Date.now();
|
||||
|
||||
// 初始化一个 ts-morph 项目
|
||||
// Initialize a ts-morph project
|
||||
const project = new Project({
|
||||
compilerOptions: {
|
||||
incremental: true,
|
||||
@@ -51,19 +51,19 @@ export 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();
|
||||
|
||||
// 创建一个新的文件,用来保存生成的类型定义
|
||||
// Create a new file to hold the generated type definition
|
||||
const typeDefs = project.createSourceFile(
|
||||
outputFileName,
|
||||
`// 基于${inputFileName}自动生成,请勿手动修改`,
|
||||
@@ -81,7 +81,7 @@ export const updateDTS = (
|
||||
});
|
||||
};
|
||||
|
||||
// 遍历每一个属性
|
||||
// Iterate through each attribute
|
||||
properties.forEach(property => {
|
||||
if (
|
||||
property instanceof PropertyAssignment ||
|
||||
@@ -93,9 +93,9 @@ export 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) {
|
||||
@@ -113,7 +113,7 @@ export const updateDTS = (
|
||||
}
|
||||
}
|
||||
});
|
||||
// 保存文件
|
||||
// Save file
|
||||
typeDefs.addVariableStatements(
|
||||
declarations
|
||||
.sort((a, b) => (a.name > b.name ? 1 : -1))
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import { RouterProvider } from 'react-router-dom';
|
||||
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import browserClient from '@slardar/web'; // 默认引入的是CN地区的
|
||||
import browserClient from '@slardar/web'; // The default introduction is the CN region
|
||||
import { reporter } from '@coze-arch/logger';
|
||||
|
||||
import { router } from '@/router';
|
||||
|
||||
@@ -29,6 +29,6 @@ export const createUserInfoSlice: StateCreator<
|
||||
> = set => ({
|
||||
userInfo: '',
|
||||
iniUserInfo: () => {
|
||||
// TODO: 用户信息相关方法获取
|
||||
// TODO: User information related methods
|
||||
},
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// 基于env/index.ts自动生成,请勿手动修改
|
||||
// Automatically generated based on env/index.ts, do not modify manually
|
||||
declare const IS_CI: boolean;
|
||||
declare const IS_DEV_MODE: boolean;
|
||||
declare const IS_PRODUCT_MODE: boolean;
|
||||
|
||||
@@ -27,8 +27,8 @@ export function DemoComponent(props: { name: string }): JSX.Element {
|
||||
const [foo] = useState('hello world');
|
||||
const { name } = props;
|
||||
return (
|
||||
// font-bold 来自 taiwindcss
|
||||
// 建议优先使用 taiwindcss
|
||||
// Font-bold from taiwindcss
|
||||
// It is recommended to use taiwindcss first.
|
||||
<div className={classNames(s.foo, 'font-bold')}>
|
||||
{foo} {name}!
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user