Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
add-to-path
Advanced tools
This micro-lib allows you to alter the $PATH
in a cross-platform way.
var path = require('path');
var addToPath = require('add-to-path');
var restorePath = addToPath(path.join(process.cwd(), 'node_modules', '.bin'));
// process.env.PATH now starts with the `.bin` in your `node_modules` directory :-)
// unless you happen to be running on windows, in which case it *might* be process.env.Path :-)
// but you don't have to think about that...
// want to restore the path to what it was before you mucked with it?
// just call the function you get back:
restorePath();
// wanna add several paths at once? Done!
addToPath(['/foo/bar/.bin', '/bar/foo/.bin']);
Allows you to specify your own platform. Defaults to process.platform
. Currently the only meaningful value is
'win32'
. This option is mainly available for testing purposes.
Defaults to undefined
, but when set to true
will add the directory you pass to the end (rather than the beginning).
LICENSE -> MIT
Much of the original code for this came from npm/npm
FAQs
Cross-platform method to add a directory to your $PATH
The npm package add-to-path receives a total of 16 weekly downloads. As such, add-to-path popularity was classified as not popular.
We found that add-to-path demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.