feat: copy mcfly config to dist
This commit is contained in:
parent
8020987ccd
commit
5556329c83
2 changed files with 11 additions and 0 deletions
|
@ -12,6 +12,7 @@ import {
|
|||
} from 'nitropack'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { getNitroConfig } from '../../get-nitro-config.js'
|
||||
import { copyFileSync } from 'node:fs'
|
||||
|
||||
async function _build(args) {
|
||||
consola.start('Building project...')
|
||||
|
@ -40,6 +41,15 @@ async function _build(args) {
|
|||
handler: resolve(__dirname, '../../route-middleware.js'),
|
||||
})
|
||||
|
||||
nitro.hooks.hook('compiled', () => {
|
||||
console.log('>>> Nitro compiled', rootDir)
|
||||
|
||||
// TODO: match file for mcfly.config.*
|
||||
const mcflyConfigPath = resolve(rootDir, './mcfly.config.mjs')
|
||||
const distPath = resolve(rootDir, './dist/mcfly.config.mjs')
|
||||
copyFileSync(mcflyConfigPath, distPath)
|
||||
})
|
||||
|
||||
await prepare(nitro)
|
||||
await copyPublicAssets(nitro)
|
||||
await prerender(nitro)
|
||||
|
|
|
@ -124,6 +124,7 @@ function getPath(filename) {
|
|||
function getPurePath(path) {
|
||||
return path.split('?')[0]
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the correct HTML depending on the path requested
|
||||
* @param {string} path
|
||||
|
|
Loading…
Reference in a new issue