gradle-to-js is a JavaScript library designed to parse Gradle build files (`.gradle`) into plain JavaScript objects. Currently at version 2.0.1, it offers a 'quick & dirty' approach, focusing on extracting key-value pairs and block structures rather than executing or accurately representing runtime evaluations within the Gradle script. This means complex logic, closures, or dynamic expressions found in Gradle files will not be processed, resulting in a simplified, static representation. The library primarily supports CommonJS imports and is best suited for scenarios where a basic, structural understanding of a Gradle file is needed, rather than a full, executable interpretation. Its release cadence appears infrequent, and it is likely in maintenance mode, reflecting its specific and somewhat limited parsing scope.
npm install gradle-to-jsVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to parse a Gradle build file into a JavaScript object using `parseFile` and then logs the structured representation. It includes setup for a temporary file and error handling.
Understand that this library is for static structural parsing only. For full Gradle script evaluation, consider using Gradle itself or a more sophisticated Groovy/Kotlin parser.
Use CommonJS `require()` syntax: `const g2js = require('gradle-to-js/lib/parser');`. If you must use it in an ESM context, consider dynamic `import('gradle-to-js/lib/parser')` or a bundler.Always import the specific parser module: `require('gradle-to-js/lib/parser')`.For CLI usage, execute `node node_modules/gradle-to-js/index.js <path-to-file>` or verify `package.json` for a `bin` entry and use the appropriate command.
Ensure you are importing from the correct path: `const g2js = require('gradle-to-js/lib/parser');`Use CommonJS `require()` syntax: `const g2js = require('gradle-to-js/lib/parser');`Double-check the file path. Ensure it's correct and that the Node.js process has read permissions for the specified file.
No dependency data recorded yet.