@apdesign/code-style-react 1.1.2 → 1.1.3
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/cli.js +2 -2
- package/package.json +1 -1
- package/scripts/runEslint.js +5 -4
package/cli.js
CHANGED
@@ -8,8 +8,8 @@ const command = args[0];
|
|
8
8
|
if (command === 'init') {
|
9
9
|
main();
|
10
10
|
} else if (command === 'eslint') {
|
11
|
-
const
|
12
|
-
|
11
|
+
const runEslint = require('./scripts/runEslint');
|
12
|
+
runEslint(args[1]);
|
13
13
|
} else {
|
14
14
|
console.log(`Unknown command: "${command}"`);
|
15
15
|
}
|
package/package.json
CHANGED
package/scripts/runEslint.js
CHANGED
@@ -5,7 +5,7 @@ let spawn;
|
|
5
5
|
let path;
|
6
6
|
let fs;
|
7
7
|
|
8
|
-
|
8
|
+
async function runEslint(targetPathArg) {
|
9
9
|
try {
|
10
10
|
if (typeof require !== 'undefined') {
|
11
11
|
// CommonJS
|
@@ -19,8 +19,7 @@ let fs;
|
|
19
19
|
fs = await import('node:fs');
|
20
20
|
}
|
21
21
|
|
22
|
-
|
23
|
-
const targetPath = process.argv[2] || process.cwd();
|
22
|
+
const targetPath = targetPathArg || process.cwd();
|
24
23
|
let rootDir = path.resolve(targetPath);
|
25
24
|
|
26
25
|
// 如果传的是单个目录名且路径不存在,则在 packages/ 下查找
|
@@ -124,4 +123,6 @@ let fs;
|
|
124
123
|
console.error('脚本执行出错:', err);
|
125
124
|
process.exit(1);
|
126
125
|
}
|
127
|
-
}
|
126
|
+
}
|
127
|
+
|
128
|
+
module.exports = runEslint;
|