Skip to main content

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+

Source PyPI package

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.

Source Distribution

npmenv-0.0.0.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

npmenv-0.0.0-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page