chore: depend on `h3-nightly` on edge releases (#22593)

This commit is contained in:
Daniel Roe 2023-08-11 14:11:51 +01:00 committed by GitHub
parent afd8126b65
commit 9fcd99eccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 8 deletions

View File

@ -1,21 +1,19 @@
import { execSync } from 'node:child_process'
import { $fetch } from 'ofetch'
import { inc } from 'semver'
import { determineBumpType, loadWorkspace } from './_utils'
const nightlyPackages = {
nitropack: 'nitropack-edge',
h3: 'h3-nightly',
nuxi: 'nuxi-ng'
}
async function main () {
const workspace = await loadWorkspace(process.cwd())
const commit = execSync('git rev-parse --short HEAD').toString('utf-8').trim().slice(0, 8)
const date = Math.round(Date.now() / (1000 * 60))
const nuxtPkg = workspace.find('nuxt')
const { version: latestNitro } = await $fetch<{ version: string }>('https://registry.npmjs.org/nitropack-edge/latest')
nuxtPkg.data.dependencies.nitropack = `npm:nitropack-edge@^${latestNitro}`
const { version: latestNuxi } = await $fetch<{ version: string }>('https://registry.npmjs.org/nuxi-ng/latest')
nuxtPkg.data.dependencies.nuxi = `npm:nuxi-ng@^${latestNuxi}`
const bumpType = await determineBumpType()
for (const pkg of workspace.packages.filter(p => !p.data.private)) {
@ -23,6 +21,11 @@ async function main () {
workspace.setVersion(pkg.data.name, `${newVersion}-${date}.${commit}`, {
updateDeps: true
})
for (const [name, nightlyName] of Object.entries(nightlyPackages)) {
if (name in pkg.data.dependencies) {
pkg.data.dependencies[name] = `npm:${nightlyName}@latest`
}
}
const newname = pkg.data.name === 'nuxt' ? 'nuxt3' : (pkg.data.name + '-edge')
workspace.rename(pkg.data.name, newname)
}