feat: sever.logs configuration
This commit is contained in:
parent
4520e65e21
commit
0c5fc3d056
3 changed files with 12 additions and 1 deletions
|
@ -1,5 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @typedef {import('nitropack').NitroConfig} NitroConfig
|
* @typedef {import('nitropack').NitroConfig} NitroConfig
|
||||||
|
* @typedef {object} ServerConfig
|
||||||
|
* @property {boolean} logs
|
||||||
|
* Set to true if you want to see server logs
|
||||||
* @typedef {object} McFlyConfig
|
* @typedef {object} McFlyConfig
|
||||||
* @property {'js' | 'lit'} components
|
* @property {'js' | 'lit'} components
|
||||||
* Type of components used:
|
* Type of components used:
|
||||||
|
@ -8,6 +11,7 @@
|
||||||
* - `'enhance'` = Enhance (in-progress)
|
* - `'enhance'` = Enhance (in-progress)
|
||||||
* - `'webc'` = WebC (in-progress)
|
* - `'webc'` = WebC (in-progress)
|
||||||
* @property {NitroConfig} nitro
|
* @property {NitroConfig} nitro
|
||||||
|
* @property {ServerConfig} server
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,11 +30,15 @@ export function useMcFlyRoute({ storage }) {
|
||||||
})
|
})
|
||||||
const config = {
|
const config = {
|
||||||
components: 'js', // work around for c12.loadConfig not working on Netlify function
|
components: 'js', // work around for c12.loadConfig not working on Netlify function
|
||||||
...loadedConfig,
|
...loadedConfig.config,
|
||||||
}
|
}
|
||||||
const { components: componentType } = config
|
const { components: componentType } = config
|
||||||
let html = await getHtml(path, storage)
|
let html = await getHtml(path, storage)
|
||||||
|
|
||||||
|
if (config.server.logs) {
|
||||||
|
consola.info('[INFO]: Config found\n', config)
|
||||||
|
}
|
||||||
|
|
||||||
if (html) {
|
if (html) {
|
||||||
const transforms = [evaluateServerScript, deleteServerScripts]
|
const transforms = [evaluateServerScript, deleteServerScripts]
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@ import { defineMcFlyConfig } from '@mcflyjs/config'
|
||||||
|
|
||||||
export default defineMcFlyConfig({
|
export default defineMcFlyConfig({
|
||||||
components: 'js',
|
components: 'js',
|
||||||
|
server: {
|
||||||
|
logs: true,
|
||||||
|
},
|
||||||
nitro: {
|
nitro: {
|
||||||
devServer: {
|
devServer: {
|
||||||
watch: ['../packages'],
|
watch: ['../packages'],
|
||||||
|
|
Loading…
Reference in a new issue