Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

global-paths

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

global-paths - npm Package Compare versions

Comparing version 0.1.2 to 1.0.0

27

index.js
'use strict';
var Module = require('module');
var path = require('path');

@@ -17,11 +18,7 @@ var root = require('global-modules');

module.exports = function paths(cwd) {
cwd = cwd || process.cwd();
var res = Module._nodeModulePaths(cwd || process.cwd());
var res = [npm(cwd)].concat(root);
var segs = cwd.split(path.sep);
res.push(root);
while (segs.pop()) {
res.push((!isWindows() ? '/' : '') + npm(segs.join('/')));
}
// fall back paths
if (process.env.NODE_PATH) {

@@ -32,3 +29,3 @@ var nodePaths = process.env.NODE_PATH.split(path.delimiter);

if (isWindows()) {
res.push(npm(process.env.APPDATA) + '/npm');
res.push(npm(path.join(process.env.APPDATA, 'npm')));
} else {

@@ -39,3 +36,13 @@ res.push(npm('/usr/lib'));

res.push.apply(res, require.main.paths);
var mainModule = process.mainModule;
// run as a vscode plugin dependence
if (!mainModule || process.versions.electron) {
mainModule = module;
do {
mainModule = mainModule.parent;
} while (mainModule.parent && /([\/\\])node_modules\1/.test(mainModule.filename));
}
res = res.concat(mainModule.paths);
return unique(res);

@@ -45,3 +52,3 @@ };

function npm(dir) {
return path.resolve(dir, 'node_modules');
return path.join(dir, 'node_modules');
}
{
"name": "global-paths",
"description": "Returns an array of unique \"global\" directories based on the user's platform and environment. The resulting paths can be used for doing lookups for generators or other globally installed npm packages. Node.js / JavaScript.",
"version": "0.1.2",
"version": "1.0.0",
"homepage": "https://github.com/jonschlinkert/global-paths",

@@ -23,8 +23,9 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"dependencies": {
"array-unique": "^0.2.1",
"global-modules": "^0.2.0",
"is-windows": "^0.1.0"
"array-unique": "^0.3.2",
"global-modules": "^0.2.3",
"is-windows": "^1.0.0"
},
"devDependencies": {
"mocha": "*"
"gulp-format-md": "^0.1.11",
"mocha": "^3.2.0"
},

@@ -38,2 +39,3 @@ "keywords": [

"path",
"paths",
"prefix",

@@ -51,4 +53,19 @@ "resolve"

]
}
},
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"lint": {
"reflinks": true
},
"reflinks": [
"verb",
"verb-generate-readme"
]
}
}

@@ -1,2 +0,2 @@

# global-paths [![NPM version](https://badge.fury.io/js/global-paths.svg)](http://badge.fury.io/js/global-paths) [![Build Status](https://travis-ci.org/jonschlinkert/global-paths.svg)](https://travis-ci.org/jonschlinkert/global-paths)
# global-paths [![NPM version](https://img.shields.io/npm/v/global-paths.svg?style=flat)](https://www.npmjs.com/package/global-paths) [![NPM monthly downloads](https://img.shields.io/npm/dm/global-paths.svg?style=flat)](https://npmjs.org/package/global-paths) [![NPM total downloads](https://img.shields.io/npm/dt/global-paths.svg?style=flat)](https://npmjs.org/package/global-paths) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/global-paths.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/global-paths)

@@ -7,6 +7,6 @@ > Returns an array of unique "global" directories based on the user's platform and environment. The resulting paths can be used for doing lookups for generators or other globally installed npm packages. Node.js / JavaScript.

Install with [npm](https://www.npmjs.com/)
Install with [npm](https://www.npmjs.com/):
```sh
$ npm i global-paths --save
$ npm install --save global-paths
```

@@ -18,3 +18,3 @@

var paths = require('global-paths');
console.log(paths())
console.log(paths());

@@ -32,36 +32,55 @@ // results in (with my setup - macbook pro)

## Related projects
## About
* [contains-path](https://www.npmjs.com/package/contains-path): Return true if a file path contains the given path. | [homepage](https://github.com/jonschlinkert/contains-path)
* [cwd](https://www.npmjs.com/package/cwd): Easily get the CWD (current working directory) of a project based on package.json, optionally starting… [more](https://www.npmjs.com/package/cwd) | [homepage](https://github.com/jonschlinkert/cwd)
* [git-config-path](https://www.npmjs.com/package/git-config-path): Resolve the path to the user's global .gitconfig. | [homepage](https://github.com/jonschlinkert/git-config-path)
* [global-modules](https://www.npmjs.com/package/global-modules): The directory used by npm for globally installed npm modules. | [homepage](https://github.com/jonschlinkert/global-modules)
* [global-prefix](https://www.npmjs.com/package/global-prefix): Get the npm global path prefix. | [homepage](https://github.com/jonschlinkert/global-prefix)
### Related projects
## Running tests
* [contains-path](https://www.npmjs.com/package/contains-path): Return true if a file path contains the given path. | [homepage](https://github.com/jonschlinkert/contains-path "Return true if a file path contains the given path.")
* [cwd](https://www.npmjs.com/package/cwd): Easily get the CWD (current working directory) of a project based on package.json, optionally starting… [more](https://github.com/jonschlinkert/cwd) | [homepage](https://github.com/jonschlinkert/cwd "Easily get the CWD (current working directory) of a project based on package.json, optionally starting from a given path. (node.js/javascript util)")
* [git-config-path](https://www.npmjs.com/package/git-config-path): Resolve the path to the user's local or global .gitconfig. | [homepage](https://github.com/jonschlinkert/git-config-path "Resolve the path to the user's local or global .gitconfig.")
* [global-modules](https://www.npmjs.com/package/global-modules): The directory used by npm for globally installed npm modules. | [homepage](https://github.com/jonschlinkert/global-modules "The directory used by npm for globally installed npm modules.")
* [global-prefix](https://www.npmjs.com/package/global-prefix): Get the npm global path prefix. | [homepage](https://github.com/jonschlinkert/global-prefix "Get the npm global path prefix.")
Install dev dependencies:
### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Contributors
| **Commits** | **Contributor**<br/> |
| --- | --- |
| 6 | [jonschlinkert](https://github.com/jonschlinkert) |
| 1 | [gucong3000](https://github.com/gucong3000) |
### Building docs
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
```sh
$ npm i -d && npm test
$ npm install -g verb verb-generate-readme && verb
```
## Contributing
### Running tests
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/global-paths/issues/new).
Install dev dependencies:
## Author
```sh
$ npm install -d && npm test
```
### Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
### License
Copyright © 2015 Jon Schlinkert
Released under the MIT license.
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/jonschlinkert/global-paths/blob/master/LICENSE).
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 19, 2015._
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on December 10, 2016._

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc