@lark-apaas/fullstack-cli 1.1.67 → 1.1.68-alpha.20260920210907
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 +38 -7
package/package.json
CHANGED
|
@@ -64,6 +64,15 @@ function parseFilesArg(argv) {
|
|
|
64
64
|
return argv.slice(filesIndex + 1).filter(Boolean);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
function parseMode(argv) {
|
|
68
|
+
if (argv.length === 0) return { type: 'default' };
|
|
69
|
+
if (argv.length === 1 && argv[0] === '--typecheck') return { type: 'typecheck' };
|
|
70
|
+
if (argv[0] === '--files' && argv.length > 1 && argv.slice(1).every(arg => !arg.startsWith('--'))) {
|
|
71
|
+
return { type: 'files', files: argv.slice(1) };
|
|
72
|
+
}
|
|
73
|
+
throw new Error('Usage: lint.js [--typecheck | --files <paths...>]');
|
|
74
|
+
}
|
|
75
|
+
|
|
67
76
|
function isEslintTarget(filePath) {
|
|
68
77
|
return /\.(c|m)?(j|t)sx?$/.test(filePath);
|
|
69
78
|
}
|
|
@@ -107,6 +116,14 @@ function canRunStylelint() {
|
|
|
107
116
|
return STYLELINT_CONFIG_FILES.some(file => fs.existsSync(path.join(cwd, file)));
|
|
108
117
|
}
|
|
109
118
|
|
|
119
|
+
function packageScripts() {
|
|
120
|
+
try {
|
|
121
|
+
return JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf8')).scripts || {};
|
|
122
|
+
} catch {
|
|
123
|
+
return {};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
110
127
|
async function runDefaultLint() {
|
|
111
128
|
const taskSpecs = [
|
|
112
129
|
[getBinName('npm'), ['run', 'eslint']],
|
|
@@ -122,6 +139,19 @@ async function runDefaultLint() {
|
|
|
122
139
|
process.exit(await runTasksSerially(taskSpecs));
|
|
123
140
|
}
|
|
124
141
|
|
|
142
|
+
async function runTypeCheck() {
|
|
143
|
+
const scripts = packageScripts();
|
|
144
|
+
const names = ['type:check:server', 'type:check:client'];
|
|
145
|
+
const missing = names.filter(name => !scripts[name]);
|
|
146
|
+
if (missing.length > 0) {
|
|
147
|
+
throw new Error(`Missing required npm scripts: ${missing.join(', ')}`);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
process.exit(await runTasksSerially(
|
|
151
|
+
names.map(name => [getBinName('npm'), ['run', name]]),
|
|
152
|
+
));
|
|
153
|
+
}
|
|
154
|
+
|
|
125
155
|
async function runSelectiveLint(inputFiles) {
|
|
126
156
|
const normalizedFiles = Array.from(
|
|
127
157
|
new Set(inputFiles.map(normalizeProjectFile).filter(Boolean)),
|
|
@@ -179,18 +209,19 @@ async function runSelectiveLint(inputFiles) {
|
|
|
179
209
|
}
|
|
180
210
|
|
|
181
211
|
async function main() {
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
212
|
+
const args = process.argv.slice(2);
|
|
213
|
+
const mode = parseMode(args);
|
|
214
|
+
if (mode.type === 'typecheck') {
|
|
215
|
+
await runTypeCheck();
|
|
185
216
|
return;
|
|
186
217
|
}
|
|
187
218
|
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
|
|
219
|
+
if (mode.type === 'default') {
|
|
220
|
+
await runDefaultLint();
|
|
221
|
+
return;
|
|
191
222
|
}
|
|
192
223
|
|
|
193
|
-
await runSelectiveLint(files);
|
|
224
|
+
await runSelectiveLint(mode.files);
|
|
194
225
|
}
|
|
195
226
|
|
|
196
227
|
main().catch((error) => {
|