1
|
/*!
|
2
|
* global-modules <https://github.com/jonschlinkert/global-modules>
|
3
|
*
|
4
|
* Copyright (c) 2015-2017 Jon Schlinkert.
|
5
|
* Licensed under the MIT license.
|
6
|
*/
|
7
|
|
8
|
'use strict';
|
9
|
|
10
|
const path = require('path');
|
11
|
const prefix = require('global-prefix');
|
12
|
let gm;
|
13
|
|
14
|
function getPath() {
|
15
|
if (process.platform === 'win32' || process.env.OSTYPE === 'msys' || process.env.OSTYPE === 'cygwin') {
|
16
|
return path.resolve(prefix, 'node_modules');
|
17
|
}
|
18
|
return path.resolve(prefix, 'lib/node_modules');
|
19
|
}
|
20
|
|
21
|
/**
|
22
|
* Expose `global-modules` path
|
23
|
*/
|
24
|
|
25
|
Reflect.defineProperty(module, 'exports', {
|
26
|
get() {
|
27
|
return gm || (gm = getPath());
|
28
|
}
|
29
|
});
|