index.js 342 B

123456789101112131415
  1. 'use strict';
  2. const fs = require('fs');
  3. const globalDirs = require('global-dirs');
  4. const isPathInside = require('is-path-inside');
  5. module.exports = (() => {
  6. try {
  7. return (
  8. isPathInside(__dirname, globalDirs.yarn.packages) ||
  9. isPathInside(__dirname, fs.realpathSync(globalDirs.npm.packages))
  10. );
  11. } catch {
  12. return false;
  13. }
  14. })();