How to use the @vuepress/core.createApp function in @vuepress/core

To help you get started, we’ve selected a few @vuepress/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuepress / vuepress-plugin-dehydrate / __tests__ / index.spec.js View on Github external
describe('dehydation', () => {
  const app = createApp({
    sourceDir: resolve(__dirname, 'docs'),
  })

  beforeAll(async () => {
    await app.process()
    await app.build()
  }, 60000)

  function testForFile (name, file = name) {
    test(name, () => {
      const html = readFileSync(resolve(app.outDir, file), 'utf8')
      expect(html).toMatchSnapshot()
    })
  }

  testForFile('404.html')
github vuejs / vuepress / packages / @vuepress / plugin-public-files / __tests__ / index.spec.js View on Github external
describe('plugin-public-files: source folder', () => {
  const app = createApp({
    sourceDir: resolve(__dirname, 'docs-1')
  })

  beforeAll(async () => {
    await app.process()
    await app.build()
  }, 60000)

  testForExistence(app, 'foo.txt')
  testForExistence(app, 'baz.txt')
  testForExistence(app, 'bar/foo.txt')
  testForExistence(app, 'bar/baz.txt')
  testForExistence(app, 'index.html')
  testForExistence(app, 'readme.md', false)
  testForExistence(app, '.dotfile', false)
  testForExistence(app, '.dotfolder', false)
github vuejs / vuepress / packages / vuepress / lib / handleUnknownCommand.js View on Github external
async beforeParse (subCli) {
        const app = createApp({
          sourceDir: sourceDir,
          ...options,
          ...commandoptions
        })
        await app.process()
        app.pluginAPI.applySyncOption('extendCli', subCli, app)
        console.log()
      },
      async afterParse (subCli) {
github vuejs / vuepress / packages / vuepress / lib / handleUnknownCommand.js View on Github external
logger.developer('needPrepareBeforeLaunchCLI', needPrepareBeforeLaunchCLI)

  if (needPrepareBeforeLaunchCLI) {
    let app
    let [, sourceDir] = argv

    if (!sourceDir || sourceDir.startsWith('-')) {
      sourceDir = inferredUserDocsDirectory
    } else {
      sourceDir = pwd
    }

    logger.setOptions({ logLevel: 1 })

    if (sourceDir) {
      app = createApp({ sourceDir, ...options })
      await app.process()
      app.pluginAPI.applySyncOption('extendCli', cli, app)
    }

    logger.setOptions({ logLevel: 3 })
  }
}