A wrapper for npm that stores node_modules outside of project and provides easy access to them.
Project description
npmenv
A wrapper for npm that stores node_modules outside of project and provides easy access to them.
npmenv
is a Python module inspired by pipenv
in that it stores packages outside of projects (in an OS-specific dir) to avoid cluttering projects. It also has a run
command that puts node_modules/.bin
in PATH
before running the given command. If you install node
in a project then it will have the added benefit of using that node version to run your code and third-party scripts. You can then lock down your node version per-project and upgrade them individually when desired.
Install: pip install npmenv
Supports: All platforms (Linux, MacOS, Windows)
Requires: Python 3.6+
CLI usage
npmenv 0.0.0
env-list List all currently existing environments
env-location Output path to env for current dir (may not exist yet)
env-run cmd [args] Run command with env's bin dir in start of PATH
env-rm [env_id] Remove the env for current dir (or env with given id)
env-cleanup Remove envs for projects that no longer exist
Module API
Exception for npmenv-related issues
env_cleanup() -> list
Remove envs for projects that no longer exist (no package or lock file)
env_list() -> list
Return list of npmenv ids and their corresponding project dirs
env_location(proj_dir:Union[pathlib.Path, str]=None) -> pathlib.Path
Return env dir path for given project dir (may/may not exist yet)
env_npm(args:str='', proj_dir:Union[pathlib.Path, str]=None) -> subprocess.CompletedProcess
Execute npm with given args in env dir of given project dir
env_rm(identifier:Union[pathlib.Path, str]=None) -> str
Remove the env for given project dir or env id (defaults to CWD)
env_run(args:str, proj_dir:Union[pathlib.Path, str]=None) -> subprocess.CompletedProcess
Run a command with node_modules/.bin at start of PATH environment variable
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.