mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
Merge branch 'main' into docs/plugin-env
This commit is contained in:
commit
102f8c05d4
1
.github/workflows/changelogensets.yml
vendored
1
.github/workflows/changelogensets.yml
vendored
@ -4,6 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
- 2.x
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
@ -111,10 +111,12 @@ For example, you can define a custom handler utility that wraps the original han
|
|||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
```ts [server/utils/handler.ts]
|
```ts [server/utils/handler.ts]
|
||||||
import type { EventHandler } from 'h3'
|
import type { EventHandler, EventHandlerRequest } from 'h3'
|
||||||
|
|
||||||
export const defineWrappedResponseHandler = (handler: EventHandler) =>
|
export const defineWrappedResponseHandler = <T extends EventHandlerRequest, D> (
|
||||||
defineEventHandler(async (event) => {
|
handler: EventHandler<T, D>
|
||||||
|
): EventHandler<T, D> =>
|
||||||
|
defineEventHandler<T>(async event => {
|
||||||
try {
|
try {
|
||||||
// do something before the route handler
|
// do something before the route handler
|
||||||
const response = await handler(event)
|
const response = await handler(event)
|
||||||
|
@ -26,7 +26,10 @@ export default defineNuxtPlugin({
|
|||||||
head.hooks.hook('dom:beforeRender', (context) => { context.shouldRender = !pauseDOMUpdates })
|
head.hooks.hook('dom:beforeRender', (context) => { context.shouldRender = !pauseDOMUpdates })
|
||||||
nuxtApp.hooks.hook('page:start', () => { pauseDOMUpdates = true })
|
nuxtApp.hooks.hook('page:start', () => { pauseDOMUpdates = true })
|
||||||
// wait for new page before unpausing dom updates (triggered after suspense resolved)
|
// wait for new page before unpausing dom updates (triggered after suspense resolved)
|
||||||
nuxtApp.hooks.hook('page:finish', syncHead)
|
nuxtApp.hooks.hook('page:finish', () => {
|
||||||
|
// app:suspense:resolve hook will unpause the DOM
|
||||||
|
if (!nuxtApp.isHydrating) { syncHead() }
|
||||||
|
})
|
||||||
// unpause on error
|
// unpause on error
|
||||||
nuxtApp.hooks.hook('app:error', syncHead)
|
nuxtApp.hooks.hook('app:error', syncHead)
|
||||||
// unpause the DOM once the mount suspense is resolved
|
// unpause the DOM once the mount suspense is resolved
|
||||||
|
@ -4,6 +4,8 @@ import { inc } from 'semver'
|
|||||||
import { generateMarkDown, loadChangelogConfig } from 'changelogen'
|
import { generateMarkDown, loadChangelogConfig } from 'changelogen'
|
||||||
import { determineBumpType, getLatestCommits, loadWorkspace } from './_utils'
|
import { determineBumpType, getLatestCommits, loadWorkspace } from './_utils'
|
||||||
|
|
||||||
|
const releaseBranch = process.env.BRANCH || 'main'
|
||||||
|
|
||||||
async function main () {
|
async function main () {
|
||||||
const workspace = await loadWorkspace(process.cwd())
|
const workspace = await loadWorkspace(process.cwd())
|
||||||
const config = await loadChangelogConfig(process.cwd(), {
|
const config = await loadChangelogConfig(process.cwd(), {
|
||||||
@ -39,7 +41,7 @@ async function main () {
|
|||||||
const releaseNotes = [
|
const releaseNotes = [
|
||||||
currentPR?.body.replace(/## 👉 Changelog[\s\S]*$/, '') || `> ${newVersion} is the next ${bumpType} release.\n>\n> **Timetable**: to be announced.`,
|
currentPR?.body.replace(/## 👉 Changelog[\s\S]*$/, '') || `> ${newVersion} is the next ${bumpType} release.\n>\n> **Timetable**: to be announced.`,
|
||||||
'## 👉 Changelog',
|
'## 👉 Changelog',
|
||||||
changelog.replace(/^## v.*?\n/, '').replace('...main', `...v${newVersion}`)
|
changelog.replace(/^## v.*?\n/, '').replace(`...${releaseBranch}`, `...v${newVersion}`)
|
||||||
].join('\n')
|
].join('\n')
|
||||||
|
|
||||||
// Create a PR with release notes if none exists
|
// Create a PR with release notes if none exists
|
||||||
@ -52,7 +54,7 @@ async function main () {
|
|||||||
body: {
|
body: {
|
||||||
title: `v${newVersion}`,
|
title: `v${newVersion}`,
|
||||||
head: `v${newVersion}`,
|
head: `v${newVersion}`,
|
||||||
base: 'main',
|
base: releaseBranch,
|
||||||
body: releaseNotes,
|
body: releaseNotes,
|
||||||
draft: true
|
draft: true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user