mirror of https://github.com/YunYouJun/valaxy
fix: use await for hooks
This commit is contained in:
parent
c0b8f75387
commit
2763bedcdd
|
@ -56,7 +56,7 @@ export const addonTest = defineValaxyAddon(options => ({
|
|||
setup(valaxy) {
|
||||
valaxy.hook('build:before', () => {
|
||||
// do something before build
|
||||
consola.log('build:before')
|
||||
consola.info('[valaxy-addon-test] build:before')
|
||||
})
|
||||
},
|
||||
}))
|
||||
|
|
|
@ -9,7 +9,7 @@ export const addonTest = defineValaxyAddon(options => ({
|
|||
|
||||
setup(valaxy) {
|
||||
valaxy.hook('build:before', () => {
|
||||
consola.log('build:before')
|
||||
consola.info('[valaxy-addon-test] build:before')
|
||||
})
|
||||
},
|
||||
}))
|
||||
|
|
|
@ -176,7 +176,7 @@ cli.command(
|
|||
|
||||
const valaxyApp = createValaxyNode(options)
|
||||
// resolve options and create valaxy app
|
||||
valaxyApp.hooks.callHook('options:resolved')
|
||||
await valaxyApp.hooks.callHook('options:resolved')
|
||||
|
||||
const valaxyViteConfig: InlineConfig = mergeConfig(await mergeViteConfigs(options, 'build'), options.config.vite || {})
|
||||
const viteConfig: InlineConfig = mergeConfig(
|
||||
|
@ -193,7 +193,7 @@ cli.command(
|
|||
},
|
||||
)
|
||||
// init config
|
||||
valaxyApp.hooks.callHook('config:init')
|
||||
await valaxyApp.hooks.callHook('config:init')
|
||||
|
||||
// merge index.html
|
||||
const templatePath = path.resolve(options.clientRoot, 'template.html')
|
||||
|
@ -204,7 +204,7 @@ cli.command(
|
|||
await fs.writeFile(indexPath, indexHtml, 'utf-8')
|
||||
|
||||
// before build
|
||||
valaxyApp.hooks.callHook('build:before')
|
||||
await valaxyApp.hooks.callHook('build:before')
|
||||
|
||||
try {
|
||||
if (ssg) {
|
||||
|
@ -234,7 +234,7 @@ cli.command(
|
|||
await fs.copyFile(templatePath, indexPath)
|
||||
|
||||
// after build
|
||||
valaxyApp.hooks.callHook('build:after')
|
||||
await valaxyApp.hooks.callHook('build:after')
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue