docs/.vuepress/config.js
function inferSiderbars () {
  // You will need to update this config when directory was added or removed.
  const sidebars = [
    // { title: 'JavaScript', dirname: 'javascript' },
    // { title: 'CSS', dirname: 'css' },
  ]
  return sidebars.map(({ title, dirname }) => {
    const dirpath = path.resolve(__dirname, '../' + dirname)
    return {
      title,
      collapsable: false,
      children: fs
        .readdirSync(dirpath)
        .filter(item => item.endsWith('.md') && fs.statSync(path.join(dirpath, item)).isFile())
        .map(item => dirname + '/' + item.replace(/(README)?(.md)$/, ''))
    }
  })
}
function inferSiderbars () {
  // You will need to update this config when directory was added or removed.
  const sidebars = [
    // { title: 'JavaScript', dirname: 'javascript' },
    // { title: 'CSS', dirname: 'css' },
  ]
  return sidebars.map(({ title, dirname }) => {
    const dirpath = path.resolve(__dirname, '../' + dirname)
    return {
      title,
      collapsable: false,
      children: fs
        .readdirSync(dirpath)
        .filter(item => item.endsWith('.md') && fs.statSync(path.join(dirpath, item)).isFile())
        .map(item => dirname + '/' + item.replace(/(README)?(.md)$/, ''))
    }
  })
}
function inferSiderbars ( ) { // You will need to update this config when directory was added or removed. const sidebars = [ // { title: 'JavaScript', dirname: 'javascript' }, // { title: 'CSS', dirname: 'css' }, ] return sidebars . map ( ( { title , dirname } ) => { const dirpath = path . resolve ( __dirname , '../' + dirname ) return { title , collapsable : false , children : fs . readdirSync ( dirpath ) . filter ( item => item . endsWith ( '.md' ) && fs . statSync ( path . join ( dirpath , item ) ) . isFile ( ) ) . map ( item => dirname + '/' + item . replace ( / (README)?(.md)$ / , '' ) ) } } ) }
If you want to create a docs that automatically lists all files in all subdirectories,
This method will help you complete this task.

If you do not prefer this preset, just remove it and configure it according to the
docs: https://vuepress.vuejs.org/default-theme-config/#sidebar

@returns {Array}
If you want to create a docs that automatically lists all files in all subdirectories This method will help you complete this task .