Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion template/nestJs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"cross-env": "^7.0.3",
"eslint": "8.42.0",
"eslint": "8.57.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-import": "2.27.5",
"express": "^4.21.2",
Expand Down
2 changes: 1 addition & 1 deletion template/nestJs/src/generateMigration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const generateMigration = async (

const config = await prettier.resolveConfig(process.cwd());

const formatted = prettier.format(code, {
const formatted = await prettier.format(code, {
...config,
parser: 'babel-ts',
});
Expand Down
8 changes: 4 additions & 4 deletions template/tinyvue/.env
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
VITE_CONTEXT=/vue-pro/
VITE_BASE_API=/api
VITE_SERVER_HOST= http://127.0.0.1:3000
VITE_MOCK_HOST= http://127.0.0.1:8848
VITE_USE_MOCK= false
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 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/src

Repository: 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.

VITE_MOCK_IGNORE=/api/user/userInfo,/api/user/login,/api/user/register,/api/employee/getEmployee

VITE_MOCK_SERVER_HOST=/mock
VITE_BASE=/
Expand Down
5 changes: 0 additions & 5 deletions template/tinyvue/config/vite.config.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ const proxyConfig = {
target: env.VITE_SERVER_HOST,
changeOrigin: true,
logLevel: 'debug',
rewrite: (path: string) =>
path.replace(
new RegExp(`${env.VITE_BASE_API}`),
'',
),
Comment on lines -20 to -24
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这边不rewrite的话,发送的就是 /api/xxx 了. 但后端没有 /api 前缀

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry,这是我项目中定制的一个业务逻辑,因为我的后端服务有/api前缀,这个修改不应该带入到tiny-pro的版本中

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry,这是我项目中定制的一个业务逻辑,因为我的后端服务有/api前缀,这个修改不应该带入到tiny-pro的版本中

嗯嗯,由时间的话可以提交一个commit~

},
[env.VITE_MOCK_SERVER_HOST]: {
target: env.VITE_SERVER_HOST,
Expand Down
2 changes: 1 addition & 1 deletion template/tinyvue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@opentiny/vue-icon": "~3.28.0",
"@opentiny/vue-locale": "~3.28.0",
"@opentiny/vue-search-box": "^0.1.3",
"@opentiny/vue-theme": "~3.28.0",
"@opentiny/vue-theme": "~3.29.0",
"@vueuse/core": "^10.11.1",
"@vueuse/head": "^2.0.0",
"axios": "^1.8.0",
Expand Down
Loading