Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(chart): modify chart package #2365

Merged
merged 2 commits into from
Oct 24, 2024
Merged
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
22 changes: 8 additions & 14 deletions internals/cli/src/commands/build/build-chart-theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ const changeTheme = () => {
const THEMES = {
dark: 'dark',
light: 'light',
bpit: 'bpit_light',
bpit_dark: 'bpit_dark',
cloud_dark: 'cloud_dark',
cloud: 'cloud_light',
hdesign: 'hdesign_light',
hdesign_dark: 'hdesign_dark'
bpit: 'bpit-light',
bpit_dark: 'bpit-dark',
cloud_dark: 'cloud-dark',
cloud: 'cloud-light',
hdesign: 'hdesign-light',
hdesign_dark: 'hdesign-dark'
}

// 获取命令行参数
Expand All @@ -22,19 +22,13 @@ const changeTheme = () => {
}

// 你想要替换的文件
const filePath = path.join(
__dirname,
'../../../../../packages/vue/src/huicharts/huicharts-core/src/chart-core.ts'
)
const filePath = path.join(__dirname, '../../../../../packages/vue/src/huicharts/huicharts-core/src/chart-core.ts')

// 读取文件内容
let content = fs.readFileSync(filePath, 'utf-8')

// 替换 process.env.VAR_NAME 为对应主题的值
content = content.replace(
/option\.theme\s=\s'[a-zA-Z_]+'/g,
`option.theme = '${theme}'`
)
content = content.replace(/option\.theme\s=\s'[a-zA-Z_-]+'/g, `option.theme = '${theme}'`)

// 写入新内容到文件
fs.writeFileSync(filePath, content, 'utf-8')
Expand Down
Loading