chore(docs): 版本同步文档脚本
This commit is contained in:
parent
cc7c632af6
commit
c92b045c8a
@ -223,8 +223,16 @@ function nav(): DefaultTheme.NavItem[] {
|
|||||||
text: version,
|
text: version,
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
link: './changelog',
|
link: './renderer/CHANGELOG',
|
||||||
text: '更新日志',
|
text: '渲染器更新日志',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
link: './designer/CHANGELOG',
|
||||||
|
text: '设计器更新日志',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
link: './platform/CHANGELOG',
|
||||||
|
text: '悦码平台更新日志',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
link: 'https://doc.weixin.qq.com/smartsheet/s3_Aa0ASwZ0AOEr2TbPuaMRoCvs1yzjA?scode=AOwAYgeoAAkoT6VFa0Aa0ASwZ0AOE&tab=q979lj&viewId=vpDUFs',
|
link: 'https://doc.weixin.qq.com/smartsheet/s3_Aa0ASwZ0AOEr2TbPuaMRoCvs1yzjA?scode=AOwAYgeoAAkoT6VFa0Aa0ASwZ0AOE&tab=q979lj&viewId=vpDUFs',
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vitepress build && node scripts/after-build.mjs",
|
"build": "node scripts/before-build.mjs && vitepress build && node scripts/after-build.mjs",
|
||||||
"build:staging": "pnpm build",
|
"build:staging": "pnpm build",
|
||||||
"preview": "vitepress preview",
|
"preview": "vitepress preview",
|
||||||
"dev": "vitepress dev",
|
"dev": "vitepress dev",
|
||||||
|
61
apps/docs/scripts/before-build.mjs
Normal file
61
apps/docs/scripts/before-build.mjs
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
import fs from 'node:fs';
|
||||||
|
import path from 'node:path';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
|
// 获取当前脚本的目录
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
// 需要处理的应用列表
|
||||||
|
const appsToProcess = ['renderer', 'designer', 'platform'];
|
||||||
|
|
||||||
|
// 复制CHANGELOG.md文件
|
||||||
|
function copyChangelogFile(appName) {
|
||||||
|
const changelogSrcPath = path.resolve(
|
||||||
|
process.cwd(),
|
||||||
|
`../${appName}/CHANGELOG.md`,
|
||||||
|
);
|
||||||
|
const changelogDestDir = path.resolve(__dirname, `../src/${appName}`);
|
||||||
|
const changelogDestPath = path.resolve(changelogDestDir, 'CHANGELOG.md');
|
||||||
|
|
||||||
|
console.log(`正在复制${appName}的CHANGELOG.md文件...`);
|
||||||
|
|
||||||
|
// 检查源文件是否存在
|
||||||
|
if (!fs.existsSync(changelogSrcPath)) {
|
||||||
|
console.warn(
|
||||||
|
`⚠️ 警告:${appName}的CHANGELOG文件 "${changelogSrcPath}" 不存在!`,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保目标目录存在
|
||||||
|
if (!fs.existsSync(changelogDestDir)) {
|
||||||
|
console.log(`创建目标目录 "${changelogDestDir}"...`);
|
||||||
|
fs.mkdirSync(changelogDestDir, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
// 复制文件
|
||||||
|
try {
|
||||||
|
fs.copyFileSync(changelogSrcPath, changelogDestPath);
|
||||||
|
console.log(
|
||||||
|
`✅ 成功将${appName}的CHANGELOG.md复制到 "${changelogDestPath}"`,
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
`❌ 复制${appName}的CHANGELOG.md时发生错误:${error.message}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 复制各个应用的CHANGELOG.md文件
|
||||||
|
for (const app of appsToProcess) {
|
||||||
|
copyChangelogFile(app);
|
||||||
|
}
|
||||||
|
console.log(`✅ 所有CHANGELOG.md文件复制完成`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`❌ 复制过程中发生错误:${error.message}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
7
apps/docs/src/designer/CHANGELOG.md
Normal file
7
apps/docs/src/designer/CHANGELOG.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# @sy/y-code-designer
|
||||||
|
|
||||||
|
## 1.0.0
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- project changeset init
|
11
apps/docs/src/platform/CHANGELOG.md
Normal file
11
apps/docs/src/platform/CHANGELOG.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# @sy/y-code-platform
|
||||||
|
|
||||||
|
## 1.0.0
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- project changeset init
|
||||||
|
- Updated dependencies
|
||||||
|
- @sy/wujie-vue3-renderer-adapter@1.0.0
|
||||||
|
- @sy/vue3-renderer-adapter@1.0.0
|
||||||
|
- @sy/web-vitals@1.0.0
|
7
apps/docs/src/renderer/CHANGELOG.md
Normal file
7
apps/docs/src/renderer/CHANGELOG.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# @sy/y-code-renderer
|
||||||
|
|
||||||
|
## 1.0.0
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- project changeset init
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "y-code-matrix",
|
"name": "y-code-matrix",
|
||||||
"version": "1.0.0-alpha.1",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"monorepo",
|
"monorepo",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user