How to use the @vuepress/shared-utils.fs.readdirSync function in @vuepress/shared-utils

To help you get started, we’ve selected a few @vuepress/shared-utils 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 greper / d2-crud-plus / docspress / .vuepress / config.js View on Github external
//   ['flowchart']
  // ],
  extraWatchFiles: [
    '.vuepress/nav/en.js',
    '.vuepress/nav/zh.js'
  ]
})

// function getApiSidebar () {
//   return [
//     'cli',
//     'node'
//   ]
// }

const componentDocs = fs
  .readdirSync(path.resolve(__dirname, '../guide/components'))
  .map(filename => '/guide/components/' + filename.slice(0, -3))
  .sort()
const extendsDocs = fs
  .readdirSync(path.resolve(__dirname, '../guide/extends'))
  .map(filename => '/guide/extends/' + filename.slice(0, -3))
  .sort()
console.log('----------------')
console.log(componentDocs)
console.log('----------------')
function getGuideSidebar (groupA, groupB,groupC) {
  return [
    {
      title: groupA,
      collapsable: false,
      sidebarDepth: 3,
github vuejs / vuepress / packages / @vuepress / core / lib / node / __tests__ / prepare / App.spec.js View on Github external
const { fs, path } = require('@vuepress/shared-utils')
const App = require('../../App')

const docsBaseDir = path.resolve(__dirname, 'fixtures')
const docsModeNames = fs.readdirSync(docsBaseDir)
const docsModes = docsModeNames.map(name => {
  const docsPath = path.resolve(docsBaseDir, name)
  const docsTempPath = path.resolve(docsPath, '.vuepress/.temp')
  return { name, docsPath, docsTempPath }
})

describe('App', () => {
  test('should not throw error', async () => {
    await Promise.all(docsModes.map(async ({ name, docsPath, docsTempPath }) => {
      await fs.ensureDir(docsTempPath)
      const app = new App({
        sourceDir: docsPath,
        theme: '@vuepress/default',
        emp: docsTempPath
      })
      expect(app.sourceDir).toBe(docsPath)
github MetaMask / metamask-docs / docs / .vuepress / config.js View on Github external
'signing-data',
      ]
    },
    {
      title: groupC,
      collapsable: false,
      children: [
        'registering-function-names',
        'registering-your-token',
        'defining-your-icon',
      ]
    }
  ]
}

const officalPlugins = fs
  .readdirSync(path.resolve(__dirname, '../plugin/official'))
  .map(filename => 'official/' + filename.slice(0, -3))
  .sort()
github vuejs / vuepress / packages / @vuepress / core / lib / node / theme-api / index.js View on Github external
const readdirSync = dir => (fs.existsSync(dir) && fs.readdirSync(dir)) || []
github vuejs / vuepress / packages / @vuepress / core / lib / node / loadTheme.js View on Github external
const localThemePath = resolve(vuepressDir, 'theme')
  theme = theme || siteConfig.theme || options.theme

  let path
  let name
  let shortcut
  let entry = {}

  /**
   * 1. From `.vuepress/theme` directory.
   */
  if (
    !ignoreLocal
    && !fs.existsSync(theme)
    && fs.existsSync(localThemePath)
    && fs.readdirSync(localThemePath).length > 0
  ) {
    path = localThemePath
    name = shortcut = 'local'
    logger.tip(`Apply local theme at ${chalk.gray(path)}...`)

    /**
     * 2. From deps or custom local path.
     *    - vuepress-plugin-foo
     *    - /path/to/a-theme/index.js
     */
  } else if (isString(theme)) {
    /**
     * To let theme resolver get the correct theme name.
     */
    if (theme.endsWith('/index.js')) {
      theme = theme.replace(/\/index\.js$/, '')
github vuejs / vuepress / packages / docs / docs / .vuepress / config.js View on Github external
]
    },
    {
      title: groupB,
      collapsable: false,
      children: [
        'frontmatter',
        'permalinks',
        'markdown-slot',
        'global-computed'
      ]
    }
  ]
}

const officalPlugins = fs
  .readdirSync(path.resolve(__dirname, '../plugin/official'))
  .map(filename => 'official/' + filename.slice(0, -3))
  .sort()

function getPluginSidebar (pluginTitle, pluginIntro, officialPluginTitle) {
  return [
    {
      title: pluginTitle,
      collapsable: false,
      children: [
        ['', pluginIntro],
        'using-a-plugin',
        'writing-a-plugin',
        'life-cycle',
        'option-api',
        'context-api'