Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
9 changes: 9 additions & 0 deletions internals/automate/src/build-svg-to-js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ interface FileInfo {
const camelize = (str) => str.replace(/-(\w)/g, (_, c) => (c ? c.toUpperCase() : ''))
const isSaas = process.argv.includes('--icon-saas')
const { svgsPath, iconsPath, rewriteConfig } = isSaas ? configSaas : config
const iconsSrcPath = `${iconsPath}/src`

// 生成前清理旧的图标产物,避免目录缺失导致写入失败
try {
fs.rmSync(iconsSrcPath, { recursive: true, force: true })
} catch (error) {
console.warn(`[build-svg-to-js] 清理目录失败: ${iconsSrcPath}`, error)
}
fs.mkdirSync(iconsSrcPath, { recursive: true })

// 1、统计svgs信息
const svgsMap: Record<string, FileInfo> = {}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"// ---------- 打包运行时组件库 ----------": "",
"build:runtime": "pnpm create:icon-saas && pnpm -C internals/cli build:runtime",
"// ---------- 构建相关脚本 ----------": "",
"build:ui": "pnpm create:icon-saas && pnpm create:mapping && pnpm build:entry && pnpm -C internals/cli build:ui",
"build:ui": "pnpm build:svgs2iconSaas && pnpm create:mapping && pnpm build:entry && pnpm -C internals/cli build:ui",
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

Verify consistency with the build:runtime script.

The change from create:icon-saas to build:svgs2iconSaas aligns with the cleanup logic added to prevent build failures. However, the build:runtime script on line 56 still uses create:icon-saas. If build:runtime encounters similar build issues, consider updating it consistently.

Run the following script to examine what these scripts actually execute:


🏁 Script executed:

#!/bin/bash
# Check what the create:icon-saas command does in internals/cli
# and compare with build-svgs-saas in internals/automate

echo "=== Checking internals/cli for create:icon-saas ==="
fd -t f "package.json" internals/cli --exec cat {} | jq -r '.scripts["create:icon-saas"]'

echo -e "\n=== Checking internals/automate for build-svgs-saas ==="
fd -t f "package.json" internals/automate --exec cat {} | jq -r '.scripts["build-svgs-saas"]'

echo -e "\n=== Checking if build:runtime might need the same fix ==="
cat package.json | jq -r '.scripts["build:runtime"]'

Length of output: 374


I need to examine the root package.json more carefully to understand the create:icon-saas script and its relationship to both build scripts.


---

🏁 Script executed:

```shell
#!/bin/bash
# Extract all scripts from root package.json
echo "=== Root package.json scripts ==="
cat package.json | jq '.scripts | keys_unsorted[]'

echo -e "\n=== Details of create:icon-saas script ==="
cat package.json | jq '.scripts["create:icon-saas"]'

echo -e "\n=== Details of build:ui script ==="
cat package.json | jq '.scripts["build:ui"]'

echo -e "\n=== Details of build:runtime script ==="
cat package.json | jq '.scripts["build:runtime"]'

echo -e "\n=== Details of build:svgs2iconSaas script ==="
cat package.json | jq '.scripts["build:svgs2iconSaas"]'

Length of output: 1791


Update build:runtime script to use build:svgs2iconSaas for consistency.

The build:ui script was changed to call build:svgs2iconSaas (which routes through internals/automate build-svgs-saas), but build:runtime still calls create:icon-saas (which attempts to invoke a non-existent script in internals/cli). Update line 56 from pnpm create:icon-saas && pnpm -C internals/cli build:runtime to pnpm build:svgs2iconSaas && pnpm -C internals/cli build:runtime to prevent build failures.

🤖 Prompt for AI Agents
In package.json around lines 56-58, the build:runtime script still invokes "pnpm
create:icon-saas" which calls a non-existent internals/cli script; replace that
segment with "pnpm build:svgs2iconSaas" so the build:runtime script becomes
consistent with build:ui and routes through internals/automate build-svgs-saas
before running "pnpm -C internals/cli build:runtime".

"build:chartTheme": "pnpm -C internals/cli build:chartTheme",
"build:renderless": "pnpm -C packages/renderless build:fast",
"build:theme": "pnpm -C packages/theme build:fast",
Expand Down
Loading