forked from opentiny/tiny-vue
chore: support alpha version and fix build error (#600)
* chore: build bundle support alpha version * fix: fix color-select-panel/rich-text-editor build error * fix: fix vue2.6 export version not found error
This commit is contained in:
parent
0e288244c4
commit
8080e95896
|
@ -10,7 +10,7 @@ import { getAlias, pathFromWorkspaceRoot } from '../../config/vite'
|
|||
import { external } from '../../shared/config'
|
||||
import type { Module } from '../../shared/module-utils'
|
||||
import { getAllIcons, getAllModules, getByName } from '../../shared/module-utils'
|
||||
import { logGreen, kebabCase, capitalizeKebabCase, getMinorVersion, isValidVersion } from '../../shared/utils'
|
||||
import { logGreen, kebabCase, capitalizeKebabCase, getPatchVersion, isValidVersion } from '../../shared/utils'
|
||||
import generatePackageJsonPlugin from './rollup/generate-package-json'
|
||||
import inlineChunksPlugin from './rollup/inline-chunks'
|
||||
import replaceModuleNamePlugin from './rollup/replace-module-name'
|
||||
|
@ -138,9 +138,9 @@ export const getBaseConfig = ({ vueVersion, dtsInclude, dts, buildTarget, isRunt
|
|||
Object.entries(content.dependencies).forEach(([key, value]) => {
|
||||
// dependencies里的@opentiny,统一使用:~x.x.0
|
||||
if (isThemeOrRenderless(key)) {
|
||||
dependencies[key] = getMinorVersion(themeAndRenderlessVersion)
|
||||
dependencies[key] = getPatchVersion(themeAndRenderlessVersion)
|
||||
} else if ((value as string).includes('workspace:~')) {
|
||||
dependencies[key] = getMinorVersion(versionTarget)
|
||||
dependencies[key] = getPatchVersion(versionTarget)
|
||||
} else {
|
||||
dependencies[key] = value
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ export default function ({ deleteInlinedFiles = true }): Plugin {
|
|||
.replace(/export {[\s\S]+$/, '')
|
||||
.replace(/_extends/g, '_extends_tiny')
|
||||
.replace(/_createForOfIteratorHelperLoose/g, '_createForOfIteratorHelperLoose_tiny')
|
||||
.replace(/_unsupportedIterableToArray/g, '_unsupportedIterableToArray_tiny')
|
||||
.replace(/_arrayLikeToArray/g, '_arrayLikeToArray_tiny')
|
||||
bundlesToDelete.add(chunkName)
|
||||
}
|
||||
|
||||
|
|
|
@ -283,6 +283,13 @@ const getMinorVersion = (version) => {
|
|||
return `~${semver.major(version)}.${semver.minor(version)}.0`
|
||||
}
|
||||
|
||||
// 支持 alpha / beta 等版本号
|
||||
export const getPatchVersion = (version) => {
|
||||
const versionItems = version.split('.')
|
||||
versionItems.pop()
|
||||
return `~${versionItems.join('.')}.0`
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组件的版本号
|
||||
* @param {String} name 文件名|字段名
|
||||
|
|
|
@ -5,16 +5,16 @@ import { bindFilter, emitter, getElementCssClass, getElementStatusClass } from '
|
|||
import teleport from '../teleport'
|
||||
|
||||
// vue2.7有version字段
|
||||
const isVueHoos = Boolean(vueHooks.version?.includes('2.7'))
|
||||
const isVueHooks = Boolean(Vue.version?.includes('2.7'))
|
||||
|
||||
const hooks = isVueHoos ? vueHooks : compositionHooks
|
||||
const hooks = isVueHooks ? vueHooks : compositionHooks
|
||||
|
||||
const Teleport = teleport(hooks)
|
||||
|
||||
export { emitter, bindFilter, getElementCssClass, getElementStatusClass, Teleport }
|
||||
|
||||
// 只有在vue的版本小于2.7并且composition-api没有注册的情况下才去注册hooks
|
||||
if (!hooks.default['__composition_api_installed__'] && !isVueHoos) {
|
||||
if (!hooks.default['__composition_api_installed__'] && !isVueHooks) {
|
||||
Vue.use(hooks.default)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import RichTextEditor from './src/pc.vue'
|
||||
import '@opentiny/vue-theme/logout/index.less'
|
||||
import { version } from './package.json'
|
||||
|
||||
/* istanbul ignore next */
|
||||
|
|
|
@ -2,5 +2,3 @@ packages:
|
|||
- packages/**
|
||||
- examples/*
|
||||
- internals/*
|
||||
- '!packages/dist*/**'
|
||||
- '!packages/**/dist'
|
||||
|
|
Loading…
Reference in New Issue