How benoror/better-npm-run works
Main Components
a) Core Components:
• Command Parser
• Environment Handler
• Script Executor
• .env File Loader
• CLI Interface
b) External Interfaces:
• NPM Scripts Integration
• Shell Environment
• File System (.env file)
[CLI Input] -> [better-npm-run Core] -> [Script Execution]
[CLI Interface (bnr/better-npm-run)]
• ↓
[Command Parser] ←→ [package.json betterScripts]
• ↓
[Environment Handler] ←→ [.env File Loader]
• ↓
[Script Executor] → [Shell/Process Execution]
Specific Elements
• CLI Commands (bnr/better-npm-run)
• package.json betterScripts configuration
• .env file
• Environment variables
b) Process Flows:
• Command parsing flow
• Environment variable resolution
• Script execution pipeline
Important Details to Highlight
• Environment Variable Priority:
1. betterScripts env configuration
2. .env file values
3. Existing environment variables
• Command Processing:
• How the tool processes both string commands and object configurations
• Parameter parsing mechanism
Technical Specifications
• Rectangles: Core components
• Green: Input sources
• Blue: Processing components
• Yellow: Output/Execution
Implementation Details
• lib/exec.js: Main execution logic
• index.js: Entry point and CLI handling
• Environment handling (test/env.js, test/env-extend.js)
• Parameter processing (test/params.js)