Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-ui
Commits
4f93f0f5
提交
4f93f0f5
authored
7月 10, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(version): 测试主版本发布
上级
e37b2abe
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
67 行增加
和
8 行删除
+67
-8
CHANGELOG.md
CHANGELOG.md
+0
-0
version.js
src/version.js
+19
-2
updateVersion.js
updateVersion.js
+48
-6
没有找到文件。
CHANGELOG.md
浏览文件 @
4f93f0f5
差异被折叠。
点击展开。
src/version.js
浏览文件 @
4f93f0f5
console
.
log
(
'23412313ccc'
)
\ No newline at end of file
console
.
log
(
'23412313cccsadfdasf'
)
let
obj
=
{
'0.1.8'
:
[
{
info
:
'新功能'
,
desc
:
[
'新版本文件保存测试'
]
},
{
info
:
'Bug 修复'
,
desc
:
[
'bug 修改测试'
]
},
{
info
:
'风格'
,
desc
:
[
'测试样式变更'
]
},
{
info
:
'重构'
,
desc
:
[
'重构测试'
]
}
]
}
\ No newline at end of file
updateVersion.js
浏览文件 @
4f93f0f5
import
fs
from
'fs'
const
packagePath
=
'./package.json'
const
packageData
=
JSON
.
parse
(
fs
.
readFileSync
(
packagePath
,
'utf-8'
))
function
parseChangelog
(
changelogText
)
{
const
result
=
{};
const
versionRegex
=
/^###
\[([\d
.
]
+
)\]\([^
)
]
+
\)
/
;
const
sectionRegex
=
/^###
(
.*
?)
\|
(
.*
)
$/
;
const
descRegex
=
/^
\*
\*\*(
.*
?)
:
?\*\*
(
.*
?)
\(
/
;
let
currentVersion
=
null
;
let
currentSection
=
null
;
const
lines
=
changelogText
.
split
(
'
\
n'
);
for
(
const
line
of
lines
)
{
// 检查是否是版本行
const
versionMatch
=
line
.
match
(
versionRegex
);
if
(
versionMatch
)
{
currentVersion
=
versionMatch
[
1
];
result
[
currentVersion
]
=
[];
continue
;
}
// 如果不是版本行但有当前版本,则检查是否是章节行
if
(
currentVersion
)
{
const
sectionMatch
=
line
.
match
(
sectionRegex
);
if
(
sectionMatch
)
{
currentSection
=
{
info
:
sectionMatch
[
2
],
desc
:
[]
};
result
[
currentVersion
].
push
(
currentSection
);
continue
;
}
// 检查是否是描述行
const
descMatch
=
line
.
match
(
descRegex
);
if
(
descMatch
&&
currentSection
)
{
const
description
=
descMatch
[
2
].
trim
();
currentSection
.
desc
.
push
(
description
);
}
}
}
return
result
;
}
const
changelog
=
'./CHANGELOG.md'
const
changeData
=
fs
.
readFileSync
(
changelog
,
'utf-8'
)
console
.
log
(
changeData
)
const
newChangeData
=
changeData
.
replace
(
'## 0.1.5'
,
`##
${
packageData
.
version
}
`
)
console
.
log
(
packageData
.
version
)
// fs.writeFileSync(packagePath, JSON.stringify(packageData, null, 2))
const
result
=
parseChangelog
(
changeData
)
console
.
log
(
result
)
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论