# build-data

> Get metadata for your build

Latest version **0.4.0** (published 2017-09-05) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install build-data
pnpm add build-data
yarn add build-data
bun add build-data
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2017-09-05 |
| First published | 2016-08-07 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Seth Holladay |
| Maintainers | sholladay |
| Keywords | package, tooling, build, builds, compile, current, latest, head, commit, commits, rev, hash, version, versions, git, branch, name, meta, data, metadata, info |

## Links

- npm: https://www.npmjs.com/package/build-data
- Repository: https://github.com/sholladay/build-data
- Issues: https://github.com/sholladay/build-data/issues
- npm.io page: https://npm.io/package/build-data

## Dependencies (3)

- [build-path](https://npm.io/package/build-path.md) ^1.0.0
- [branch-name](https://npm.io/package/branch-name.md) ^1.0.0
- [build-version](https://npm.io/package/build-version.md) ^1.0.0

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.4.0 (latest) — 2017-09-05
- 0.3.1 — 2016-09-09
- 0.3.0 — 2016-09-04
- 0.2.2 — 2016-08-30
- 0.2.1 — 2016-08-30
- 0.2.0 — 2016-08-10
- 0.1.0 — 2016-08-07

## README

# build-data [![Build status for build-data](https://img.shields.io/circleci/project/sholladay/build-data/master.svg "Build Status")](https://circleci.com/gh/sholladay/build-data "Builds")

> Get metadata for your build

## Why?

 - Useful for managing [build processes](https://github.com/sholladay/build-dir).
 - Reliable and concurrent data collection.
 - Intelligent behavior in or out of a repository.

## Install

```sh
npm install build-data --save
```

## Usage

Get it into your program.

```js
const buildData = require('build-data');
```

Get the current [branch name](https://github.com/sholladay/branch-name) and a [version](https://github.com/sholladay/build-version) to be associated with your build.

```js
buildData().then((data) => {
    console.log('data:', data);
    // {
    //     branch  : 'master',
    //     version : '1.0.0'
    // }
});
```

Get the data that was used for the most recent build.

```js
buildData.latest().then((data) => {
    console.log('data:', data);
});
```

You can and should provide any data you know already.

```js
buildData({ version : '3.2.1' }).then((data) => {
    console.log('data:', data);
});
```

## API

### buildData(option)

#### option

Type: `object`

Settings and known build metadata.

##### cwd

Type: `string`<br>
Default: `process.cwd()`

The parent directory of the build root.

##### branch

Type: `string`

Use the given branch name, instead of asking git.

##### version

Type: `string`

Use the given version, instead of asking [build-version](https://github.com/sholladay/build-version).

### buildData.latest(option)

Same as `buildData()`, except the `branch` defaults to the most recently built branch and `version` defaults to the most recently built version of the branch.

## Related

 - [delivr](https://github.com/sholladay/delivr) - Build your code and ship it to S3
 - [build-files](https://github.com/sholladay/build-files) - Read the files from your build
 - [build-keys](https://github.com/sholladay/build-keys) - Get the paths of files from your build
 - [build-dir](https://github.com/sholladay/build-dir) - Get a place to put your build
 - [build-path](https://github.com/sholladay/build-path) - Get a path for the given build
 - [build-version](https://github.com/sholladay/build-version) - Get a version for your build
 - [branch-name](https://github.com/sholladay/branch-name) - Get the current branch name

## Contributing

See our [contributing guidelines](https://github.com/sholladay/build-data/blob/master/CONTRIBUTING.md "Guidelines for participating in this project") for more details.

1. [Fork it](https://github.com/sholladay/build-data/fork).
2. Make a feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. [Submit a pull request](https://github.com/sholladay/build-data/compare "Submit code to this project for review").

## License

[MPL-2.0](https://github.com/sholladay/build-data/blob/master/LICENSE "License for build-data") © [Seth Holladay](https://seth-holladay.com "Author of build-data")

Go make something, dang it.

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