mirror of
https://github.com/imdap/ruoyi-plus-vben5.git
synced 2026-05-06 10:01:26 +08:00
* chore: update deps * feat: use jsonc/x language * chore: update eslint 10.0 * fix: no-useless-assignment * feat: add CLAUDE.md * chore: ignore * feat: claude * fix: lint * chore: suppot eslint v10 * fix: lint * fix: lint * fix: type check * fix: unit test * fix: Suggested fix * fix: unit test * chore: update stylelint v17 * chore: update all major deps * fix: echarts console warn * chore: update vitest v4 * feat: add skills ignores * chore: update deps * chore: update deps * fix: cspell * chore: update deps * chore: update tailwindcss v4 * chore: remove postcss config * fix: no use catalog * chore: tailwind v4 config * fix: tailwindcss v4 sort * feat: use eslint-plugin-better-tailwindcss * fix: Interference between enforce-consistent-line-wrapping, jsx-curly-brace-presence and Prettier * fix: Interference between enforce-consistent-line-wrapping, jsx-curly-brace-presence and Prettier * fix(lint): resolve prettier and better-tailwindcss formatting conflicts * fix(tailwind): update theme references and lint sources * style(format): normalize apps docs and playground vue files * style(format): normalize core ui-kit components * style(format): normalize effects ui and layout components
78 lines
2.1 KiB
TypeScript
78 lines
2.1 KiB
TypeScript
import { colors, consola } from '@vben/node-utils';
|
|
|
|
import { cac } from 'cac';
|
|
|
|
import { version } from '../package.json';
|
|
import { defineCheckCircularCommand } from './check-circular';
|
|
import { defineDepcheckCommand } from './check-dep';
|
|
import { defineCodeWorkspaceCommand } from './code-workspace';
|
|
import { defineLintCommand } from './lint';
|
|
import { definePubLintCommand } from './publint';
|
|
|
|
// 命令描述
|
|
const COMMAND_DESCRIPTIONS = {
|
|
'check-circular': 'Check for circular dependencies',
|
|
'check-dep': 'Check for unused dependencies',
|
|
'code-workspace': 'Manage VS Code workspace settings',
|
|
lint: 'Run linting on the project',
|
|
publint: 'Check package.json files for publishing standards',
|
|
} as const;
|
|
|
|
/**
|
|
* Initialize and run the CLI
|
|
*/
|
|
async function main(): Promise<void> {
|
|
try {
|
|
const vsh = cac('vsh');
|
|
|
|
// Register commands
|
|
defineLintCommand(vsh);
|
|
definePubLintCommand(vsh);
|
|
defineCodeWorkspaceCommand(vsh);
|
|
defineCheckCircularCommand(vsh);
|
|
defineDepcheckCommand(vsh);
|
|
|
|
// Set up CLI
|
|
vsh.usage('vsh <command> [options]');
|
|
vsh.help();
|
|
vsh.version(version);
|
|
|
|
// Parse arguments without auto-running to detect unknown commands
|
|
// Note: cac v7 removed EventEmitter; use matchedCommand after parse instead
|
|
vsh.parse(undefined, { run: false });
|
|
|
|
if (!vsh.matchedCommand && vsh.args.length > 0) {
|
|
const unknownCmd = String(vsh.args[0]);
|
|
consola.error(
|
|
colors.red(`Invalid command: ${unknownCmd}`),
|
|
'\n',
|
|
colors.yellow('Available commands:'),
|
|
'\n',
|
|
Object.entries(COMMAND_DESCRIPTIONS)
|
|
.map(([name, desc]) => ` ${colors.cyan(name)} - ${desc}`)
|
|
.join('\n'),
|
|
);
|
|
process.exit(1);
|
|
}
|
|
|
|
await vsh.runMatchedCommand();
|
|
} catch (error) {
|
|
consola.error(
|
|
colors.red('An unexpected error occurred:'),
|
|
'\n',
|
|
error instanceof Error ? error.message : error,
|
|
);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
// Run the CLI
|
|
main().catch((error) => {
|
|
consola.error(
|
|
colors.red('Failed to start CLI:'),
|
|
'\n',
|
|
error instanceof Error ? error.message : error,
|
|
);
|
|
process.exit(1);
|
|
});
|