Skip to content

Commit

Permalink
workflow: use workspace deps
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Nov 21, 2023
1 parent 32fb79d commit 8fddb19
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 63 deletions.
2 changes: 1 addition & 1 deletion packages/compiler-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
"dependencies": {
"@babel/parser": "^7.23.3",
"@vue/shared": "3.3.8",
"@vue/shared": "workspace:*",
"estree-walker": "^2.0.2",
"source-map-js": "^1.0.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/compiler-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
"dependencies": {
"@vue/shared": "3.3.8",
"@vue/compiler-core": "3.3.8"
"@vue/shared": "workspace:*",
"@vue/compiler-core": "workspace:*"
}
}
10 changes: 5 additions & 5 deletions packages/compiler-sfc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
"dependencies": {
"@babel/parser": "^7.23.3",
"@vue/compiler-core": "3.3.8",
"@vue/compiler-dom": "3.3.8",
"@vue/compiler-ssr": "3.3.8",
"@vue/reactivity-transform": "3.3.8",
"@vue/shared": "3.3.8",
"@vue/compiler-core": "workspace:*",
"@vue/compiler-dom": "workspace:*",
"@vue/compiler-ssr": "workspace:*",
"@vue/reactivity-transform": "workspace:*",
"@vue/shared": "workspace:*",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.5",
"postcss": "^8.4.31",
Expand Down
4 changes: 2 additions & 2 deletions packages/compiler-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
"dependencies": {
"@vue/shared": "3.3.8",
"@vue/compiler-dom": "3.3.8"
"@vue/shared": "workspace:*",
"@vue/compiler-dom": "workspace:*"
}
}
4 changes: 2 additions & 2 deletions packages/reactivity-transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"homepage": "https://github.com/vuejs/core/tree/dev/packages/reactivity-transform#readme",
"dependencies": {
"@babel/parser": "^7.23.3",
"@vue/compiler-core": "3.3.8",
"@vue/shared": "3.3.8",
"@vue/compiler-core": "workspace:*",
"@vue/shared": "workspace:*",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.5"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/reactivity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
"dependencies": {
"@vue/shared": "3.3.8"
"@vue/shared": "workspace:*"
}
}
4 changes: 2 additions & 2 deletions packages/runtime-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
"dependencies": {
"@vue/shared": "3.3.8",
"@vue/reactivity": "3.3.8"
"@vue/shared": "workspace:*",
"@vue/reactivity": "workspace:*"
}
}
4 changes: 2 additions & 2 deletions packages/runtime-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-dom#readme",
"dependencies": {
"@vue/shared": "3.3.8",
"@vue/runtime-core": "3.3.8",
"@vue/shared": "workspace:*",
"@vue/runtime-core": "workspace:*",
"csstype": "^3.1.2"
}
}
4 changes: 2 additions & 2 deletions packages/runtime-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-test#readme",
"dependencies": {
"@vue/shared": "3.3.8",
"@vue/runtime-core": "3.3.8"
"@vue/shared": "workspace:*",
"@vue/runtime-core": "workspace:*"
}
}
6 changes: 3 additions & 3 deletions packages/server-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
"peerDependencies": {
"vue": "3.3.8"
"vue": "workspace:*"
},
"dependencies": {
"@vue/shared": "3.3.8",
"@vue/compiler-ssr": "3.3.8"
"@vue/shared": "workspace:*",
"@vue/compiler-ssr": "workspace:*"
}
}
2 changes: 1 addition & 1 deletion packages/vue-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
"source-map-js": "^1.0.2"
},
"peerDependencies": {
"vue": "3.3.8"
"vue": "workspace:*"
}
}
10 changes: 5 additions & 5 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/vue#readme",
"dependencies": {
"@vue/shared": "3.3.8",
"@vue/compiler-dom": "3.3.8",
"@vue/runtime-dom": "3.3.8",
"@vue/compiler-sfc": "3.3.8",
"@vue/server-renderer": "3.3.8"
"@vue/shared": "workspace:*",
"@vue/compiler-dom": "workspace:*",
"@vue/runtime-dom": "workspace:*",
"@vue/compiler-sfc": "workspace:*",
"@vue/server-renderer": "workspace:*"
},
"peerDependencies": {
"typescript": "*"
Expand Down
56 changes: 28 additions & 28 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 20 additions & 7 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,22 @@ async function isInSyncWithRemote() {
`https://api.github.com/repos/vuejs/core/commits/${branch}?per_page=1`
)
const data = await res.json()
return data.sha === sha
if (data.sha === sha) {
return true
} else {
// @ts-ignore
const { yes } = await prompt({
type: 'confirm',
name: 'yes',
message: pico.red(
`Local HEAD is not up-to-date with remote. Are you sure you want to continue?`
)
})
return yes
}
} catch (e) {
console.error(
'Failed to check whether local HEAD is up-to-date with remote.'
pico.red('Failed to check whether local HEAD is up-to-date with remote.')
)
return false
}
Expand All @@ -348,18 +360,17 @@ function updatePackage(pkgRoot, version, getNewPackageName) {
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
pkg.name = getNewPackageName(pkg.name)
pkg.version = version
updateDeps(pkg, 'dependencies', version, getNewPackageName)
updateDeps(pkg, 'peerDependencies', version, getNewPackageName)
if (isCanary) {
updateDeps(pkg, 'dependencies', version, getNewPackageName)
updateDeps(pkg, 'peerDependencies', version, getNewPackageName)
}
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
}

function updateDeps(pkg, depType, version, getNewPackageName) {
const deps = pkg[depType]
if (!deps) return
Object.keys(deps).forEach(dep => {
if (deps[dep] === 'workspace:*') {
return
}
if (isCorePackage(dep)) {
const newName = getNewPackageName(dep)
const newVersion = newName === dep ? version : `npm:${newName}@${version}`
Expand Down Expand Up @@ -395,6 +406,8 @@ async function publishPackage(pkgName, version) {

step(`Publishing ${pkgName}...`)
try {
// Don't change the package manager here as we rely on pnpm to handle
// workspace:* deps
await run(
'pnpm',
[
Expand Down

0 comments on commit 8fddb19

Please sign in to comment.