Skip to content

feat(release): add vue3 version option to release:aurora command and update related logic #3280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions internals/cli/src/commands/release/releaseAurora.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fs from 'fs-extra'
const onlyMobileFirstTemplateLists = ['popconfirm', 'card', 'card-group']

// 递归遍历所有的组件,然后依次修改文件内容
const findAllpage = (packagesPath) => {
const findAllpage = (packagesPath, vue3version) => {
if (
packagesPath.includes('.png') ||
packagesPath.includes('.gif') ||
Expand All @@ -21,7 +21,7 @@ const findAllpage = (packagesPath) => {
if (fs.statSync(packagesPath).isDirectory()) {
// 循环递归查找子文件夹
fs.readdirSync(packagesPath).forEach((childPatch) => {
findAllpage(path.join(packagesPath, childPatch))
findAllpage(path.join(packagesPath, childPatch), vue3version)
})
} else {
const content = fs.readFileSync(packagesPath).toString('UTF-8' as BufferEncoding)
Expand All @@ -42,6 +42,10 @@ const findAllpage = (packagesPath) => {
.replace(/@aurora\/fluent-editor/g, '@opentiny/fluent-editor')
.replace(/@aurora\/huicharts/g, '@opentiny/huicharts')

if (vue3version) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the vue3version parameter is correctly passed and utilized throughout the function to prevent any unexpected behavior when the Vue 3 version is specified.

result = result.replace(/@aurora\/vue/g, '@aurora/vue3')
}

// 解决当AUI只有一个mobile-first模板而TinyVue有多个模板,导致Linkjs加载不到多端模板的问题
if (
packagesPath.endsWith('index.js') &&
Expand All @@ -54,7 +58,7 @@ const findAllpage = (packagesPath) => {
}
}

export const releaseAurora = () => {
export const releaseAurora = ({ vue3version }) => {
const distLists = [
'dist2/@aurora',
'renderless/dist',
Expand All @@ -65,7 +69,12 @@ export const releaseAurora = () => {
'vue-hooks/dist',
'vue-hooks/package.json'
]

if (vue3version) {
distLists.push('dist3/@aurora')
}

distLists.forEach((item) => {
findAllpage(pathFromPackages(item))
findAllpage(pathFromPackages(item), vue3version)
})
}
21 changes: 6 additions & 15 deletions internals/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#!/usr/bin/env node
import { Command, Option } from 'commander'
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 { releaseAlpha } from './commands/release/releaseAlpha'
import { releaseE2EConfig } from './commands/release/releaseE2EConfig'

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
.command('release:alpha')
Expand All @@ -24,8 +28,6 @@ program

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:chartTheme').description('切换chart主题').action(chartTheme)
Expand All @@ -52,15 +54,4 @@ program
.option('--tiny_mode', '输出的模板类型', 'pc')
.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()
Loading