feat(release): add vue3 version option to release:aurora command and update related logic; modify the names of multiple packages to adapt to the new naming convention (#3280)

This commit is contained in:
ajaxzheng 2025-04-11 11:10:00 +08:00 committed by GitHub
parent fc2b2f8743
commit 9148902d4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 19 deletions

View File

@ -5,7 +5,7 @@ import fs from 'fs-extra'
const onlyMobileFirstTemplateLists = ['popconfirm', 'card', 'card-group'] const onlyMobileFirstTemplateLists = ['popconfirm', 'card', 'card-group']
// 递归遍历所有的组件,然后依次修改文件内容 // 递归遍历所有的组件,然后依次修改文件内容
const findAllpage = (packagesPath) => { const findAllpage = (packagesPath, vue3version) => {
if ( if (
packagesPath.includes('.png') || packagesPath.includes('.png') ||
packagesPath.includes('.gif') || packagesPath.includes('.gif') ||
@ -21,7 +21,7 @@ const findAllpage = (packagesPath) => {
if (fs.statSync(packagesPath).isDirectory()) { if (fs.statSync(packagesPath).isDirectory()) {
// 循环递归查找子文件夹 // 循环递归查找子文件夹
fs.readdirSync(packagesPath).forEach((childPatch) => { fs.readdirSync(packagesPath).forEach((childPatch) => {
findAllpage(path.join(packagesPath, childPatch)) findAllpage(path.join(packagesPath, childPatch), vue3version)
}) })
} else { } else {
const content = fs.readFileSync(packagesPath).toString('UTF-8' as BufferEncoding) const content = fs.readFileSync(packagesPath).toString('UTF-8' as BufferEncoding)
@ -42,6 +42,10 @@ const findAllpage = (packagesPath) => {
.replace(/@aurora\/fluent-editor/g, '@opentiny/fluent-editor') .replace(/@aurora\/fluent-editor/g, '@opentiny/fluent-editor')
.replace(/@aurora\/huicharts/g, '@opentiny/huicharts') .replace(/@aurora\/huicharts/g, '@opentiny/huicharts')
if (vue3version) {
result = result.replace(/@aurora\/vue/g, '@aurora/vue3')
}
// 解决当AUI只有一个mobile-first模板而TinyVue有多个模板导致Linkjs加载不到多端模板的问题 // 解决当AUI只有一个mobile-first模板而TinyVue有多个模板导致Linkjs加载不到多端模板的问题
if ( if (
packagesPath.endsWith('index.js') && packagesPath.endsWith('index.js') &&
@ -54,7 +58,7 @@ const findAllpage = (packagesPath) => {
} }
} }
export const releaseAurora = () => { export const releaseAurora = ({ vue3version }) => {
const distLists = [ const distLists = [
'dist2/@aurora', 'dist2/@aurora',
'renderless/dist', 'renderless/dist',
@ -65,7 +69,12 @@ export const releaseAurora = () => {
'vue-hooks/dist', 'vue-hooks/dist',
'vue-hooks/package.json' 'vue-hooks/package.json'
] ]
if (vue3version) {
distLists.push('dist3/@aurora')
}
distLists.forEach((item) => { distLists.forEach((item) => {
findAllpage(pathFromPackages(item)) findAllpage(pathFromPackages(item), vue3version)
}) })
} }

View File

@ -1,14 +1,18 @@
#!/usr/bin/env node #!/usr/bin/env node
import { Command, Option } from 'commander' import { Command, Option } from 'commander'
import { createIconSaas } from './commands/create/index.js' import { createIconSaas } from './commands/create/index.js'
import { buildUi, buildEntry, buildRuntime, buildReact, buildEntryReact, chartTheme } from './commands/build' import { buildUi, buildEntry, buildRuntime, chartTheme } from './commands/build'
import { releaseAurora } from './commands/release/releaseAurora' import { releaseAurora } from './commands/release/releaseAurora'
import { releaseAlpha } from './commands/release/releaseAlpha' import { releaseAlpha } from './commands/release/releaseAlpha'
import { releaseE2EConfig } from './commands/release/releaseE2EConfig' import { releaseE2EConfig } from './commands/release/releaseE2EConfig'
const program = new Command() const program = new Command()
program.command('release:aurora').description('转换为aurora的包').action(releaseAurora) program
.command('release:aurora')
.description('转换为aurora的包')
.option('-v3, --vue3version', '是否使用vue3版本', false)
.action(releaseAurora)
program program
.command('release:alpha') .command('release:alpha')
@ -24,8 +28,6 @@ program
program.command('create:icon-saas').description('同步生成 icon-saas').action(createIconSaas) program.command('create:icon-saas').description('同步生成 icon-saas').action(createIconSaas)
program.command('build:entry-react').description('生成 react 组件库入口').action(buildEntryReact)
program.command('build:entry').description('生成组件库入口').action(buildEntry) program.command('build:entry').description('生成组件库入口').action(buildEntry)
program.command('build:chartTheme').description('切换chart主题').action(chartTheme) program.command('build:chartTheme').description('切换chart主题').action(chartTheme)
@ -52,15 +54,4 @@ program
.option('--tiny_mode', '输出的模板类型', 'pc') .option('--tiny_mode', '输出的模板类型', 'pc')
.action(buildRuntime) .action(buildRuntime)
program
.command('build:react')
.description('打包 react 组件库')
.argument('[names...]', '构建指定组件,如 button alert不指定则构建全量组件')
.addOption(new Option('-f --formats <formats...>', '目标格式,默认 ["es"]').choices(['es', 'cjs']))
.addOption(new Option('-t --build-target <buildTarget>', '组件的目标版本'))
.option('-s, --scope <scope>', 'npm scope默认是 opentiny会以 @opentiny 发布到 npm')
.option('-c, --clean', '清空构建目录')
.option('--no-dts', '不生成 dts')
.action(buildReact)
program.parse() program.parse()