Skip to content

Commit

Permalink
chore: apply automated updates
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] committed Feb 21, 2024
1 parent c6e8d20 commit 9ebcc0c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Binary file modified bun.lockb
Binary file not shown.
16 changes: 9 additions & 7 deletions cli/cli.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineCommand, runMain } from 'citty'
import consola from 'consola'
// import { relative } from "pathe"
import { getContext } from "unctx"
import { getContext } from 'unctx'
import { setupDocs } from './setup.mjs'

export function createCLI(opts) {
Expand All @@ -26,23 +26,25 @@ export function createCLI(opts) {
const { tryUse: tryUseNuxt } = getContext('nuxt')

const { appDir, nuxtConfig, unwatch } = await setupDocs(args.dir, {
...opts.setup, dev: true, watch: {
...opts.setup,
dev: true,
watch: {
// onWatch: (event) => {
// logger.info(`Config file ${event.type} \`${relative(cwd, event.path)}\``)
// },
acceptHMR({ getDiff }) {
const diff = getDiff().filter(entry => entry.key !== 'dir')
const diff = getDiff().filter((entry) => entry.key !== 'dir')
if (diff.length === 0) {
return true;
return true
}
},
onUpdate({ getDiff, newConfig: { config } }) {
const diff = getDiff().filter(entry => entry.key !== 'dir');
logger.info("Config updated:\n" + diff.map((i) => ' - ' + i.toJSON()).join("\n"));
const diff = getDiff().filter((entry) => entry.key !== 'dir')
logger.info('Config updated:\n' + diff.map((i) => ' - ' + i.toJSON()).join('\n'))
Object.assign(nuxtConfig.docs, config)
tryUseNuxt()?.callHook('restart')
},
}
},
})

process.chdir(appDir)
Expand Down
2 changes: 1 addition & 1 deletion cli/setup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function setupDocs(docsDir, opts = {}) {
url: inferSiteURL(),
...opts.defaults,
},
...opts.watch
...opts.watch,
})

// Normalize dir
Expand Down

0 comments on commit 9ebcc0c

Please sign in to comment.