i18-fe-automator-beta 2.0.5 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2134,7 +2134,7 @@ async function lint$1(patterns, fix, rule, hook = {}) {
2134
2134
  .then(({ isTransKey }) => {
2135
2135
  if (isTransKey) {
2136
2136
  console.log(chalk.green(`开始准备翻译...`));
2137
- process$1.execSync(`fe-it-beta --fix -i ${patterns} `, {
2137
+ process$1.execSync(`fe-it-beta --fix -i "${patterns}" `, {
2138
2138
  stdio: "inherit", // 打印子进程的输出到父进程
2139
2139
  });
2140
2140
  }
@@ -2590,15 +2590,24 @@ if (sass) {
2590
2590
 
2591
2591
  function translateUtil(appid, key, projectName, isLintFix) {
2592
2592
  const { input } = commander.program.opts();
2593
- const normalizedInput = input.replace(/\\/g, "/");
2594
- let src = [normalizedInput];
2595
- const isSrcDirectory = fs.statSync(input).isDirectory();
2596
- if (isSrcDirectory) {
2597
- const directory = normalizedInput + "/**/*.{js,vue,jsx,ts,tsx}";
2598
- src = glob.glob.sync(directory, {
2599
- ignore: directory + `/**/node_modules/**`,
2600
- });
2601
- }
2593
+ // 支持逗号分隔的多个路径(来自 -lint git 的多文件场景)
2594
+ const inputPaths = String(input)
2595
+ .split(",")
2596
+ .map((s) => s.trim())
2597
+ .filter(Boolean);
2598
+ let src = [];
2599
+ inputPaths.forEach((inputPath) => {
2600
+ const normalizedInput = inputPath.replace(/\\/g, "/");
2601
+ if (fs.statSync(inputPath).isDirectory()) {
2602
+ const directory = normalizedInput + "/**/*.{js,vue,jsx,ts,tsx}";
2603
+ const files = glob.glob.sync(directory, {
2604
+ ignore: directory + `/**/node_modules/**`,
2605
+ });
2606
+ src = src.concat(files);
2607
+ } else {
2608
+ src.push(normalizedInput);
2609
+ }
2610
+ });
2602
2611
  let allArr = []; // 所有文本组成的数组
2603
2612
  let groupArr = []; // 分组后的数组
2604
2613
  let newAllArr = []; // 分组后的数组还原成所有数组
@@ -2112,7 +2112,7 @@ async function lint$1(patterns, fix, rule, hook = {}) {
2112
2112
  .then(({ isTransKey }) => {
2113
2113
  if (isTransKey) {
2114
2114
  console.log(chalk.green(`开始准备翻译...`));
2115
- process$1.execSync(`fe-it-beta --fix -i ${patterns} `, {
2115
+ process$1.execSync(`fe-it-beta --fix -i "${patterns}" `, {
2116
2116
  stdio: "inherit", // 打印子进程的输出到父进程
2117
2117
  });
2118
2118
  }
@@ -2568,15 +2568,24 @@ if (sass) {
2568
2568
 
2569
2569
  function translateUtil(appid, key, projectName, isLintFix) {
2570
2570
  const { input } = program.opts();
2571
- const normalizedInput = input.replace(/\\/g, "/");
2572
- let src = [normalizedInput];
2573
- const isSrcDirectory = fs.statSync(input).isDirectory();
2574
- if (isSrcDirectory) {
2575
- const directory = normalizedInput + "/**/*.{js,vue,jsx,ts,tsx}";
2576
- src = glob.sync(directory, {
2577
- ignore: directory + `/**/node_modules/**`,
2578
- });
2579
- }
2571
+ // 支持逗号分隔的多个路径(来自 -lint git 的多文件场景)
2572
+ const inputPaths = String(input)
2573
+ .split(",")
2574
+ .map((s) => s.trim())
2575
+ .filter(Boolean);
2576
+ let src = [];
2577
+ inputPaths.forEach((inputPath) => {
2578
+ const normalizedInput = inputPath.replace(/\\/g, "/");
2579
+ if (fs.statSync(inputPath).isDirectory()) {
2580
+ const directory = normalizedInput + "/**/*.{js,vue,jsx,ts,tsx}";
2581
+ const files = glob.sync(directory, {
2582
+ ignore: directory + `/**/node_modules/**`,
2583
+ });
2584
+ src = src.concat(files);
2585
+ } else {
2586
+ src.push(normalizedInput);
2587
+ }
2588
+ });
2580
2589
  let allArr = []; // 所有文本组成的数组
2581
2590
  let groupArr = []; // 分组后的数组
2582
2591
  let newAllArr = []; // 分组后的数组还原成所有数组
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18-fe-automator-beta",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "i18-fe-automator-beta内测版本,只用于key: ''替换、检测中文规则等",
5
5
  "type": "module",
6
6
  "bin": {