@lark-apaas/fullstack-cli 1.1.51 → 1.1.52-beta.0
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/templates/scripts/lint.js +27 -15
package/package.json
CHANGED
|
@@ -23,6 +23,19 @@ function runCommand(command, args) {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
// 串行依次执行每个任务,全部跑完后再聚合退出码:
|
|
27
|
+
// 降低并发资源占用、让各任务输出按顺序清晰可读,同时保留“一次暴露所有 lint 问题”的行为。
|
|
28
|
+
async function runTasksSerially(taskSpecs) {
|
|
29
|
+
let exitCode = 0;
|
|
30
|
+
for (const [command, args] of taskSpecs) {
|
|
31
|
+
const code = await runCommand(command, args);
|
|
32
|
+
if (code !== 0) {
|
|
33
|
+
exitCode = 1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return exitCode;
|
|
37
|
+
}
|
|
38
|
+
|
|
26
39
|
function normalizeProjectFile(filePath) {
|
|
27
40
|
const absolutePath = path.isAbsolute(filePath)
|
|
28
41
|
? filePath
|
|
@@ -64,13 +77,13 @@ function isStylelintTarget(filePath) {
|
|
|
64
77
|
}
|
|
65
78
|
|
|
66
79
|
async function runDefaultLint() {
|
|
67
|
-
const
|
|
68
|
-
'
|
|
69
|
-
'npm run
|
|
70
|
-
'npm run
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
process.exit(
|
|
80
|
+
const taskSpecs = [
|
|
81
|
+
[getBinName('npm'), ['run', 'eslint']],
|
|
82
|
+
[getBinName('npm'), ['run', 'type:check']],
|
|
83
|
+
[getBinName('npm'), ['run', 'stylelint']],
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
process.exit(await runTasksSerially(taskSpecs));
|
|
74
87
|
}
|
|
75
88
|
|
|
76
89
|
async function runSelectiveLint(inputFiles) {
|
|
@@ -101,31 +114,30 @@ async function runSelectiveLint(inputFiles) {
|
|
|
101
114
|
}
|
|
102
115
|
}
|
|
103
116
|
|
|
104
|
-
const
|
|
117
|
+
const taskSpecs = [];
|
|
105
118
|
|
|
106
119
|
if (eslintFiles.length > 0) {
|
|
107
|
-
|
|
120
|
+
taskSpecs.push([getBinName('npx'), ['eslint', '--quiet', ...eslintFiles]]);
|
|
108
121
|
}
|
|
109
122
|
|
|
110
123
|
if (stylelintFiles.length > 0) {
|
|
111
|
-
|
|
124
|
+
taskSpecs.push([getBinName('npx'), ['stylelint', '--quiet', ...stylelintFiles]]);
|
|
112
125
|
}
|
|
113
126
|
|
|
114
127
|
if (clientTypeFiles.length > 0) {
|
|
115
|
-
|
|
128
|
+
taskSpecs.push([getBinName('npm'), ['run', 'type:check:client']]);
|
|
116
129
|
}
|
|
117
130
|
|
|
118
131
|
if (serverTypeFiles.length > 0) {
|
|
119
|
-
|
|
132
|
+
taskSpecs.push([getBinName('npm'), ['run', 'type:check:server']]);
|
|
120
133
|
}
|
|
121
134
|
|
|
122
|
-
if (
|
|
135
|
+
if (taskSpecs.length === 0) {
|
|
123
136
|
console.log('[lint] No supported files matched for lint');
|
|
124
137
|
process.exit(0);
|
|
125
138
|
}
|
|
126
139
|
|
|
127
|
-
|
|
128
|
-
process.exit(results.some(code => code !== 0) ? 1 : 0);
|
|
140
|
+
process.exit(await runTasksSerially(taskSpecs));
|
|
129
141
|
}
|
|
130
142
|
|
|
131
143
|
async function main() {
|