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

cwd option in root of the config not used yet #115

Closed
akaguny opened this issue Jun 4, 2020 · 4 comments
Closed

cwd option in root of the config not used yet #115

akaguny opened this issue Jun 4, 2020 · 4 comments

Comments

@akaguny
Copy link
Contributor

akaguny commented Jun 4, 2020


maybe delete it?

@adamreisnz
Copy link
Owner

@akaguny
Copy link
Contributor Author

akaguny commented Jun 7, 2020

This parameter only works for the sync mode?
But why do not use config.glob.cwd?
We can delete useless code)

  //Extract relevant config
  const {ignore, disableGlobs, glob: globConfig, cwd} = config;

  //Not using globs?
  if (disableGlobs) {
    return patterns;
  }

  //Prepare glob config
  const cfg = Object.assign({ignore}, globConfig, {nodir: true});

  //Append CWD configuration if given (#56)
  //istanbul ignore if
  if (cwd) {
    cfg.cwd = cwd;
  }
  //Extract relevant config
  const {ignore, disableGlobs, glob: globConfig} = config;

  //Not using globs?
  if (disableGlobs) {
    return patterns;
  }

  //Prepare glob config
  const cfg = Object.assign({ignore}, globConfig, {nodir: true});

or in another way for better developer experience we can use config.cwd in all cases)

@adamreisnz
Copy link
Owner

adamreisnz commented Jun 7, 2020

Sorry, I'm afraid I don't follow. The cwd path is not passed on to glob.
It is prefixed for all paths as follows:

//Prefix each path with CWD if given (#56)
  //istanbul ignore if
  if (cwd) {
    return flattened.map(path => `${cwd}${path}`);
  }

I believe there was a reason for this, and it didn't work if you pass it into globs. See #56 for the rationale. This is for when globs are disabled. So this is not useless code as far as I am aware.

@akaguny
Copy link
Contributor Author

akaguny commented Jun 8, 2020

thanks a lot for explain!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants