Skip to content

Commit

Permalink
chore: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy committed Aug 15, 2024
1 parent 2d377d2 commit 4175b6c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createRequire } from 'node:module'
import process from 'node:process'
import type { AppConfig } from '@vuepress/core'
import { colors } from '@vuepress/utils'
import { colors, logger } from '@vuepress/utils'
import { cac } from 'cac'
import { createBuild, createDev, info } from './commands/index.js'

Expand All @@ -15,8 +15,10 @@ export const cli = (defaultAppConfig: Partial<AppConfig> = {}): void => {
const program = cac('vuepress')

// display core version and cli version
const versionCli = require('../package.json').version
const versionCore = require('@vuepress/core/package.json').version
const versionCli = (require('../package.json') as { version: string }).version
const versionCore = (
require('@vuepress/core/package.json') as { version: string }
).version
program.version(`core@${versionCore} vuepress/cli@${versionCli}`)

// display help message
Expand Down Expand Up @@ -59,8 +61,8 @@ export const cli = (defaultAppConfig: Partial<AppConfig> = {}): void => {

// run command or fallback to help messages
if (program.matchedCommand) {
program.runMatchedCommand().catch((err) => {
console.error(colors.red(err.stack))
;(program.runMatchedCommand() as Promise<void>).catch((err: unknown) => {
logger.error(err instanceof Error ? colors.red(err.stack) : err)
process.exit(1)
})
} else {
Expand Down

0 comments on commit 4175b6c

Please sign in to comment.