Merge branch 'main' into next

This commit is contained in:
nocobase[bot] 2025-04-22 05:11:21 +00:00
commit 5eb337bd7a

View File

@ -29,14 +29,13 @@ export default (app: Application) => {
'migrations', 'migrations',
`${dayjs().format('YYYYMMDDHHmmss')}-${name}.ts`, `${dayjs().format('YYYYMMDDHHmmss')}-${name}.ts`,
); );
const version = app.getVersion(); const version = app.getPackageVersion();
// 匹配主版本号、次版本号、小版本号和后缀的正则表达式
const regex = /(\d+)\.(\d+)\.(\d+)(-[\w.]+)?/; const regex = /(\d+)\.(\d+)\.(\d+)(-[\w.]+)?/;
const nextVersion = version.replace(regex, (match, major, minor, patch, suffix) => { const nextVersion = version.replace(regex, (match, major, minor, patch, suffix) => {
// 将小版本号转换为整数并加1 if (version.includes('beta') || version.includes('alpha')) {
const newPatch = parseInt(patch) + 1; return `${major}.${minor}.${patch}`;
// 返回新的版本号 }
return `${major}.${minor}.${newPatch}${suffix || ''}`; return `${major}.${1 + 1 * minor}.0`;
}); });
const from = pkg === '@nocobase/server' ? `../migration` : '@nocobase/server'; const from = pkg === '@nocobase/server' ? `../migration` : '@nocobase/server';
const data = `import { Migration } from '${from}'; const data = `import { Migration } from '${from}';