Node.js virtual environment builder for creating isolated Node.js environments
80
Main entry point and command-line argument processing for the nodeenv tool. Provides comprehensive argument parsing, configuration loading, and orchestration of environment creation operations.
Primary entry point for the nodeenv command-line tool that handles argument parsing, configuration loading, and orchestrates the entire environment creation process.
def main():
"""
Entry point for nodeenv command-line tool.
Processes command-line arguments, loads configuration, and creates
Node.js virtual environments based on provided options.
Handles special cases like --dump-config-defaults and manages
global settings for SSL certificates and mirror URLs.
"""Usage examples:
import nodeenv
import sys
# Create environment with specific Node.js version
sys.argv = ['nodeenv', '--node=16.20.0', 'myenv']
nodeenv.main()
# Create environment with npm and custom jobs
sys.argv = ['nodeenv', '--with-npm', '--jobs=4', 'myenv']
nodeenv.main()
# List available Node.js versions
sys.argv = ['nodeenv', '--list']
nodeenv.main()Creates and configures the argument parser with all available command-line options for nodeenv.
def make_parser():
"""
Create argument parser for nodeenv command-line interface.
Returns:
argparse.ArgumentParser: Configured parser with all nodeenv options
Includes options for:
- Node.js version selection
- npm configuration
- Environment path and naming
- Build options (jobs, SSL, source vs prebuilt)
- Mirror and proxy settings
- Integration with Python virtualenv
"""Parses command-line arguments and validates them according to nodeenv requirements.
def parse_args(check=True):
"""
Parse command-line arguments for nodeenv.
Parameters:
check (bool): Whether to perform validation checks on arguments
Returns:
argparse.Namespace: Parsed arguments object
Validates argument combinations and sets up proper defaults
based on the current environment and configuration.
"""Creates and configures logging for nodeenv operations with appropriate verbosity levels.
def create_logger():
"""
Create logger instance for nodeenv operations.
Returns:
logging.Logger: Configured logger instance
Sets up logging with appropriate formatters and handlers
for console output during environment creation and management.
"""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