# gradle-to-js

> A quick & dirty Gradle build file to JavaScript object parser

Latest version **2.0.1** (published 2022-04-10) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install gradle-to-js
pnpm add gradle-to-js
yarn add gradle-to-js
bun add gradle-to-js
```

Provides the command `gradle-to-js`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2022-04-10 |
| First published | 2016-01-27 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 32.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 45 |
| Author | Karl Lindmark |
| Maintainers | karllindmark |
| Keywords | gradle, javascript, parsing |

## Links

- npm: https://www.npmjs.com/package/gradle-to-js
- Repository: https://github.com/ninetwozero/gradle-to-js
- Homepage: https://github.com/ninetwozero/gradle-to-js#readme
- Issues: https://github.com/ninetwozero/gradle-to-js/issues
- npm.io page: https://npm.io/package/gradle-to-js

## Dependencies (1)

- [lodash.merge](https://npm.io/package/lodash.merge.md) ^4.6.2

## Recent versions

- 2.0.1 (latest) — 2022-04-10
- 2.0.0 — 2019-07-15
- 1.2.1 — 2019-03-01
- 1.2.0 — 2018-09-09
- 1.1.0 — 2018-03-19
- 1.0.1 — 2017-08-15
- 0.2.5 — 2016-12-28
- 0.1.1 — 2016-08-07
- 0.1.0 — 2016-04-29
- 0.0.2 — 2016-01-30
- 0.0.1 — 2016-01-27

## README

# gradle-to-js

[![NPM Version](https://img.shields.io/npm/v/gradle-to-js.svg)](https://www.npmjs.com/package/gradle-to-js)
[![Build Status][1]][2]

## 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:

```sh
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

```js
var g2js = require('gradle-to-js/lib/parser');
g2js.parseFile('path/to/buildfile').then(function(representation) {
  console.log(representation);
});
```

#### Strings

```js
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.

```bash
./index.js test/sample-data/small.build.gradle
```

```json
{
  "testblock": {
    "key1": "value1",
    "key2": "value2",
    "nestedKey": {
      "key3": "value3",
      "key4": "value4",
      "key5": {
        "key6": "value6"
      }
    }
  },
  "testblock2": {
    "key1": "value1",
    "key2": "value2"
  },
  "testblock3": "not really"
}
```

## Author

[Karl Lindmark](https://www.github.com/karllindmark)

## License

Apache 2.0

[1]: https://github.com/ninetwozero/gradle-to-js/workflows/ci/badge.svg
[2]: https://github.com/ninetwozero/gradle-to-js/actions

---
_Source: https://npm.io/package/gradle-to-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
