build: set compiler-sfc peerDep on vue
This commit is contained in:
parent
d84cf3a538
commit
c1959fa64d
@ -26,6 +26,9 @@
|
|||||||
"url": "https://github.com/vuejs/vue/issues"
|
"url": "https://github.com/vuejs/vue/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/vuejs/vue/tree/dev/packages/compiler-sfc#readme",
|
"homepage": "https://github.com/vuejs/vue/tree/dev/packages/compiler-sfc#readme",
|
||||||
|
"peerDependencies": {
|
||||||
|
"vue": "3.0.0-alpha.0"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/compiler-core": "3.0.0-alpha.0",
|
"@vue/compiler-core": "3.0.0-alpha.0",
|
||||||
"@vue/compiler-dom": "3.0.0-alpha.0",
|
"@vue/compiler-dom": "3.0.0-alpha.0",
|
||||||
|
@ -119,18 +119,22 @@ function updateVersions(version) {
|
|||||||
function updatePackage(pkgRoot, version) {
|
function updatePackage(pkgRoot, version) {
|
||||||
const pkg = readPkg(pkgRoot)
|
const pkg = readPkg(pkgRoot)
|
||||||
pkg.version = version
|
pkg.version = version
|
||||||
if (pkg.dependencies) {
|
updateDeps(pkg.dependencies)
|
||||||
Object.keys(pkg.dependencies).forEach(dep => {
|
updateDeps(pkg.peerDependencies)
|
||||||
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateDeps(deps, version) {
|
||||||
|
if (!deps) return
|
||||||
|
Object.keys(deps).forEach(dep => {
|
||||||
if (
|
if (
|
||||||
dep.startsWith('@vue') &&
|
dep === 'vue' ||
|
||||||
packages.includes(dep.replace(/^@vue\//, ''))
|
(dep.startsWith('@vue') && packages.includes(dep.replace(/^@vue\//, '')))
|
||||||
) {
|
) {
|
||||||
pkg.dependencies[dep] = version
|
deps[dep] = version
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
|
|
||||||
}
|
|
||||||
|
|
||||||
function readPkg(pkgRoot) {
|
function readPkg(pkgRoot) {
|
||||||
const pkgPath = path.resolve(pkgRoot, 'package.json')
|
const pkgPath = path.resolve(pkgRoot, 'package.json')
|
||||||
|
Loading…
Reference in New Issue
Block a user