tessl install tessl/pypi-nodeenv@1.9.0Node.js virtual environment builder for creating isolated Node.js environments
Agent Success
Agent success rate when using this tile
80%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.25x
Baseline
Agent success rate without this tile
64%
Build a Python command-line tool that creates isolated Node.js environments on different platforms and architectures. The tool should automatically detect the system's platform and create an appropriate Node.js environment.
Detect the current operating system and processor architecture to determine the correct Node.js binaries to use.
Create an isolated Node.js environment in a target directory with proper directory structure for the detected platform.
Generate shell activation scripts appropriate for the detected platform (bash for Unix-like systems, PowerShell for Windows).
@generates
def setup_environment(target_dir: str, node_version: str = 'latest') -> None:
"""
Create a Node.js virtual environment in the target directory.
Args:
target_dir: Directory path where the environment will be created
node_version: Node.js version ('latest' or specific version like '20.0.0')
Raises:
RuntimeError: If environment creation fails
"""
passsetup_environment('/tmp/nodeenv1', 'latest') creates a directory at /tmp/nodeenv1 @testsetup_environment('/tmp/nodeenv2', 'latest'), the directory contains a bin/ subdirectory on Unix or Scripts/ on Windows @testsetup_environment('/tmp/nodeenv3', '20.0.0'), running the node binary in the environment reports version 20.0.0 @testsetup_environment('/tmp/nodeenv4', 'latest'), an activation script exists (activate or activate.ps1) in the appropriate directory @testProvides Node.js virtual environment creation and management capabilities with cross-platform support.