Skip to content

Commit 365c7e8

Browse files
authored
fix(chart): modify chart package (#2365)
* fix: 图表打包指令修改 * fix: 图表打包指令修改
1 parent b7845f1 commit 365c7e8

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

internals/cli/src/commands/build/build-chart-theme.ts

+8-14
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ const changeTheme = () => {
55
const THEMES = {
66
dark: 'dark',
77
light: 'light',
8-
bpit: 'bpit_light',
9-
bpit_dark: 'bpit_dark',
10-
cloud_dark: 'cloud_dark',
11-
cloud: 'cloud_light',
12-
hdesign: 'hdesign_light',
13-
hdesign_dark: 'hdesign_dark'
8+
bpit: 'bpit-light',
9+
bpit_dark: 'bpit-dark',
10+
cloud_dark: 'cloud-dark',
11+
cloud: 'cloud-light',
12+
hdesign: 'hdesign-light',
13+
hdesign_dark: 'hdesign-dark'
1414
}
1515

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

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

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

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

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

0 commit comments

Comments
 (0)