Skip to content

Commit

Permalink
fix: empty template for YunAdBoard parent gap size
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Nov 10, 2024
1 parent ffe7eba commit ab57216
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/valaxy-theme-yun/components/YunAdBoard.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<template>
<!-- empty -->
<div />
<!-- eslint-disable-next-line vue/no-lone-template empty -->
<template />
</template>
9 changes: 6 additions & 3 deletions packages/valaxy/node/cli/utils/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import consola from 'consola'
import type { InlineConfig, ViteDevServer } from 'vite'
import { mergeConfig } from 'vite'
import { version } from 'valaxy/package.json'
import ora from 'ora'
import { colors } from 'consola/utils'
import type { ValaxyNode } from '../../types'
import { createServer } from '../../server'
import type { ResolvedValaxyOptions } from '../../options'
import { mergeViteConfigs } from '../../common'
import { vLogger } from '../../logger'
import { vLogger, valaxyPrefix } from '../../logger'

let server: ViteDevServer | undefined

Expand Down Expand Up @@ -60,6 +62,7 @@ export function printInfo(options: ResolvedValaxyOptions, port?: number, remote?
// 'extendMd',
// ]

export const serverSpinner = ora(`${valaxyPrefix} creating server ...`)
export async function initServer(valaxyApp: ValaxyNode, viteConfig: InlineConfig) {
if (server) {
vLogger.info('close server...')
Expand All @@ -68,6 +71,7 @@ export async function initServer(valaxyApp: ValaxyNode, viteConfig: InlineConfig

const { options } = valaxyApp

serverSpinner.start()
const viteConfigs: InlineConfig = mergeConfig(
await mergeViteConfigs(options, 'serve'),
viteConfig,
Expand Down Expand Up @@ -101,8 +105,7 @@ export async function initServer(valaxyApp: ValaxyNode, viteConfig: InlineConfig
},
})
await server.listen()
// consola.success(, 'server ready')
vLogger.ready('server ready')
serverSpinner.succeed(`${valaxyPrefix} ${colors.green('server ready.')}`)
}
catch (e) {
consola.error('failed to start server. error:\n')
Expand Down
8 changes: 4 additions & 4 deletions packages/valaxy/node/logger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import type { ValaxyHooks, ValaxyNode } from '../types'

export const logger = consola.create({})

const prefix = `${magenta('valaxy')}:`
export const valaxyPrefix = colors.magenta('[valaxy]')
export const vLogger = {
success: (...args: any) => logger.success(prefix, ...args),
info: (...args: any) => logger.info(prefix, ...args),
ready: (...args: any) => logger.ready(prefix, ...args),
success: (...args: any) => logger.success(valaxyPrefix, ...args),
info: (...args: any) => logger.info(valaxyPrefix, ...args),
ready: (...args: any) => logger.ready(valaxyPrefix, ...args),
}

/**
Expand Down
10 changes: 10 additions & 0 deletions packages/valaxy/node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@ import process from 'node:process'
import type { InlineConfig } from 'vite'
import { createServer as createViteServer, mergeConfig as mergeViteConfig } from 'vite'

import { colors } from 'consola/utils'
import type { ValaxyNode } from './types'
import type { ValaxyServerOptions } from './options'
import { ViteValaxyPlugins } from './plugins/preset'
import { serverSpinner } from './cli/utils/cli'
import { valaxyPrefix } from './logger'

function getServerInfoText(msg: string) {
return `${valaxyPrefix} ${colors.gray(msg)}`
}

export async function createServer(
valaxyApp: ValaxyNode,
Expand All @@ -16,6 +23,7 @@ export async function createServer(

const { options } = valaxyApp

serverSpinner.text = getServerInfoText('init vite plugins ..')
const plugins = await ViteValaxyPlugins(valaxyApp, serverOptions)
// dynamic import to avoid bundle it in build
const enableDevtools = options.mode === 'dev' && options.config.devtools
Expand All @@ -30,12 +38,14 @@ export async function createServer(
)
}

serverSpinner.text = getServerInfoText('merge vite config ...')
const mergedViteConfig = mergeViteConfig(
viteConfig,
{
plugins: vitePlugins,
},
)
serverSpinner.text = getServerInfoText('create vite server ...')
const server = await createViteServer(mergedViteConfig)
return server
}

1 comment on commit ab57216

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://yun.valaxy.site as production
🚀 Deployed on https://6730f5e933de7338b31c98d3--valaxy.netlify.app

Please sign in to comment.