Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inferUserDocsDirectory causes performance and permission issues #1721

Open
1 task done
haoqunjiang opened this issue Jul 26, 2019 · 0 comments
Open
1 task done

inferUserDocsDirectory causes performance and permission issues #1721

haoqunjiang opened this issue Jul 26, 2019 · 0 comments
Labels
type: enhancement Request to enhance an existing feature

Comments

@haoqunjiang
Copy link
Member

  • 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…").
@ulivz ulivz added the type: enhancement Request to enhance an existing feature label Jul 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Request to enhance an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants