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

vuepress / vuepress-next / 3860787019

pending completion
3860787019

Pull #1230

github

GitHub
Merge a55297b33 into b4e313bb7
Pull Request #1230: feat: add helper package

325 of 478 branches covered (67.99%)

Branch coverage included in aggregate %.

8 of 8 new or added lines in 2 files covered. (100.0%)

685 of 1011 relevant lines covered (67.75%)

42.02 hits per line

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

7.14
/packages/cli/src/commands/dev/handlePageAdd.ts
1
import {
2
  createPage,
3
  preparePageComponent,
4
  preparePageData,
5
  preparePagesComponents,
6
  preparePagesData,
7
  preparePagesRoutes,
8
} from '@vuepress/core'
9
import type { App, Page } from '@vuepress/core'
10

11
/**
12
 * Event handler for page add event
13
 *
14
 * Returns the added page
15
 */
16
export const handlePageAdd = async (
3✔
17
  app: App,
18
  filePath: string
19
): Promise<Page | null> => {
20
  // check if the added page is duplicated
21
  const pageIndex = app.pages.findIndex((page) => page.filePath === filePath)
×
22
  if (pageIndex !== -1) {
×
23
    return null
×
24
  }
25

26
  // create page
27
  const page = await createPage(app, {
×
28
    filePath,
29
  })
30

31
  // add the new page
32
  app.pages.push(page)
×
33

34
  // prepare page files
35
  await preparePageComponent(app, page)
×
36
  await preparePageData(app, page)
×
37

38
  // prepare pages entry
39
  await preparePagesComponents(app)
×
40
  await preparePagesData(app)
×
41
  await preparePagesRoutes(app)
×
42

43
  return page
×
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