Skip to content
Merged
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
17 changes: 17 additions & 0 deletions .github/workflows/deploy-obs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ jobs:
VITE_CONTEXT: /vue-pro/pages/
VITE_BASE_API: /tiny-pro-vue/api
VITE_MOCK_SERVER_HOST: /tiny-pro-vue/api/mock
# 是否启用设计器
VITE_LOWCODE_DESIGNER_ENABLED: true
# 配置设计器链接,部署后使用相对路径 /designer
VITE_LOWCODE_DESIGNER_URL: https://ai.opentiny.design/designer/
Comment on lines +65 to +68
Copy link

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:

cat -n .github/workflows/deploy-obs.yml | sed -n '50,90p'

Repository: opentiny/tiny-pro

Length of output: 2046


🏁 Script executed:

rg "VITE_LOWCODE_DESIGNER_URL" --type yaml --type javascript --type typescript

Repository: opentiny/tiny-pro

Length of output: 95


🏁 Script executed:

cat -n .github/workflows/deploy-obs.yml

Repository: opentiny/tiny-pro

Length of output: 5076


🏁 Script executed:

rg "VITE_LOWCODE_DESIGNER" -A 2 -B 2

Repository: opentiny/tiny-pro

Length of output: 3636


🏁 Script executed:

rg "ai.opentiny.design/designer" -A 2 -B 2

Repository: opentiny/tiny-pro

Length of output: 43


🏁 Script executed:

find . -name "*.md" -o -name "*.txt" | head -20 | xargs grep -l "designer" 2>/dev/null | head -5

Repository: opentiny/tiny-pro

Length of output: 43


Update VITE_LOWCODE_DESIGNER_URL to use the locally deployed designer path.

Line 67's comment correctly states to use relative path /designer after deployment, but line 68 sets an absolute external URL. The production build config in vite.config.prod.ts defaults to /designer, and the workflow explicitly builds and deploys the designer locally (lines 69-81). Change line 68 to:

-          VITE_LOWCODE_DESIGNER_URL: https://ai.opentiny.design/designer/
+          VITE_LOWCODE_DESIGNER_URL: /designer/
🤖 Prompt for AI Agents
In @.github/workflows/deploy-obs.yml around lines 65 - 68, Replace the absolute
external URL for the environment variable VITE_LOWCODE_DESIGNER_URL with the
local relative path used in production (e.g., /designer or /designer/) so it
matches the default in vite.config.prod.ts and the workflow that builds/deploys
the designer; update the value for VITE_LOWCODE_DESIGNER_URL accordingly in the
workflow.

- name: Build lowcode-designer
run: |
export NODE_OPTIONS="--max-old-space-size=8192"
cd template/lowcode-designer
pnpm build
env:
# 配置设计器的 base 路径,部署到 /designer/ 目录下
VITE_DESIGNER_BASE: /designer/
- name: Copy lowcode-designer to vue-pro/designer
run: |
# 将 lowcode-designer 的构建产物放入 vue-pro/designer 目录下
mkdir -p ./template/tinyvue/dist/vue-pro/designer
cp -r ./template/lowcode-designer/dist/* ./template/tinyvue/dist/vue-pro/designer/
- name: Copy files
run: |
cp ./template/tinyvue/dist/vue-pro/pages/index.html ./template/tinyvue/dist/vue-pro/pages/404.html
Expand Down
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@
],
"repository": "https://github.com/opentiny/tiny-pro",
"homepage": "https://opentiny.design/pro/",
"pnpm": {
"overrides": {
"@opentiny/tiny-engine-common>@opentiny/vue-renderless": "~3.20.0",
"@opentiny/tiny-engine-plugin-datasource>@opentiny/vue-renderless": "~3.20.0",
"@opentiny/tiny-engine-plugin-block>@opentiny/vue-renderless": "~3.20.0",
"@opentiny/tiny-engine-plugin-canvas>@opentiny/vue-renderless": "~3.20.0",
"@opentiny/tiny-engine-plugin-tree>@opentiny/vue-renderless": "~3.20.0",
"@opentiny/tiny-engine-setting-styles>@opentiny/vue-renderless": "~3.20.0",
"@opentiny/tiny-engine-plugin-materials>@opentiny/vue-renderless": "~3.20.0",
"@opentiny/tiny-engine-plugin-page>@opentiny/vue-renderless": "~3.20.0"
}
},
Comment on lines +34 to +45
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for resolutions field in template/tinyvue/package.json
if [ -f "template/tinyvue/package.json" ]; then
  echo "=== Checking for resolutions field ==="
  if grep -q '"resolutions"' template/tinyvue/package.json; then
    echo "Found resolutions field in template/tinyvue/package.json"
    echo "=== Content ==="
    cat template/tinyvue/package.json | jq '.resolutions // empty'
  else
    echo "No resolutions field found in template/tinyvue/package.json"
  fi
else
  echo "template/tinyvue/package.json not found"
fi

# Also check the root package.json structure for comparison
echo -e "\n=== Root package.json pnpm section (first 50 lines) ==="
cat package.json | jq '.pnpm // empty' | head -50

Repository: opentiny/tiny-pro

Length of output: 949


Remove the ineffective "resolutions" field from template/tinyvue/package.json.

The resolutions field in template/tinyvue/package.json is ignored in pnpm workspaces. pnpm does not recognize the resolutions field (which is yarn/npm syntax) and only applies overrides configured in pnpm.overrides at the workspace root.

The resolutions currently in template/tinyvue/package.json are:

  • "bin-wrapper": "npm:bin-wrapper-china" (npm alias syntax)
  • "gifsicle": "5.2.0" (version pin)

If these overrides are still needed, they must be migrated to pnpm.overrides in the root package.json using pnpm's syntax. Otherwise, remove the resolutions field entirely to resolve the pipeline warning.

🤖 Prompt for AI Agents
In @package.json around lines 34 - 45, The template's package.json contains a
yarn/npm "resolutions" field which pnpm ignores; remove the "resolutions" object
from template/tinyvue/package.json and either delete those entries or migrate
the specific overrides ("bin-wrapper": "npm:bin-wrapper-china" and "gifsicle":
"5.2.0") into the workspace root's pnpm.overrides using pnpm's override syntax
(pnpm.overrides) so pnpm will apply them and eliminate the pipeline warning.

"scripts": {
"dev": "pnpm -F tiny-pro-vue start",
"dev:backend": "pnpm -F tinyui-nestjs-server start",
Expand Down Expand Up @@ -153,4 +165,4 @@
]
}
]
}
}
14 changes: 7 additions & 7 deletions template/lowcode-designer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
"@opentiny/tiny-engine-generate-code-tinypro": "^0.1.0",
"@opentiny/tiny-engine-meta-register": "^2.7.0",
"@opentiny/tiny-engine-utils": "^2.7.0",
"@opentiny/vue": "^3.27.0",
"@opentiny/vue-design-smb": "^3.27.0",
"@opentiny/vue-icon": "^3.27.0",
"@opentiny/vue-locale": "^3.27.0",
"@opentiny/vue-renderless": "^3.27.0",
"@opentiny/vue-theme": "^3.27.0",
"@opentiny/vue": "~3.20.0",
"@opentiny/vue-design-smb": "~3.20.0",
"@opentiny/vue-icon": "~3.20.0",
"@opentiny/vue-locale": "~3.20.0",
"@opentiny/vue-renderless": "~3.20.0",
"@opentiny/vue-theme": "~3.20.0",
"@vueuse/core": "^9.6.0",
"vue": "^3.4.21"
},
Expand All @@ -33,4 +33,4 @@
"cross-env": "^7.0.3",
"vite": "^5.4.2"
}
}
}
15 changes: 14 additions & 1 deletion template/lowcode-designer/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import path from 'node:path';
import { defineConfig, mergeConfig } from 'vite';
import { defineConfig, mergeConfig, loadEnv } from 'vite';
import { useTinyEngineBaseConfig } from '@opentiny/tiny-engine-vite-config';

export default defineConfig((configEnv) => {
// 加载环境变量(从 env 目录加载)
const env = loadEnv(configEnv.mode, path.resolve(__dirname, './env'), '');

// 获取 base 路径,默认为 '/',可通过 VITE_DESIGNER_BASE 环境变量配置
// 例如:VITE_DESIGNER_BASE=/designer/ 用于部署到 /designer/ 路径下
const base = env.VITE_DESIGNER_BASE || '/';

const baseConfig = useTinyEngineBaseConfig({
viteConfigEnv: configEnv,
root: __dirname,
Expand All @@ -15,6 +22,7 @@ export default defineConfig((configEnv) => {
});

const customConfig = {
base, // 配置静态资源前缀
envDir: './env',
publicDir: path.resolve(__dirname, './public'),
server: {
Expand All @@ -27,6 +35,11 @@ export default defineConfig((configEnv) => {
},
},
},
build: {
// 确保构建时使用正确的 base 路径
outDir: 'dist',
assetsDir: 'assets',
},
};

return mergeConfig(baseConfig, customConfig);
Expand Down
14 changes: 12 additions & 2 deletions template/tinyvue/config/vite.config.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,24 @@ const config = {
},
{
find: '@opentiny/vue-icon',
replacement: resolve('node_modules/@opentiny/vue-icon'), // compile template
replacement: resolve(__dirname, '../node_modules/@opentiny/vue-icon'), // compile template
},
{
find: '@opentiny/vue-theme',
replacement: resolve(__dirname, '../node_modules/@opentiny/vue-theme'),
},
Comment on lines 42 to 48
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's check the repository root structure and workspace configuration
ls -la | head -20

Repository: opentiny/tiny-pro

Length of output: 1276


🏁 Script executed:

# Check for workspace/monorepo configuration files
echo "=== Checking for workspace files ==="
ls -la pnpm-workspace.yaml lerna.json package-lock.json yarn.lock package.json 2>/dev/null | grep -v "cannot access"

echo "=== Checking package.json workspaces ==="
if [ -f "package.json" ]; then
  cat package.json | jq -r '.workspaces // "No workspaces field"' 2>/dev/null || cat package.json | grep -A 5 '"workspaces"' || echo "No workspaces"
fi

Repository: opentiny/tiny-pro

Length of output: 289


🏁 Script executed:

# Examine the actual vite.config.base.ts file
if [ -f "template/tinyvue/config/vite.config.base.ts" ]; then
  echo "=== File exists, reading content ==="
  wc -l template/tinyvue/config/vite.config.base.ts
  echo ""
  echo "=== Full file content ==="
  cat -n template/tinyvue/config/vite.config.base.ts
else
  echo "File not found at template/tinyvue/config/vite.config.base.ts"
  find . -name "vite.config.base.ts" -type f 2>/dev/null
fi

Repository: opentiny/tiny-pro

Length of output: 2556


🏁 Script executed:

# Check if @opentiny packages are installed
echo "=== Searching for @opentiny packages ==="
find . -type d -name "@opentiny" 2>/dev/null | head -10

echo "=== Checking package.json for @opentiny dependencies ==="
if [ -f "template/tinyvue/package.json" ]; then
  cat template/tinyvue/package.json | jq '.dependencies, .devDependencies' | grep -i "@opentiny" || echo "Not found in template/tinyvue"
fi

if [ -f "package.json" ]; then
  cat package.json | jq '.dependencies, .devDependencies' | grep -i "@opentiny" || echo "Not found in root"
fi

Repository: opentiny/tiny-pro

Length of output: 443


🏁 Script executed:

# Check the directory structure relative to vite.config.base.ts
echo "=== Directory structure from template/tinyvue/config/ ==="
ls -la template/tinyvue/config/ 2>/dev/null || echo "Directory not accessible"

echo "=== Checking relative paths from template/tinyvue/config/ ==="
cd template/tinyvue/config && pwd
echo "=== From config dir, checking ../node_modules ==="
ls -la ../node_modules/@opentiny 2>/dev/null | head -20 || echo "Path ../node_modules/@opentiny not found"
cd - > /dev/null 2>&1

Repository: opentiny/tiny-pro

Length of output: 932


🏁 Script executed:

# Check if @opentiny packages are in root node_modules
echo "=== Checking root node_modules for @opentiny ==="
ls -la node_modules/@opentiny 2>/dev/null | head -20 || echo "Not found in root node_modules"

# Check pnpm-workspace.yaml content
echo "=== pnpm-workspace.yaml content ==="
cat pnpm-workspace.yaml

# Check template/tinyvue package.json
echo "=== template/tinyvue/package.json ==="
if [ -f "template/tinyvue/package.json" ]; then
  head -50 template/tinyvue/package.json
else
  echo "File not found"
fi

# Verify the vite.config structure more carefully
echo "=== Checking if template/tinyvue is a standalone project or workspace package ==="
ls -la template/tinyvue/ | grep -E "package.json|node_modules"

Repository: opentiny/tiny-pro

Length of output: 1807


🏁 Script executed:

# Check if template/tinyvue has its own node_modules with @opentiny packages
echo "=== Checking template/tinyvue/node_modules ==="
ls -la template/tinyvue/node_modules/@opentiny 2>/dev/null | head -20 || echo "Not found in template/tinyvue/node_modules"

# Verify the actual structure
echo "=== Checking if template/tinyvue/node_modules exists ==="
if [ -d "template/tinyvue/node_modules" ]; then
  echo "Directory exists"
  ls -la template/tinyvue/node_modules/ | head -20
else
  echo "No node_modules directory in template/tinyvue"
fi

# Check .pnpm structure
echo "=== Checking for .pnpm directory ==="
if [ -d ".pnpm" ]; then
  echo "Found .pnpm directory"
  ls .pnpm | grep -i "@opentiny" | head -10
fi

Repository: opentiny/tiny-pro

Length of output: 247


Hard-coded node_modules paths are fragile in this pnpm workspace setup.

The alias entries for @opentiny/vue-icon and @opentiny/vue-theme resolve to ../node_modules/@opentiny/* from the config directory. In pnpm workspaces (configured in pnpm-workspace.yaml), packages may be located elsewhere depending on installation strategy (hoisted to root, symlinked, or in .pnpm stores), making these hard-coded paths unreliable.

Consider using require.resolve() for package resolution instead:

{
  find: '@opentiny/vue-icon',
  replacement: require.resolve('@opentiny/vue-icon'),
},
{
  find: '@opentiny/vue-theme',
  replacement: require.resolve('@opentiny/vue-theme'),
},

Or remove the aliases entirely and let Node/Vite resolve them naturally if the packages are properly installed.

🤖 Prompt for AI Agents
In @template/tinyvue/config/vite.config.base.ts around lines 42 - 48, The alias
entries for '@opentiny/vue-icon' and '@opentiny/vue-theme' in
vite.config.base.ts are using fragile hard-coded ../node_modules paths; replace
those replacement values so resolution uses Node rather than a relative path
(e.g., use require.resolve('@opentiny/vue-icon') and
require.resolve('@opentiny/vue-theme') for the replacement fields) or remove the
alias entries entirely so Vite/Node can resolve the packages normally; update
the objects with find: '@opentiny/vue-icon' and find: '@opentiny/vue-theme' to
use require.resolve-based replacements (or delete those alias objects) to fix
pnpm workspace resolution issues.

],
extensions: ['.ts', '.js'],
extensions: ['.ts', '.js', '.css'],
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the vite.config.base.ts file to see the full context
cat -n template/tinyvue/config/vite.config.base.ts | head -80

Repository: opentiny/tiny-pro

Length of output: 2445


🏁 Script executed:

# Search for CSS imports that might require this configuration
echo "=== Checking for explicit .css imports ==="
rg -n "import.*\.css" --type ts --type vue -C 2

# Search for dynamic CSS imports
echo "=== Checking for dynamic CSS imports ==="
rg -n "import\(['\"].*\.css" --type ts --type vue -C 2

Repository: opentiny/tiny-pro

Length of output: 217


🏁 Script executed:

# Also check if there are designer-related files or CSS modules that might require this
echo "=== Checking for designer-related files ==="
fd -type f -name "*designer*" -o -name "*theme*" | head -20

echo "=== Checking for CSS modules or style imports ==="
rg -n "\.module\.css|\.css\?" --type ts --type vue | head -20

Repository: opentiny/tiny-pro

Length of output: 370


🏁 Script executed:

# Search for CSS imports without explicit .css extension (normal Vite way)
echo "=== CSS imports without explicit .css extension ==="
rg -n "\.css['\"]" -A 2 -B 2 | head -50

# Search for any imports from @opentiny/vue-theme
echo "=== Checking @opentiny/vue-theme imports ==="
rg -n "@opentiny/vue-theme" -C 2 | head -50

# Check for CSS-related configuration or comments in the config file
echo "=== Checking for CSS-related comments or patterns in vite.config ==="
rg -n "css|CSS" template/tinyvue/config/vite.config.base.ts -C 2

# Look for any similar projects or documentation files
echo "=== Checking for README or docs about vite config ==="
fd -name "*.md" | xargs grep -l "vite\|CSS" | head -10

Repository: opentiny/tiny-pro

Length of output: 7036


🏁 Script executed:

# Check node_modules/@opentiny/vue-theme to understand if it exports CSS
echo "=== Checking @opentiny/vue-theme package contents ==="
if [ -d "node_modules/@opentiny/vue-theme" ]; then
  ls -la node_modules/@opentiny/vue-theme/ | head -20
  cat node_modules/@opentiny/vue-theme/package.json 2>/dev/null | grep -A 10 '"main"\|"exports"' | head -20
else
  echo "Package not found in node_modules (expected in sandbox)"
fi

Repository: opentiny/tiny-pro

Length of output: 170


🏁 Script executed:

# Check if there are any build errors or warnings logs that mention CSS resolution
echo "=== Looking for any error handling or CSS import handling ==="
rg -n "resolveExtensions|resolve.extensions" -C 3 | head -50

Repository: opentiny/tiny-pro

Length of output: 566


🏁 Script executed:

# Check if other vite configs in the project have similar patterns
echo "=== Other vite configs in the project ==="
fd -name "vite.config.*" -type f

# Check each vite config for CSS in extensions
for config in $(fd -name "vite.config.*" -type f); do
  echo "=== Checking $config ==="
  grep -n "extensions\|resolveExtensions" "$config" || echo "No match found"
done

# Check git history or comments to see when/why this was added
echo "=== Checking for comments in vite config about CSS ==="
cat template/tinyvue/config/vite.config.base.ts | grep -i "css\|theme\|designer" -B 2 -A 2

Repository: opentiny/tiny-pro

Length of output: 1258


🏁 Script executed:

# Let's check if @opentiny/vue-theme has any unusual export patterns
echo "=== Checking imports from @opentiny/vue-theme in the codebase ==="
rg "@opentiny/vue-theme" --no-heading | sort -u

# Check env.d.ts to see module declarations
echo "=== Module declarations for vue-theme ==="
grep "@opentiny/vue-theme" template/tinyvue/src/env.d.ts -A 1 -B 1

Repository: opentiny/tiny-pro

Length of output: 9930


🏁 Script executed:

# Research Vite's standard CSS handling
echo "=== Checking Vite documentation patterns in comments ==="
rg -i "vite.*css|css.*vite" --type ts --max-count 20

Repository: opentiny/tiny-pro

Length of output: 195


🏁 Script executed:

# Check for dynamic imports or require statements that might import CSS
echo "=== Checking for dynamic imports of CSS files ==="
rg "import\s*\(\s*['\"].*\.css" -C 2
rg "require\s*\(\s*['\"].*\.css" -C 2

# Check for any build error logs or issue comments
echo "=== Looking for issue/bug-related comments ==="
rg -i "bug|issue|fix|todo|hack|workaround" template/tinyvue/config/ -B 2 -A 2

# Check if @opentiny/vue-theme is being imported with .css in any way
echo "=== Checking theme imports more carefully ==="
rg "@opentiny/vue-theme" -C 3 | grep -i "\.css\|style\|theme" -B 2 -A 2

Repository: opentiny/tiny-pro

Length of output: 50374


🏁 Script executed:

# Check if this could be related to CommonJS or bundler compatibility
echo "=== Checking for CommonJS usage ==="
rg "require\(" template/tinyvue/config/ -C 2

# Look for any optimizeDeps includes/excludes that might hint at the reason
echo "=== Full optimizeDeps configuration ==="
cat template/tinyvue/config/vite.config.base.ts | sed -n '56,65p'

Repository: opentiny/tiny-pro

Length of output: 364


Remove .css from both resolve.extensions and optimizeDeps.esbuildOptions.resolveExtensions.

Adding .css to resolution extensions is unnecessary. Vite handles CSS imports automatically without requiring this configuration. The codebase contains no CSS imports or dynamic patterns that would require this setting. This may also cause unexpected module resolution behavior.

    extensions: ['.ts', '.js'],
    resolveExtensions: ['.ts', '.js'],
🤖 Prompt for AI Agents
In @template/tinyvue/config/vite.config.base.ts at line 50, Remove the
unnecessary ".css" entry from the module resolution lists: update the
resolve.extensions array in vite config (symbol: resolve.extensions) and the
optimizeDeps.esbuildOptions.resolveExtensions array (symbol:
optimizeDeps.esbuildOptions.resolveExtensions) to only include '.ts' and '.js'
so CSS is not treated as a resolution extension by Vite.

preserveSymlinks: false,
},
define: {
'BUILD_TOOLS': "'VITE'",
},
optimizeDeps: {
esbuildOptions: {
resolveExtensions: ['.ts', '.js', '.css'],
},
},
css: {
preprocessorOptions: {
less: {
Expand Down
32 changes: 26 additions & 6 deletions template/tinyvue/config/vite.config.dev.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
import { mergeConfig, loadEnv } from 'vite';
import eslint from 'vite-plugin-eslint';
import baseConfig from './vite.config.base';
import { resolve } from 'path';
import { configDotenv } from 'dotenv';

// 加载 dev.env 文件
configDotenv({
path: resolve(__dirname, '../dev.env'),
});

// 加载环境变量(development 模式会读取 .env.development 和 .env)
const env = loadEnv('development', process.cwd());

const proxyConfig = {
[loadEnv('', process.cwd()).VITE_BASE_API]: {
target: loadEnv('', process.cwd()).VITE_SERVER_HOST,
[env.VITE_BASE_API]: {
target: env.VITE_SERVER_HOST,
changeOrigin: true,
logLevel: 'debug',
rewrite: (path: string) =>
path.replace(
new RegExp(`${loadEnv('', process.cwd()).VITE_BASE_API}`),
new RegExp(`${env.VITE_BASE_API}`),
'',
),
},
[loadEnv('', process.cwd()).VITE_MOCK_SERVER_HOST]: {
target: loadEnv('', process.cwd()).VITE_SERVER_HOST,
[env.VITE_MOCK_SERVER_HOST]: {
target: env.VITE_SERVER_HOST,
changeOrigin: true,
rewrite: (path: string) => {

return path.replace(new RegExp(`${loadEnv('', process.cwd()).VITE_MOCK_SERVER_HOST}`), '/mock')
return path.replace(new RegExp(`${env.VITE_MOCK_SERVER_HOST}`), '/mock')
},
},
};
Comment on lines 15 to 34
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -name "vite.config.dev.ts" -o -name "vite.config.ts" | head -20

Repository: opentiny/tiny-pro

Length of output: 105


🏁 Script executed:

# Find the exact file and read it
fd -t f "vite.config" | grep -E "dev|vite" | head -10

Repository: opentiny/tiny-pro

Length of output: 387


🏁 Script executed:

# List files in template/tinyvue/config directory
ls -la template/tinyvue/config/ 2>/dev/null || find . -path "*/template/tinyvue/config*" -type d

Repository: opentiny/tiny-pro

Length of output: 719


🏁 Script executed:

cat -n template/tinyvue/config/vite.config.dev.ts

Repository: opentiny/tiny-pro

Length of output: 2138


🏁 Script executed:

# Also check the base config to understand env setup
cat -n template/tinyvue/config/vite.config.base.ts

Repository: opentiny/tiny-pro

Length of output: 2445


🏁 Script executed:

# Check for env files to see what patterns are used
find . -name ".env*" -o -name "dev.env" | head -20

Repository: opentiny/tiny-pro

Length of output: 392


🏁 Script executed:

# Look for the dev.env file mentioned in the code
cat template/tinyvue/dev.env 2>/dev/null || echo "File not found"

Repository: opentiny/tiny-pro

Length of output: 478


🏁 Script executed:

# Check if there's a .env.development file
cat template/tinyvue/.env.development 2>/dev/null || echo "File not found"

Repository: opentiny/tiny-pro

Length of output: 75


🏁 Script executed:

# Search for any .env files in template/tinyvue
find template/tinyvue -name ".env*" -o -name "*env*" | grep -E "\.(env|example)" | head -10

Repository: opentiny/tiny-pro

Length of output: 135


🏁 Script executed:

# Check for other usages of similar RegExp patterns in the codebase
rg "new RegExp" template/tinyvue/config/ -A 2 -B 2

Repository: opentiny/tiny-pro

Length of output: 734


🏁 Script executed:

# Verify that the env values are only in configuration files and not loaded from user input
rg "VITE_BASE_API|VITE_MOCK_SERVER_HOST" template/tinyvue/ --type ts --type js | head -20

Repository: opentiny/tiny-pro

Length of output: 2104


🏁 Script executed:

# Check if env variables can be overridden at runtime
git log --oneline -5 -- template/tinyvue/dev.env template/tinyvue/.env 2>/dev/null | head -10

Repository: opentiny/tiny-pro

Length of output: 86


🏁 Script executed:

# Double-check if there are any dynamic sources that could feed into these env values
rg "VITE_BASE_API|VITE_MOCK_SERVER_HOST" template/tinyvue -B 3 -A 1 --type ts | grep -E "(process\.env|process\.argv|require\(|import)" | head -20

Repository: opentiny/tiny-pro

Length of output: 2186


🏁 Script executed:

# Check if loadEnv can load from user input or just from .env files
rg "loadEnv" template/tinyvue --type ts -A 2 -B 2

Repository: opentiny/tiny-pro

Length of output: 2295


Simplify path replacement to improve code clarity.

The proxy configuration uses new RegExp() with environment variables to rewrite paths. While the actual vulnerability risk is minimal (the values are committed configuration: /api and /mock), using string replacement is simpler and equally effective for literal path patterns.

Consider using direct string replacement instead of RegExp on lines 21-24 and 31:

Suggested improvements
// Line 21-24: Instead of
rewrite: (path: string) =>
  path.replace(
    new RegExp(`${env.VITE_BASE_API}`),
    '',
  ),

// Use
rewrite: (path: string) => path.replace(env.VITE_BASE_API, ''),
// Line 31: Instead of
return path.replace(new RegExp(`${env.VITE_MOCK_SERVER_HOST}`), '/mock')

// Use
return path.replace(env.VITE_MOCK_SERVER_HOST, '/mock')

Both approaches replace only the first occurrence, so they're functionally equivalent.

🧰 Tools
🪛 ast-grep (0.40.3)

[warning] 21-21: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${env.VITE_BASE_API})
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 30-30: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${env.VITE_MOCK_SERVER_HOST})
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🤖 Prompt for AI Agents
In @template/tinyvue/config/vite.config.dev.ts around lines 15 - 34, The
proxyConfig rewrite handlers use RegExp constructions for simple literal path
replacements; update the two rewrite functions inside proxyConfig to use direct
string replacement instead of new RegExp: replace the rewrite for
env.VITE_BASE_API to use path.replace(env.VITE_BASE_API, '') and update the mock
rewrite to use path.replace(env.VITE_MOCK_SERVER_HOST, '/mock'), keeping the
same behavior but simplifying the code (look for proxyConfig and the rewrite
handlers referencing env.VITE_BASE_API and env.VITE_MOCK_SERVER_HOST).

Expand All @@ -34,6 +44,16 @@ export default mergeConfig(
...proxyConfig,
},
},
define: {
// 确保 VITE_LOWCODE_DESIGNER_ENABLED 被注入到客户端代码
'import.meta.env.VITE_LOWCODE_DESIGNER_ENABLED': JSON.stringify(
process.env.VITE_LOWCODE_DESIGNER_ENABLED || 'false'
),
// 确保 VITE_LOWCODE_DESIGNER_URL 被注入到客户端代码
'import.meta.env.VITE_LOWCODE_DESIGNER_URL': JSON.stringify(
process.env.VITE_LOWCODE_DESIGNER_URL || 'http://localhost:8090'
),
},
plugins: [
eslint({
include: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.vue'],
Expand Down
9 changes: 9 additions & 0 deletions template/tinyvue/config/vite.config.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ export default mergeConfig(
mode: 'production',
base: loadEnv('', process.cwd()).VITE_BASE || '/',
plugins: [configCompressPlugin('gzip'), configVisualizerPlugin()],
define: {
// 确保环境变量被注入到客户端代码
'import.meta.env.VITE_LOWCODE_DESIGNER_ENABLED': JSON.stringify(
process.env.VITE_LOWCODE_DESIGNER_ENABLED || 'false'
),
'import.meta.env.VITE_LOWCODE_DESIGNER_URL': JSON.stringify(
process.env.VITE_LOWCODE_DESIGNER_URL || '/designer'
),
},
build: {
rollupOptions: {
output: {
Expand Down
4 changes: 3 additions & 1 deletion template/tinyvue/dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ VITE_USE_MOCK= false
VITE_MOCK_IGNORE= /api/user/userInfo,/api/user/login,/api/user/register,/api/employee/getEmployee

VITE_MOCK_SERVER_HOST=/mock
VITE_LOWCODE_DESIGNER_ENABLED=false
VITE_LOWCODE_DESIGNER_ENABLED=true
# 设计器链接配置,开发环境默认为 http://localhost:8090,生产环境可配置为 /designer 或完整 URL
VITE_LOWCODE_DESIGNER_URL=http://localhost:8090
12 changes: 6 additions & 6 deletions template/tinyvue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
"@babel/core": "^7.25.2",
"@gaonengwww/mock-server": "^1.0.5",
"@opentiny/icons": "^0.1.3",
"@opentiny/vue": "^3.27.0",
"@opentiny/vue-huicharts": "^3.27.0",
"@opentiny/vue-icon": "^3.27.0",
"@opentiny/vue-locale": "^3.27.0",
"@opentiny/vue": "^3.28.0",
"@opentiny/vue-huicharts": "~3.28.0",
"@opentiny/vue-icon": "~3.28.0",
"@opentiny/vue-locale": "~3.28.0",
"@opentiny/vue-search-box": "^0.1.3",
"@opentiny/vue-theme": "^3.27.0",
"@opentiny/vue-theme": "~3.28.0",
Comment on lines +42 to +47
Copy link

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
# Check @opentiny/vue versions in all package.json files

echo "=== template/tinyvue/package.json (lines 40-50) ==="
if [ -f "template/tinyvue/package.json" ]; then
  sed -n '40,50p' template/tinyvue/package.json
else
  echo "File not found"
fi

echo -e "\n=== template/lowcode-designer/package.json ==="
if [ -f "template/lowcode-designer/package.json" ]; then
  cat template/lowcode-designer/package.json | jq '.dependencies | select(.) | to_entries[] | select(.key | startswith("@opentiny/vue")) | "\(.key): \(.value)"' 2>/dev/null || echo "No @opentiny/vue dependencies found or jq not available"
else
  echo "File not found"
fi

echo -e "\n=== Root package.json overrides ==="
if [ -f "package.json" ]; then
  cat package.json | jq '.pnpm.overrides | select(.)' 2>/dev/null || echo "No overrides found or jq not available"
else
  echo "File not found"
fi

Repository: opentiny/tiny-pro

Length of output: 1400


🏁 Script executed:

# Verify if tinyvue and lowcode-designer are separate deployments or shared
echo "=== Checking if templates are separate applications ==="
find template -name "package.json" -type f | while read f; do
  echo "File: $f"
  head -20 "$f" | grep -E "\"name\"|\"description\"" || echo "  (checking structure)"
done

echo -e "\n=== Checking for shared workspace configuration ==="
if [ -f "pnpm-workspace.yaml" ]; then
  cat pnpm-workspace.yaml
fi

Repository: opentiny/tiny-pro

Length of output: 476


🏁 Script executed:

# Check if templates share any dependencies or are meant to run together
echo "=== Checking template build/deployment configurations ==="
ls -la template/tinyvue/ | grep -E "\.config\.|tsconfig|vite|webpack|build"
echo ""
ls -la template/lowcode-designer/ | grep -E "\.config\.|tsconfig|vite|webpack|build"

echo -e "\n=== Checking if templates reference each other ==="
echo "tinyvue package.json dependencies:"
cat template/tinyvue/package.json | jq '.dependencies, .devDependencies | keys[]' 2>/dev/null | grep -i designer || echo "(no designer references)"

echo -e "\ndesigner-demo package.json dependencies:"
cat template/lowcode-designer/package.json | jq '.dependencies, .devDependencies | keys[]' 2>/dev/null | grep -i vue || echo "(no vue app references)"

echo -e "\n=== Checking root package.json bundling/deployment config ==="
cat package.json | jq '.scripts | to_entries[] | select(.key | contains("build") or contains("deploy"))' 2>/dev/null | head -20

Repository: opentiny/tiny-pro

Length of output: 1296


Version inconsistency: @opentiny/vue differs between templates.

The tinyvue template uses @opentiny/vue@^3.28.0 while the lowcode-designer template uses @opentiny/vue@~3.20.0. This inconsistency across the monorepo should be aligned to avoid maintenance issues and ensure consistent behavior across dependent packages.

Note: The root package.json overrides only apply to @opentiny/vue-renderless in conditional dependency chains (e.g., @opentiny/tiny-engine-common>@opentiny/vue-renderless), not to @opentiny/vue itself across the workspace.

Recommendation: Align @opentiny/vue versions across templates to use the same version range.

🤖 Prompt for AI Agents
In @template/tinyvue/package.json around lines 42 - 47, Update the @opentiny/vue
dependency in template/tinyvue/package.json to match the version range used
across templates (make it the same as lowcode-designer, e.g., change
"@opentiny/vue": "^3.28.0" to "@opentiny/vue": "~3.20.0" or to the agreed common
range) so all templates use a consistent @opentiny/vue version; modify the
dependency entry for "@opentiny/vue" accordingly and run a quick workspace
install to verify no version conflicts.

"@types/mockjs": "^1.0.10",
"@types/node": "^22.7.4",
"@vueuse/core": "^10.11.1",
Expand Down Expand Up @@ -136,4 +136,4 @@
"bin-wrapper": "npm:bin-wrapper-china",
"gifsicle": "5.2.0"
}
}
}
4 changes: 3 additions & 1 deletion template/tinyvue/src/components/navbar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@

// 设计器
const openLowCodeDesigner = () => {
window.open(`http://localhost:8090/?type=app&id=1&tenant=1&pageid=1`, '_blank');
// 支持通过环境变量配置设计器链接,默认为开发环境地址
const designerUrl = import.meta.env.VITE_LOWCODE_DESIGNER_URL || 'http://localhost:8090';
window.open(`${designerUrl}/?type=app&id=1&tenant=1&pageid=1`, '_blank');
};

// 用户设置
Expand Down
1 change: 1 addition & 0 deletions template/tinyvue/src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ declare global {
readonly VITE_API_BASE_URL: string;
readonly VITE_MOCK_SERVER_HOST: string;
readonly VITE_LOWCODE_DESIGNER_ENABLED: string;
readonly VITE_LOWCODE_DESIGNER_URL: string;
readonly VITE_CONTEXT: string;
readonly VITE_BASE_API: string;
readonly VITE_SERVER_HOST: string;
Expand Down
Loading