@apdesign/code-style-react 1.2.0 → 1.2.2
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.
- package/package.json +1 -1
- package/scripts/runEslint.js +9 -4
package/package.json
CHANGED
package/scripts/runEslint.js
CHANGED
@@ -37,7 +37,8 @@ async function runEslint(targetPathArg) {
|
|
37
37
|
// targetPath 是第一个不是 --branch 的参数
|
38
38
|
let targetPath = process.cwd();
|
39
39
|
for (let i = 0; i < args.length; i++) {
|
40
|
-
|
40
|
+
// 仅当确实存在 --branch 参数时才跳过它和它的值
|
41
|
+
if (branchIndex !== -1 && (i === branchIndex || i === branchIndex + 1)) continue;
|
41
42
|
targetPath = args[i] || targetPath;
|
42
43
|
break;
|
43
44
|
}
|
@@ -76,8 +77,11 @@ async function runEslint(targetPathArg) {
|
|
76
77
|
|
77
78
|
let targetBranch = 'master';
|
78
79
|
if (targetPath !== process.cwd()) {
|
79
|
-
const
|
80
|
-
|
80
|
+
const pkgName = path.basename(targetPath); // 直接取传入的目录名
|
81
|
+
if (pkgName && pkgName.includes('-')) {
|
82
|
+
const suffix = pkgName.split('-').pop();
|
83
|
+
targetBranch = `master-${suffix}`;
|
84
|
+
}
|
81
85
|
}
|
82
86
|
|
83
87
|
// 获取当前分支
|
@@ -143,7 +147,8 @@ async function runEslint(targetPathArg) {
|
|
143
147
|
const srcPath = path.join(rootDir, 'src');
|
144
148
|
const eslintTarget = fs.existsSync(srcPath) ? srcPath : '.';
|
145
149
|
if (!fs.existsSync(srcPath)) {
|
146
|
-
console.
|
150
|
+
console.error(`❌ 当前目录下不存在 src 文件夹`);
|
151
|
+
process.exit(1);
|
147
152
|
} else {
|
148
153
|
console.log(`🔍 检查目录: ${eslintTarget}`);
|
149
154
|
}
|