Conversation
WalkthroughThis PR updates dependencies (ESLint, Vue theme), normalizes environment variable formatting in the TinyVue template, removes a proxy rewrite function from Vite configuration, and adds async handling to Prettier formatting in the NestJS migration generator. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
template/tinyvue/package.json (1)
39-39: Align OpenTiny package versions to prevent minor-version skew.The current mix of
@opentiny/vue(^3.28.0), the~3.28.0packages, and@opentiny/vue-theme(~3.29.0) can result in different minor versions across the same package family on fresh installs. Consider aligning all OpenTiny packages to consistent minor versions (either all~3.28.0or all~3.29.0) to avoid potential compatibility issues.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@template/tinyvue/package.json` at line 39, Update the OpenTiny dependency versions so they are all on the same minor release to avoid skew; specifically change "@opentiny/vue-theme" (currently "~3.29.0") to match the other OpenTiny packages (e.g., use "~3.28.0" if other entries like "@opentiny/vue" are "^3.28.0", or else align all to "~3.29.0"), ensuring the package.json entries for "@opentiny/vue", "@opentiny/vue-theme" and any other "@opentiny/*" packages share the same minor version pattern.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@template/tinyvue/.env`:
- Line 5: The consumer code in login-info.vue misinterprets
import.meta.env.VITE_USE_MOCK (a string per env.d.ts) as a boolean; update the
logic to explicitly parse the string (e.g., compute a boolean like useMock =
import.meta.env.VITE_USE_MOCK === 'true') and then use that boolean in the
existing condition and any downstream branches so "false" no longer evaluates as
truthy.
---
Nitpick comments:
In `@template/tinyvue/package.json`:
- Line 39: Update the OpenTiny dependency versions so they are all on the same
minor release to avoid skew; specifically change "@opentiny/vue-theme"
(currently "~3.29.0") to match the other OpenTiny packages (e.g., use "~3.28.0"
if other entries like "@opentiny/vue" are "^3.28.0", or else align all to
"~3.29.0"), ensuring the package.json entries for "@opentiny/vue",
"@opentiny/vue-theme" and any other "@opentiny/*" packages share the same minor
version pattern.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7ec6cec5-8148-40fb-af16-93120b46def8
📒 Files selected for processing (5)
template/nestJs/package.jsontemplate/nestJs/src/generateMigration.tstemplate/tinyvue/.envtemplate/tinyvue/config/vite.config.dev.tstemplate/tinyvue/package.json
💤 Files with no reviewable changes (1)
- template/tinyvue/config/vite.config.dev.ts
| VITE_MOCK_IGNORE= /api/user/userInfo,/api/user/login,/api/user/register,/api/employee/getEmployee | ||
| VITE_SERVER_HOST=http://127.0.0.1:3000 | ||
| VITE_MOCK_HOST=http://127.0.0.1:8848 | ||
| VITE_USE_MOCK=false |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find all usages and check whether env string is explicitly compared/parsing to boolean.
rg -n -C2 'VITE_USE_MOCK' template/tinyvue/srcRepository: opentiny/tiny-pro
Length of output: 1873
VITE_USE_MOCK=false is a string, not a boolean—the consumer code at line 61 of login-info.vue will not work as intended.
The condition if (!import.meta.env.VITE_USE_MOCK) treats the string "false" as truthy, causing the logic to invert. When this environment variable is set to "false", the condition evaluates to false, and the intended mock-disabled behavior does not execute.
The type declaration at env.d.ts line 20 confirms VITE_USE_MOCK: string, yet the documentation claims it is a Boolean. Fix the consumer code to explicitly parse the string: const useMock = import.meta.env.VITE_USE_MOCK === 'true'.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@template/tinyvue/.env` at line 5, The consumer code in login-info.vue
misinterprets import.meta.env.VITE_USE_MOCK (a string per env.d.ts) as a
boolean; update the logic to explicitly parse the string (e.g., compute a
boolean like useMock = import.meta.env.VITE_USE_MOCK === 'true') and then use
that boolean in the existing condition and any downstream branches so "false" no
longer evaluates as truthy.
| rewrite: (path: string) => | ||
| path.replace( | ||
| new RegExp(`${env.VITE_BASE_API}`), | ||
| '', | ||
| ), |
There was a problem hiding this comment.
这边不rewrite的话,发送的就是 /api/xxx 了. 但后端没有 /api 前缀
There was a problem hiding this comment.
sorry,这是我项目中定制的一个业务逻辑,因为我的后端服务有/api前缀,这个修改不应该带入到tiny-pro的版本中
There was a problem hiding this comment.
sorry,这是我项目中定制的一个业务逻辑,因为我的后端服务有/api前缀,这个修改不应该带入到tiny-pro的版本中
嗯嗯,由时间的话可以提交一个commit~
Fix: 依赖版本冲突和配置问题修复
问题描述
在本地开发环境启动 TinyPro 项目时遇到多个依赖版本冲突和配置问题,导致前后端无法正常运行。
修复内容
1. 依赖版本冲突修复
后端 (template/nestJs)
8.42.0→8.57.0前端 (template/tinyvue)
3.28.0→3.29.02. 后端配置问题修复
.env 文件格式
REFRESH_TOKEN_TTLDEVICE_LIMITCORS_ORIGINJWT Token 配置
ACCESS_TOKEN_VALIDITY_SEC配置错误3. 前端配置问题修复
.env 文件格式
Vite 代理配置
修改文件
template/nestJs/package.json- 更新 eslint 版本template/nestJs/src/generateMigration.ts- 修复生成迁移脚本template/tinyvue/.env- 修复环境变量格式template/tinyvue/config/vite.config.dev.ts- 移除错误的代理配置template/tinyvue/package.json- 更新 vue-theme 版本测试验证
✅ 后端服务正常运行 (http://localhost:3000)
✅ 前端服务正常运行 (http://localhost:3031)
✅ API 代理正确转发请求
✅ 登录功能完全正常
相关 Issue
修复本地开发环境启动失败的问题
类型
Checklist
Summary by CodeRabbit
Release Notes
Chores
Bug Fixes