How node-gradle/gradle-node-plugin works
Main Components
a. Core Plugin Components:
• NodePlugin (Main entry point)
• NodeExtension (Configuration)
• PackageJsonExtension (Package.json handling)
b. Package Manager Integration Modules:
• npm Module
• Yarn Module
• pnpm Module
• Bun Module
c. Execution Components:
• Task System
• Exec Runners
• Platform Helpers
Rectangle: Core Components
Hexagon: Package Managers
• [External Tools]
• ┌──────────────┐
• Node.js │
• npm │
• Yarn │
• pnpm │
• Bun │
• ┘
• ▲
┌─────────────────────────────────────────┼─────────────────────────────────┐
• Gradle Node Plugin │
• ┌─────────────────┐ ┌───────┴──────────┐ │
• Core Plugin │ │ Exec System │ │
• ┌───────────┐ │ │ ┌──────────────┐ │ ┌────────────┐ │
• NodePlugin │◄──┼──────────►│ │ ExecRunner │ │ │Platform │ │
• ┘ │ │ └──────────────┘ │ │Helpers │ │
• ┌───────────┐ │ │ ┌──────────────┐ │ │┌─────────┐ │ │
• Extensions │ │ │ │NodeExecRunner│ │ ││Platform │ │ │
• ┘ │ │ └──────────────┘ │ │└─────────┘ │ │
• ┘ └─────────────────┘ └────────────┘ │
• ▲ │
• ┌─────────────────────────────────────┴─────────────────────────────┐ │
• Package Manager Modules │ │
• ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
• npm │ │ Yarn │ │ pnpm │ │ Bun │ │ │
• Module │ │ Module │ │ Module │ │ Module │ │ │
• ┘ └──────────┘ └──────────┘ └──────────┘ │ │
• ┘ │
• ┘
Key Elements to Highlight
• Clear separation between the plugin's internal components and external tools
• Plugin's role as a bridge between Gradle and Node.js ecosystem
• Modular nature of package manager support
• Execution flow from Gradle tasks through the exec system to external tools
Important Relationships
• NodePlugin's central role in coordinating all components
• Package manager modules' dependency on the exec system
• Platform helpers' support for cross-platform compatibility
• Extension configuration flow to tasks and execution
Additional Notes
• Version compatibility information (Gradle 6.6+, Node.js 10+)
• Optional nature of different package managers
• Configuration points for proxy settings and environment variables
Implementation Details
• Brief annotations for key interaction points
• How the plugin integrates with Gradle
• The flow of execution from Gradle tasks to Node.js tools
• The modular architecture supporting different package managers
• Cross-platform support implementation
• Configuration and extension points