File tree Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -75,24 +75,26 @@ export function addBuildHooks(nuxt: Nuxt, hub: HubConfig) {
75
75
} )
76
76
} )
77
77
78
- nuxt . hook ( 'build:done' , async ( ) => {
79
- await $fetch ( `/api/projects/${ process . env . NUXT_HUB_PROJECT_KEY } /build/${ process . env . NUXT_HUB_ENV } /done` , {
80
- baseURL : hub . url ,
81
- method : 'POST' ,
82
- headers : {
83
- authorization : `Bearer ${ process . env . NUXT_HUB_PROJECT_DEPLOY_TOKEN } `
84
- } ,
85
- body : {
86
- pagesUrl : process . env . CF_PAGES_URL
87
- }
88
- } ) . catch ( ( e ) => {
89
- if ( e . response ?. _data ?. message ) {
90
- log . error ( e . response . _data . message )
91
- } else {
92
- log . error ( 'Failed run build:done hook on NuxtHub.' , e )
93
- }
78
+ nuxt . hook ( 'nitro:init' , async ( nitro ) => {
79
+ nitro . hooks . hook ( 'compiled' , async ( ) => {
80
+ await $fetch ( `/api/projects/${ process . env . NUXT_HUB_PROJECT_KEY } /build/${ process . env . NUXT_HUB_ENV } /done` , {
81
+ baseURL : hub . url ,
82
+ method : 'POST' ,
83
+ headers : {
84
+ authorization : `Bearer ${ process . env . NUXT_HUB_PROJECT_DEPLOY_TOKEN } `
85
+ } ,
86
+ body : {
87
+ pagesUrl : process . env . CF_PAGES_URL
88
+ }
89
+ } ) . catch ( ( e ) => {
90
+ if ( e . response ?. _data ?. message ) {
91
+ log . error ( e . response . _data . message )
92
+ } else {
93
+ log . error ( 'Failed run build:done hook on NuxtHub.' , e )
94
+ }
94
95
95
- process . exit ( 1 )
96
+ process . exit ( 1 )
97
+ } )
96
98
} )
97
99
} )
98
100
} else {
You can’t perform that action at this time.
0 commit comments