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

WIP: Support Yarn Global #22

Open
tunnckoCore opened this issue Oct 9, 2017 · 2 comments
Open

WIP: Support Yarn Global #22

tunnckoCore opened this issue Oct 9, 2017 · 2 comments

Comments

@tunnckoCore
Copy link
Owner

tunnckoCore commented Oct 9, 2017

@tunnckoCore
Copy link
Owner Author

There is jonschlinkert/global-modules#8 (comment) by Jon.

@tunnckoCore
Copy link
Owner Author

Consider using global-dirs

Demo

import globalDirs from 'global-dirs';

function isInstalledGlobally(name) {
  /* eslint-disable no-restricted-syntax */

  let exists = false;
  for (const [, dirs] of Object.entries(globalDirs)) {
    for (const [, globalPath] of Object.entries(dirs)) {
      const fp = path.join(globalPath, name);
      if (fs.existsSync(fp)) {
        exists = true;
        break;
      }
    }
  }
  return exists;
}

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

No branches or pull requests

1 participant