Skip to content

inferUserDocsDirectory causes performance and permission issues #1721

Open
@haoqunjiang

Description

@haoqunjiang
  • I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

cd /
vuepress -v

What is expected?

Output the version number

What is actually happening?

The command would either be stuck or throw an EACESS error.

Other relevant information

It's caused by this function:

async function inferUserDocsDirectory (cwd) {
const paths = await globby([
'**/.vuepress/config.js',
'!node_modules'
], {
cwd,
dot: true
})

There are several problems with this approach:

  1. For global commands such as --version, --help, this detection is redundant;
  2. Should have error handling if permission issue encountered;
  3. There's performance bottleneck in globby if used in a large directory (say, the user home directory), should output a progress indicator in that case (e.g. "Searching for documentation under the current directory…").

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: enhancementRequest to enhance an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions