How nvuillam/npm-groovy-lint works
Project type and purpose
• This is an open‐source CLI/NPM package (“npm-groovy-lint”) that provides Groovy/Jenkinsfile linting, formatting and auto-fix capabilities by wrapping the CodeNarc engine in a Node.js interface and a lightweight Java/Groovy microservice.
• Key use cases: local CLI tool, CI/CD integration (Jenkins, CircleCI, GitHub Actions/Mega-Linter), VSCode extension, Docker image.
File structure
• Top-level:
• package.json, index.d.ts, lib/ – Node.js code (CLI, module API, filters, rules loader, Java launcher)
• groovy/src/main/com/nvuillam – Groovy microservice code (CodeNarcServer, filters, request/response handlers)
• lib/java – All JAR dependencies used by the microservice (CodeNarc, Groovy, logging, etc.)
• scripts/ – Build/deploy helper scripts (assemble server, update jars, VSCode integration)
• test/ – Jest/Mocha tests for the Node.js API and CLI behaviors
• docs/ – MkDocs documentation, images and assets
• CI config: .github/workflows, .dockerignore, Dockerfile
• Patterns & architectural choices:
• “Client/server” within one package: Node.js acts as CLI “client,” Groovy/Java as microservice “server”
• NPM module exposes both CLI and programmatic API
• CodeNarcServer (Groovy HTTP server with Gzip, Logging and Tracing filters)
• Java-caller module to spawn/manage the Java process
README for additional insights
• Describes workflow: Node CLI invokes Java microservice (unless --noserver) to improve performance by reusing one JVM.
• Explains configuration, rule sets, auto-fix, format, logging, output formats.
• Shows various integration points: VSCode extension, Docker, Mega-Linter, CI pipelines.
Elements
• Orange parallelograms for external systems (CI, Docker, IDE)