Node.js virtual environment builder for creating isolated Node.js environments
80
Build a Python tool that automates the setup of isolated Node.js development environments with package dependency management.
Your tool must implement the following functionality:
Create a function that sets up a new isolated Node.js environment in a specified directory. The environment should:
Implement functionality to:
express@4.18.0)Provide a way to update packages in an existing environment from a requirements file without recreating the entire environment.
express@4.18.0 and lodash@4.17.21 successfully installs both packages @testdef setup_environment(env_dir: str, node_version: str = 'latest', requirements_file: str = None) -> None:
"""
Create an isolated Node.js environment.
Args:
env_dir: Directory path where the environment will be created
node_version: Node.js version to install (default: 'latest')
requirements_file: Optional path to requirements file for package installation
"""
pass
def export_packages(env_dir: str, output_file: str, local_only: bool = False) -> None:
"""
Export installed packages to a requirements file.
Args:
env_dir: Directory path of the Node.js environment
output_file: Path to output requirements file
local_only: If True, only export locally installed packages
"""
pass
def update_packages(env_dir: str, requirements_file: str) -> None:
"""
Update packages in an existing environment from a requirements file.
Args:
env_dir: Directory path of the existing Node.js environment
requirements_file: Path to requirements file with package specifications
"""
pass@generates
Provides Node.js virtual environment creation and management capabilities.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-nodeenvdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10