Files
2026-05-23 14:05:22 +08:00

153 lines
3.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Lowcode Create - Standalone Project Guide
这是一个从 monorepo 中独立出来的 `@lingshu/lowcode-create` 项目。
## 项目结构
```
lowcode-create/
├── src/ # 源代码
│ ├── apis/ # API 接口
│ ├── components/ # Vue 组件
│ ├── composables/ # 组合式函数
│ ├── config/ # 配置文件
│ ├── constants/ # 常量定义
│ ├── enums/ # 枚举类型
│ ├── logics/ # 业务逻辑
│ ├── types/ # TypeScript 类型定义
│ └── utils/ # 工具函数
├── types/ # 共享类型定义(来自 @lingshu/types
├── scripts/ # 构建脚本
├── dist/ # 构建输出(自动生成)
└── package.json # 项目配置
```
## 安装依赖
```bash
pnpm install
```
## 开发命令
### 开发模式(监听模式)
```bash
pnpm dev
```
### 构建
```bash
pnpm build
```
### 类型检查
```bash
pnpm type-check
```
### 代码检查和修复
```bash
pnpm lint
pnpm lint:fix
```
### 版本发布
```bash
# 交互式版本升级
pnpm bump
# 发布类型库
pnpm release:types
```
## 构建配置
项目支持两种构建方式:
1. **Vite 构建**(推荐,默认)
```bash
pnpm build:vite
```
2. **tsdown 构建**(快速 TypeScript 编译)
```bash
pnpm build:tsdown
```
## 依赖说明
### Peer Dependencies(需要在使用项目中安装)
- `vue` >= 3.0.0
- `element-plus-cisdi` >= 1.0.0
- `lodash-es` >= 4.17.0
- `uuid` >= 11.0.0
- `unocss` >= 66.5.1
### External Dependencies(在 vite.config.ts 中配置为外部依赖)
- vue
- element-plus-cisdi
- lodash-es
- uuid
这些依赖不会被打包到最终的构建产物中,使用方需要自行安装。
## 发布配置
项目发布到私有 npm registry
- Registry: `http://nexus.cisdigital.cn/repository/npm-internal/`
- 包名: `@lingshu/lowcode-create`
## 与 Monorepo 的区别
1. **类型定义**: 原 monorepo 中的 `@lingshu/types` 已集成到本项目的 `types/` 目录中
2. **配置文件**: 所有 tsconfig、eslint 等配置文件都已本地化,移除了对 monorepo 的依赖
3. **主题配置**: UnoCSS 配置已简化,移除了对 `@lingshu/theme-lib` 的依赖
4. **依赖管理**: 所有 workspace 依赖都已转换为实际的 npm 依赖
## Git 仓库
项目已初始化为独立的 git 仓库,可以推送到远程仓库:
```bash
git remote add origin <your-repo-url>
git push -u origin main
```
## 注意事项
1. 确保 Node.js 版本为 v20.19.5(查看 .nvmrc
2. 使用 pnpm 作为包管理器(建议版本:10.13.1+)
3. 构建前请确保所有依赖已正确安装
4. 发布前请确保运行 `pnpm build` 生成最新的构建产物
## 问题排查
如果遇到构建问题:
1. 清理并重新安装依赖:
```bash
rm -rf node_modules pnpm-lock.yaml
pnpm install
```
2. 清理构建产物:
```bash
pnpm run build:vite # 会自动清理 dist 目录
```
3. 检查类型错误:
```bash
pnpm type-check
```