From 6d67f41462f5d3a97db6e2ac60b82ce049bc16d7 Mon Sep 17 00:00:00 2001 From: ajaxzheng <894103554@qq.com> Date: Thu, 10 Apr 2025 20:45:21 +0800 Subject: [PATCH] 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 --- .../cli/src/commands/release/releaseAurora.ts | 17 +++++++++++---- internals/cli/src/index.ts | 21 ++++++------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/internals/cli/src/commands/release/releaseAurora.ts b/internals/cli/src/commands/release/releaseAurora.ts index 649fe0dbbb..8bfaa14a68 100644 --- a/internals/cli/src/commands/release/releaseAurora.ts +++ b/internals/cli/src/commands/release/releaseAurora.ts @@ -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') || @@ -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) @@ -42,6 +42,10 @@ const findAllpage = (packagesPath) => { .replace(/@aurora\/fluent-editor/g, '@opentiny/fluent-editor') .replace(/@aurora\/huicharts/g, '@opentiny/huicharts') + if (vue3version) { + result = result.replace(/@aurora\/vue/g, '@aurora/vue3') + } + // 解决当AUI只有一个mobile-first模板而TinyVue有多个模板,导致Linkjs加载不到多端模板的问题 if ( packagesPath.endsWith('index.js') && @@ -54,7 +58,7 @@ const findAllpage = (packagesPath) => { } } -export const releaseAurora = () => { +export const releaseAurora = ({ vue3version }) => { const distLists = [ 'dist2/@aurora', 'renderless/dist', @@ -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) }) } diff --git a/internals/cli/src/index.ts b/internals/cli/src/index.ts index aa318d0c38..938939e040 100644 --- a/internals/cli/src/index.ts +++ b/internals/cli/src/index.ts @@ -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') @@ -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) @@ -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 ', '目标格式,默认 ["es"]').choices(['es', 'cjs'])) - .addOption(new Option('-t --build-target ', '组件的目标版本')) - .option('-s, --scope ', 'npm scope,默认是 opentiny,会以 @opentiny 发布到 npm') - .option('-c, --clean', '清空构建目录') - .option('--no-dts', '不生成 dts') - .action(buildReact) - program.parse()