build(cli): fix the version error of utils and hooks packages in vue2 (#3010)
This commit is contained in:
parent
3387a22ca2
commit
2153cfa9c6
|
@ -135,8 +135,16 @@ export const getBaseConfig = ({ vueVersion, dtsInclude, dts, buildTarget, isRunt
|
||||||
// 处理tsconfig中配置,主要是处理paths映射,确保dts可以找到正确的包
|
// 处理tsconfig中配置,主要是处理paths映射,确保dts可以找到正确的包
|
||||||
const compilerOptions = require(pathFromWorkspaceRoot(`tsconfig.vue${vueVersion}.json`)).compilerOptions
|
const compilerOptions = require(pathFromWorkspaceRoot(`tsconfig.vue${vueVersion}.json`)).compilerOptions
|
||||||
let versionTarget = isValidVersion(buildTarget) ? buildTarget : `${ns(vueVersion)}.${buildTarget}`
|
let versionTarget = isValidVersion(buildTarget) ? buildTarget : `${ns(vueVersion)}.${buildTarget}`
|
||||||
let themeAndRenderlessVersion = isValidVersion(buildTarget) ? buildTarget : `3.${buildTarget}`
|
let onlyHasV3Version = isValidVersion(buildTarget) ? buildTarget : `3.${buildTarget}`
|
||||||
const isThemeOrRenderless = (key) => key.includes('@opentiny/vue-theme') || key.includes('@opentiny/vue-renderless')
|
const isOnlyHasV3 = (key) => {
|
||||||
|
const onlyHasV3Packages = [
|
||||||
|
'@opentiny/vue-theme',
|
||||||
|
'@opentiny/vue-renderless',
|
||||||
|
'@opentiny/vue-hooks',
|
||||||
|
'@opentiny/utils'
|
||||||
|
]
|
||||||
|
return onlyHasV3Packages.includes(key)
|
||||||
|
}
|
||||||
|
|
||||||
return defineConfig({
|
return defineConfig({
|
||||||
publicDir: false,
|
publicDir: false,
|
||||||
|
@ -181,14 +189,14 @@ export const getBaseConfig = ({ vueVersion, dtsInclude, dts, buildTarget, isRunt
|
||||||
|
|
||||||
// 如果没有指定版本号,则按源码版本发布
|
// 如果没有指定版本号,则按源码版本发布
|
||||||
if (!buildTarget) {
|
if (!buildTarget) {
|
||||||
themeAndRenderlessVersion = packageVersion
|
onlyHasV3Version = packageVersion
|
||||||
versionTarget = `${vueVersion}${packageVersion.slice(1)}`
|
versionTarget = `${vueVersion}${packageVersion.slice(1)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.entries(content.dependencies).forEach(([key, value]) => {
|
Object.entries(content.dependencies).forEach(([key, value]) => {
|
||||||
// dependencies里的@opentiny,统一使用:~x.x.0
|
// dependencies里的@opentiny,统一使用:~x.x.0
|
||||||
if (isThemeOrRenderless(key)) {
|
if (isOnlyHasV3(key)) {
|
||||||
dependencies[key] = getPatchVersion(themeAndRenderlessVersion)
|
dependencies[key] = getPatchVersion(onlyHasV3Version)
|
||||||
} else if ((value as string).includes('workspace:~')) {
|
} else if ((value as string).includes('workspace:~')) {
|
||||||
dependencies[key] = getPatchVersion(versionTarget)
|
dependencies[key] = getPatchVersion(versionTarget)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -49,11 +49,6 @@
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"exclude": false
|
"exclude": false
|
||||||
},
|
},
|
||||||
"Hooks": {
|
|
||||||
"path": "vue-hooks/index.ts",
|
|
||||||
"type": "module",
|
|
||||||
"exclude": false
|
|
||||||
},
|
|
||||||
"FormItemLabelWrap": {
|
"FormItemLabelWrap": {
|
||||||
"path": "vue/src/form-item/src/label-wrap.ts",
|
"path": "vue/src/form-item/src/label-wrap.ts",
|
||||||
"type": "template",
|
"type": "template",
|
||||||
|
|
|
@ -1261,11 +1261,6 @@
|
||||||
"type": "template",
|
"type": "template",
|
||||||
"exclude": false
|
"exclude": false
|
||||||
},
|
},
|
||||||
"Hooks": {
|
|
||||||
"path": "vue-hooks/index.ts",
|
|
||||||
"type": "module",
|
|
||||||
"exclude": false
|
|
||||||
},
|
|
||||||
"Hrapprover": {
|
"Hrapprover": {
|
||||||
"path": "vue/src/hrapprover/index.ts",
|
"path": "vue/src/hrapprover/index.ts",
|
||||||
"type": "component",
|
"type": "component",
|
||||||
|
|
Loading…
Reference in New Issue