rn-rpa-app

🤖 RPA App - React Native 自动化应用

这是一个基于 React Native 的 RPA(机器人流程自动化)应用,支持动态脚本执行、Web 调试界面和 Android 设备自动化操作。

📚 文档导航

🎯 快速导航: 📚 完整文档索引 | 🚀 快速开始 | 📁 目录结构 | 🔧 调试指南

📖 主要文档


This is a new React Native project, bootstrapped using @react-native-community/cli.

Getting Started

Note: Make sure you have completed the Set Up Your Environment guide before proceeding.

Step 1: Start Metro

First, you will need to run Metro, the JavaScript build tool for React Native.

To start the Metro dev server, run the following command from the root of your React Native project:

# Using npm
npm start

# OR using Yarn
yarn start

Step 2: Build and run your app

With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:

Android

# Using npm
npm run android

# OR using Yarn
yarn android

If everything is set up correctly, you should see your new app running in the Android Emulator or your connected device.

This is one way to run your app — you can also build it directly from Android Studio.

Step 3: Modify your app

Now that you have successfully run the app, let’s make changes!

Open App.tsx in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by Fast Refresh.

When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload:

Congratulations! :tada:

You’ve successfully run and modified your React Native App. :partying_face:

Now what?

Troubleshooting

If you’re having issues getting the above steps to work, see the Troubleshooting page.

Learn More

To learn more about React Native, take a look at the following resources:

项目目录结构

RPAApp/
├── android/                # Android 原生代码
├── src/                    # 源代码目录
│   ├── components/         # React 组件
│   │   └── ScriptExecutor.tsx  # 脚本执行器组件
│   ├── managers/           # 管理器类
│   │   └── ScriptManager.ts    # 脚本管理器
│   ├── modules/            # 模块定义
│   │   └── RPAServiceModule.ts # RPA服务模块接口
│   ├── services/           # 服务类
│   │   └── http/           # HTTP服务相关
│   │       └── HttpService.ts  # HTTP服务类
│   ├── types/              # 类型定义
│   └── web-debug/          # Web调试相关
│       ├── public/         # Web调试静态文件
│       │   └── index.html  # Web调试界面
│       ├── README_WEB_DEBUG.md # Web调试说明文档
│       ├── server.js       # Web调试服务器
│       └── start.js        # Web调试启动脚本
├── example-scripts/        # 示例脚本
├── test-scripts/           # 测试脚本
├── doc/                    # 文档
├── App.tsx                 # 应用入口
└── package.json            # 项目配置

使用方法

启动应用

# 安装依赖
npm install

# 启动Metro服务器
npm start

# 在Android设备上运行
npm run android

启动 Web 调试服务器

# 启动Web调试服务器
npm run web-debug

开发命令

代码质量检查

# 完整检查(类型、lint、格式、测试)
npm run check-all

# 自动修复所有可修复的问题
npm run fix-all

# ESLint 检查
npm run lint

# ESLint 自动修复
npm run lint:fix

# 修复 import 排序
npm run lint:imports

# 代码格式化
npm run format

# 检查代码格式
npm run format:check

# TypeScript 类型检查
npm run type-check

测试相关

# 运行测试
npm test

# 监听模式运行测试
npm run test:watch

# 生成覆盖率报告
npm run test:coverage

Android 构建

# 清理 Android 构建
npm run clean:android

# 构建 Release APK
npm run build:android

# 安装 APK 到设备
npm run install:android

# 清理并重新安装依赖
npm run clean

Git 提交规范

项目使用 Conventional Commits 规范:

# 提交格式
<type>(<scope>): <subject>

# 示例
feat(http): 添加服务器健康检查功能
fix(ui): 修复重启按钮样式问题
docs: 更新 README 安装说明

自动化检查

每次提交前会自动运行:

如果检查失败,提交会被阻止。可以运行 npm run fix-all 自动修复大部分问题。