From 5a6285228f283d73881e79a8d7e724a640b3031f Mon Sep 17 00:00:00 2001 From: ajaxzheng <894103554@qq.com> Date: Wed, 14 May 2025 18:09:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E4=BD=BF=E7=94=A8=E7=9A=84sync-icons=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E5=92=8C=E7=9B=B8=E5=85=B3=E6=96=87=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E7=AE=80=E5=8C=96=E9=A1=B9=E7=9B=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internals/cli/package.json | 5 +- internals/cli/src/commands/sync/sync-icons.ts | 106 ------------------ package.json | 1 - packages/modules.json | 32 +++--- 4 files changed, 20 insertions(+), 124 deletions(-) delete mode 100644 internals/cli/src/commands/sync/sync-icons.ts diff --git a/internals/cli/package.json b/internals/cli/package.json index 2c68c376f9..71bcd19ded 100644 --- a/internals/cli/package.json +++ b/internals/cli/package.json @@ -12,12 +12,10 @@ "build": "tsup", "// -------注意带 # 开头的脚本命令不要直接执行------- ": "", "build:entry": "esno src/index.ts build:entry", - "#build:entry1": "node dist/index.js build:entry", "build:entry-app": "esno src/commands/build/build-entry-app.ts", "// ---------------------build 构建--------------------- ": "", "build:ui": "esno src/index.ts build:ui", - "build:ui1": "pnpm build && node dist/index.js build:ui", - "// #build:runtime-vue 构建适用于 Vue2/Vue3 的组件 Runtime (按需加载)": "", + "// 构建适用于 Vue2/Vue3 的组件 Runtime (按需加载)": "", "build:runtime": "pnpm build:entry-app && esno src/index.ts build:runtime", "// ---------------------全局适配@aurora包名--------------------- ": "", "release:aurora": "esno src/index.ts release:aurora", @@ -25,7 +23,6 @@ "release:e2eConfig": "esno src/index.ts release:e2eConfig", "// ----------------------辅助脚本---------------------- ": "", "create:ui": "esno src/commands/create/create-ui.ts", - "sync-icons": "esno src/commands/create/sync-icons.ts", "create:icon-saas": "esno src/index.ts create:icon-saas", "clean:build": "esno src/commands/clean.ts", "create:mapping": "esno src/commands/create/create-mapping.ts", diff --git a/internals/cli/src/commands/sync/sync-icons.ts b/internals/cli/src/commands/sync/sync-icons.ts deleted file mode 100644 index 722d964a92..0000000000 --- a/internals/cli/src/commands/sync/sync-icons.ts +++ /dev/null @@ -1,106 +0,0 @@ -/** - * 初始化/创建 ICON 组件,从 @opentiny/vue-theme/svgs 中提取 SVG 图标创建对应的 ICON 组件 - */ -import path from 'node:path' -import fs from 'fs-extra' -import semver from 'semver' -import { EOL } from 'node:os' -import handlebarsRender from '../build/handlebars.render' -import { - pathJoin, - logYellow, - getopentinyVersion, - capitalizeKebabCase, - prettierFormat, - logGreen, - logRed, - templatePath -} from '../../shared/utils' - -const svgRE = /\.svg$/ -const svgDir = pathJoin('..', 'node_modules', '@opentiny', 'theme', 'svgs') -const iconDir = pathJoin('..', 'packages', 'icon') -const packageJson = 'package.json' - -// 检查是否安装依赖包 -if (!fs.existsSync(svgDir)) { - logYellow('The @opentiny/vue-theme is not exist , please npm install @opentiny/vue-theme.') -} - -// 是否包含 package/icon 目录 -if (!fs.existsSync(iconDir)) { - fs.mkdirSync(iconDir) - - const version = getopentinyVersion({ key: 'version' }) - const iconTemplate = fs.readJSONSync(path.join(templatePath, 'component', packageJson)) - - // 删除多余的依赖 - if (iconTemplate.dependencies) { - delete iconTemplate.dependencies['@opentiny/vue-renderless'] - } - - const packageContent = handlebarsRender({ - template: JSON.stringify(iconTemplate), - data: { - NAME: 'icon', - MINOR: semver.minor(version) - }, - delimiter: ['\\[\\[', '\\]\\]'] - }) - - fs.writeFileSync(path.join(iconDir, packageJson), packageContent) -} - -const exportComponents: string[] = [] -const exportIcons: string[] = [] -const componentTemplate = fs.readFileSync(path.join(templatePath, 'icon', 'index.ts'), { encoding: 'utf8' }) - -// 根据 @opentiny/vue-theme/svgs 中的 svg 图片创建对应的 icon 组件 -fs.readdirSync(svgDir).forEach((fileName) => { - if (svgRE.test(fileName)) { - const svgName = fileName.replace(svgRE, '') - const iconPath = path.join(iconDir, svgName) - - if (!fs.existsSync(iconPath)) { - fs.mkdirSync(iconPath) - - const iconName = capitalizeKebabCase(svgName) - const fullIconName = `Icon${iconName}` - const iconEntryContent = handlebarsRender({ - template: componentTemplate, - data: { - CNAME: iconName, - SNAME: fileName - }, - delimiter: ['\\[\\[', '\\]\\]'] - }) - - fs.writeFileSync(path.join(iconPath, 'index.ts'), prettierFormat({ str: iconEntryContent })) - - exportComponents.push(`import ${fullIconName} from './${svgName}'`) - exportIcons.push(fullIconName) - } - } -}) - -if (exportComponents.length) { - fs.writeFileSync( - path.join(iconDir, 'index.ts'), - prettierFormat({ - str: `${exportComponents.join(EOL)} - - export { - ${exportIcons.join(',' + EOL)} - } - - export default { - ${exportIcons.join(',' + EOL)} - } - ` - }) - ) - - logGreen('npm run create:icon done.') -} else { - logRed('npm run create:icon fail.') -} diff --git a/package.json b/package.json index a326650526..4bdf282726 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,6 @@ "create:icon-saas": "pnpm -C internals/cli create:icon-saas", "// ---------- 创建组件和模板打包入口 ----------": "", "create:mapping": "pnpm -C internals/cli create:mapping", - "sync-icons": "pnpm -C internals/cli sync-icons", "build:entry-app": "pnpm -C internals/cli build:entry-app", "// ---------- 打包运行时组件库 ----------": "", "build:runtime": "pnpm create:icon-saas && pnpm -C internals/cli build:runtime", diff --git a/packages/modules.json b/packages/modules.json index 8077ac1b24..2d40bbe646 100644 --- a/packages/modules.json +++ b/packages/modules.json @@ -1689,6 +1689,19 @@ "pc" ] }, + "NumberAnimation": { + "path": "vue/src/number-animation/index.ts", + "type": "component", + "exclude": false, + "mode": [ + "pc" + ] + }, + "NumberAnimationPc": { + "path": "vue/src/number-animation/src/pc.vue", + "type": "template", + "exclude": false + }, "Numeric": { "path": "vue/src/numeric/index.ts", "type": "component", @@ -1708,19 +1721,6 @@ "type": "template", "exclude": false }, - "NumberAnimation": { - "path": "vue/src/number-animation/index.ts", - "type": "component", - "exclude": false, - "mode": [ - "pc" - ] - }, - "NumberAnimationPc": { - "path": "vue/src/number-animation/src/pc.vue", - "type": "template", - "exclude": false - }, "Option": { "path": "vue/src/option/index.ts", "type": "component", @@ -2534,6 +2534,12 @@ "type": "template", "exclude": false }, + "Test": { + "path": "vue/src/Test/src/undefined.vue", + "type": "template", + "exclude": false, + "mode": "all" + }, "TextPopup": { "path": "vue/src/text-popup/index.ts", "type": "component", From f9af17d5d785ef2f8c5edd13076e2c153cfa9d37 Mon Sep 17 00:00:00 2001 From: ajaxzheng <894103554@qq.com> Date: Wed, 14 May 2025 18:28:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore(modules):=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E6=9C=AA=E4=BD=BF=E7=94=A8=E7=9A=84Test=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E6=A8=A1=E5=9D=97=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/modules.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/modules.json b/packages/modules.json index 2d40bbe646..1c68610838 100644 --- a/packages/modules.json +++ b/packages/modules.json @@ -2534,12 +2534,6 @@ "type": "template", "exclude": false }, - "Test": { - "path": "vue/src/Test/src/undefined.vue", - "type": "template", - "exclude": false, - "mode": "all" - }, "TextPopup": { "path": "vue/src/text-popup/index.ts", "type": "component",