New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gradle-to-js

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gradle-to-js

A quick & dirty Gradle build file to JavaScript object parser

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

gradle-to-js

NPM Version Build Status

What's this gradle-to-js thing?

gradle-to-js is a quick & dirty Gradle build file to JavaScript object parser. It is quick & dirty in the sense that it doesn't give you an exact replica of whatever the build file represents during runtime, as evaluations and similar bits are (currently) too much of a hassle to accurately represent while parsing.

Installation

Simply run the following command to include it into your project:

npm install gradle-to-js --save

Usage

As a module

Using gradle-to-js as a module, you can parse both strings and files as seen below.

Files
var g2js = require('gradle-to-js/lib/parser');
g2js.parseFile('path/to/buildfile').then(function(representation) {
  console.log(representation);
});
Strings
var g2js = require('gradle-to-js/lib/parser');
g2js.parseText('key "value"').then(function(representation) {
  console.log(representation);
});

The promise will eventually resolve an object matching the build file structure and values.

Using the CLI

You can also use the module directly from the CLI, and get a json representation out of it. Nifty ey? Currently only supporting files from this direction.

./index.js test/sample-data/small.build.gradle
{
  "testblock": {
    "key1": "value1",
    "key2": "value2",
    "nestedKey": {
      "key3": "value3",
      "key4": "value4",
      "key5": {
        "key6": "value6"
      }
    }
  },
  "testblock2": {
    "key1": "value1",
    "key2": "value2"
  },
  "testblock3": "not really"
}

Author

Karl Lindmark

License

Apache 2.0

Keywords

FAQs

Package last updated on 10 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc