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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user