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'
|
} from 'nitropack'
|
||||||
import { fileURLToPath } from 'node:url'
|
import { fileURLToPath } from 'node:url'
|
||||||
import { getNitroConfig } from '../../get-nitro-config.js'
|
import { getNitroConfig } from '../../get-nitro-config.js'
|
||||||
|
import { copyFileSync } from 'node:fs'
|
||||||
|
|
||||||
async function _build(args) {
|
async function _build(args) {
|
||||||
consola.start('Building project...')
|
consola.start('Building project...')
|
||||||
|
@ -40,6 +41,15 @@ async function _build(args) {
|
||||||
handler: resolve(__dirname, '../../route-middleware.js'),
|
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 prepare(nitro)
|
||||||
await copyPublicAssets(nitro)
|
await copyPublicAssets(nitro)
|
||||||
await prerender(nitro)
|
await prerender(nitro)
|
||||||
|
|
|
@ -124,6 +124,7 @@ function getPath(filename) {
|
||||||
function getPurePath(path) {
|
function getPurePath(path) {
|
||||||
return path.split('?')[0]
|
return path.split('?')[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the correct HTML depending on the path requested
|
* Gets the correct HTML depending on the path requested
|
||||||
* @param {string} path
|
* @param {string} path
|
||||||
|
|
Loading…
Reference in a new issue