• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vuepress / vuepress-next / 7163313360

11 Dec 2023 05:25AM UTC coverage: 67.837% (-1.3%) from 69.176%
7163313360

Pull #1449

github

web-flow
Merge 4941993a9 into b82d48e1e
Pull Request #1449: feat: remove vuepress-vite and vuepress-webpack package and support --bundler option, close #1446

325 of 462 branches covered (0.0%)

Branch coverage included in aggregate %.

2 of 26 new or added lines in 4 files covered. (7.69%)

1 existing line in 1 file now uncovered.

641 of 962 relevant lines covered (66.63%)

47.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

16.67
/packages/cli/src/config/resolveCliAppConfig.ts
1
import process from 'node:process'
2
import type { AppConfig } from '@vuepress/core'
3
import { path } from '@vuepress/utils'
4
import { resolveBundler } from './resolveBundler'
5

6
const OPTIONS_COMMON = ['debug', 'open', 'port', 'host'] as const
3✔
7
const OPTIONS_DIRECTORY = ['cache', 'dest', 'temp'] as const
3✔
8

9
/**
10
 * Resolve app config according to command options of cli
11
 */
12
export const resolveCliAppConfig = async (
3✔
13
  sourceDir: string,
14
  commandOptions: Omit<Partial<AppConfig>, 'bundler'> & {
15
    bundler?: 'vite' | 'webpack'
16
  },
17
  cwd = process.cwd(),
×
18
): Promise<Partial<AppConfig> & Pick<AppConfig, 'source'>> => {
19
  // resolve the source directory
20
  const source = path.resolve(cwd, sourceDir)
×
21

22
  const appConfig: Partial<AppConfig> & Pick<AppConfig, 'source'> = {
×
23
    source,
24
  }
25

26
  // set app config from command options
27
  // notice that we do not want to override user config unless it is set explicitly via cli
28
  OPTIONS_COMMON.forEach((name) => {
×
29
    if (commandOptions[name] !== undefined) {
×
30
      // @ts-expect-error: the types could not be narrowed correctly
31
      appConfig[name] = commandOptions[name]
×
32
    }
33
  })
34
  OPTIONS_DIRECTORY.forEach((name) => {
×
35
    if (commandOptions[name] !== undefined) {
×
36
      appConfig[name] = path.resolve(cwd, commandOptions[name])
×
37
    }
38
  })
39

40
  // set bundler
NEW
41
  appConfig.bundler = await resolveBundler(commandOptions.bundler)
×
42

UNCOV
43
  return appConfig
×
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc