Initial commit: Telegram Management System
Some checks failed
Deploy / deploy (push) Has been cancelled

Full-stack web application for Telegram management
- Frontend: Vue 3 + Vben Admin
- Backend: NestJS
- Features: User management, group broadcast, statistics

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
你的用户名
2025-11-04 15:37:50 +08:00
commit 237c7802e5
3674 changed files with 525172 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
# @vben/turbo-run
`turbo-run` 是一个命令行工具,允许你在多个包中并行运行命令。它提供了一个交互式的界面,让你可以选择要运行命令的包。
## 特性
- 🚀 交互式选择要运行的包
- 📦 支持 monorepo 项目结构
- 🔍 自动检测可用的命令
- 🎯 精确过滤目标包
## 安装
```bash
pnpm add -D @vben/turbo-run
```
## 使用方法
基本语法:
```bash
turbo-run [script]
```
例如,如果你想运行 `dev` 命令:
```bash
turbo-run dev
```
工具会自动检测哪些包有 `dev` 命令,并提供一个交互式界面让你选择要运行的包。
## 示例
假设你的项目中有以下包:
- `@vben/app`
- `@vben/admin`
- `@vben/website`
当你运行:
```bash
turbo-run dev
```
工具会:
1. 检测哪些包有 `dev` 命令
2. 显示一个交互式选择界面
3. 让你选择要运行命令的包
4. 使用 `pnpm --filter` 在选定的包中运行命令
## 注意事项
- 确保你的项目使用 pnpm 作为包管理器
- 确保目标包在 `package.json` 中定义了相应的脚本命令
- 该工具需要在 monorepo 项目的根目录下运行

View File

@@ -0,0 +1,3 @@
#!/usr/bin/env node
import('../dist/index.mjs');

View File

@@ -0,0 +1,7 @@
import { defineBuildConfig } from 'unbuild';
export default defineBuildConfig({
clean: true,
declaration: true,
entries: ['src/index'],
});

View File

@@ -0,0 +1,29 @@
{
"name": "@vben/turbo-run",
"version": "5.5.8",
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"stub": "pnpm unbuild --stub"
},
"files": [
"dist"
],
"bin": {
"turbo-run": "./bin/turbo-run.mjs"
},
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"exports": {
".": {
"default": "./dist/index.mjs"
},
"./package.json": "./package.json"
},
"dependencies": {
"@clack/prompts": "catalog:",
"@vben/node-utils": "workspace:*",
"cac": "catalog:"
}
}

View File

@@ -0,0 +1,29 @@
import { colors, consola } from '@vben/node-utils';
import { cac } from 'cac';
import { run } from './run';
try {
const turboRun = cac('turbo-run');
turboRun
.command('[script]')
.usage(`Run turbo interactively.`)
.action(async (command: string) => {
run({ command });
});
// Invalid command
turboRun.on('command:*', () => {
consola.error(colors.red('Invalid command!'));
process.exit(1);
});
turboRun.usage('turbo-run');
turboRun.help();
turboRun.parse();
} catch (error) {
consola.error(error);
process.exit(1);
}

View File

@@ -0,0 +1,67 @@
import { execaCommand, getPackages } from '@vben/node-utils';
import { cancel, isCancel, select } from '@clack/prompts';
interface RunOptions {
command?: string;
}
export async function run(options: RunOptions) {
const { command } = options;
if (!command) {
console.error('Please enter the command to run');
process.exit(1);
}
const { packages } = await getPackages();
// const appPkgs = await findApps(process.cwd(), packages);
// const websitePkg = packages.find(
// (item) => item.packageJson.name === '@vben/website',
// );
// 只显示有对应命令的包
const selectPkgs = packages.filter((pkg) => {
return (pkg?.packageJson as Record<string, any>)?.scripts?.[command];
});
let selectPkg: string | symbol;
if (selectPkgs.length > 1) {
selectPkg = await select<string>({
message: `Select the app you need to run [${command}]:`,
options: selectPkgs.map((item) => ({
label: item?.packageJson.name,
value: item?.packageJson.name,
})),
});
if (isCancel(selectPkg) || !selectPkg) {
cancel('👋 Has cancelled');
process.exit(0);
}
} else {
selectPkg = selectPkgs[0]?.packageJson?.name ?? '';
}
if (!selectPkg) {
console.error('No app found');
process.exit(1);
}
execaCommand(`pnpm --filter=${selectPkg} run ${command}`, {
stdio: 'inherit',
});
}
/**
* 过滤app包
* @param root
* @param packages
*/
// async function findApps(root: string, packages: Package[]) {
// // apps内的
// const appPackages = packages.filter((pkg) => {
// const viteConfigExists = fs.existsSync(join(pkg.dir, 'vite.config.mts'));
// return pkg.dir.startsWith(join(root, 'apps')) && viteConfigExists;
// });
// return appPackages;
// }

View File

@@ -0,0 +1,6 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@vben/tsconfig/node.json",
"include": ["src"],
"exclude": ["node_modules"]
}