update: 升级vben5.5.9到5.7.0

This commit is contained in:
2026-09-22 17:09:46 +08:00
parent 345e4a31f8
commit 802f72cd9e
766 changed files with 28468 additions and 15447 deletions
+39 -11
View File
@@ -1,5 +1,7 @@
import type { CAC } from 'cac';
import { execSync } from 'node:child_process';
import { execaCommand } from '@vben/node-utils';
interface LintCommandOptions {
@@ -7,34 +9,59 @@ interface LintCommandOptions {
* Format lint problem.
*/
format?: boolean;
/**
* Number of threads for oxfmt and oxlint (default: 2).
*/
threads?: number;
}
async function runLint({ format }: LintCommandOptions) {
async function runLint({ format, threads }: LintCommandOptions) {
// process.env.FORCE_COLOR = '3';
const threadsArg = threads ? ` --threads=${threads}` : ` --threads=2`;
if (format) {
await execaCommand(`stylelint "**/*.{vue,css,less,scss}" --cache --fix`, {
stdio: 'inherit',
});
await execaCommand(`eslint . --cache --fix`, {
await execaCommand(`oxfmt${threadsArg}`, {
stdio: 'inherit',
});
await execaCommand(`prettier . --write --cache --log-level warn`, {
await execaCommand(`oxlint --fix${threadsArg}`, {
stdio: 'inherit',
});
await execaCommand(`eslint . --cache --fix`, {
stdio: 'inherit',
});
return;
}
await Promise.all([
execaCommand(`eslint . --cache`, {
stdio: 'inherit',
}),
execaCommand(`prettier . --ignore-unknown --check --cache`, {
stdio: 'inherit',
}),
const subprocesses = [
execaCommand(`oxfmt --check${threadsArg}`, { stdio: 'inherit' }),
execaCommand(`oxlint${threadsArg}`, { stdio: 'inherit' }),
execaCommand(`eslint . --cache`, { stdio: 'inherit' }),
execaCommand(`stylelint "**/*.{vue,css,less,scss}" --cache`, {
stdio: 'inherit',
}),
]);
];
try {
await Promise.all(subprocesses);
} catch (error) {
for (const subprocess of subprocesses) {
try {
if (process.platform === 'win32' && subprocess.pid) {
execSync(`taskkill /F /T /PID ${subprocess.pid}`, {
stdio: 'ignore',
});
} else {
subprocess.kill('SIGKILL');
}
} catch {
// process may have already exited
}
}
await Promise.allSettled(subprocesses);
throw error;
}
}
function defineLintCommand(cac: CAC) {
@@ -42,6 +69,7 @@ function defineLintCommand(cac: CAC) {
.command('lint')
.usage('Batch execute project lint check.')
.option('--format', 'Format lint problem.')
.option('--threads <count>', 'Number of threads for oxfmt and oxlint.')
.action(runLint);
}