# build-version

> Get a version for your build.

Latest version **1.0.0** (published 2017-02-03) · MPL-2.0 license · 0 weekly downloads

## Install

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

## 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 | 1.0.0 |
| Published | 2017-02-03 |
| First published | 2016-08-07 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Seth Holladay |
| Maintainers | sholladay |
| Keywords | compile, build, builds, rev, hash, package, version, tooling |

## Links

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

## Dependencies (3)

- [username](https://npm.io/package/username.md) ^2.2.2
- [head-hash](https://npm.io/package/head-hash.md) ^0.2.3
- [read-pkg-up](https://npm.io/package/read-pkg-up.md) ^2.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

- 1.0.0 (latest) — 2017-02-03
- 0.2.2 — 2016-09-04
- 0.2.1 — 2016-08-30
- 0.2.0 — 2016-08-10
- 0.1.0 — 2016-08-07

## README

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

> Get a version for your build.

## Why?

 - Versioning your builds improves integrity.
 - Ensures your build numbers are useful and meaningful.
 - Intelligent behavior in or out of a repository.

## Install

```sh
npm install build-version --save
```

## Usage

Get it into your program.

```js
const buildVersion = require('build-version');
```

Get a version to use when writing the build.

```js
buildVersion().then((version) => {
    console.log(version);
    // '1.0.0'
});
```

## API

### buildVersion(option)

Returns a promise for the first successful of the following:

1. A release tag, if the most recent commit is a release.
2. The short hash of the most recent commit.
3. The version from package.json, if not in a git repository.

If in a git repository and the working directory is dirty, the username and date are appended to the version. This makes dirty versions stand out and provides useful context for what might be different about the build.

For example: `1.0.0+sholladay.20161022T095547Z` or `a420250+sholladay.20161022T095547Z`

#### option

Type: `object`.

##### cwd

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

The parent directory of the build root.

## 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-data](https://github.com/sholladay/build-data) - Get metadata for your build.
 - [build-path](https://github.com/sholladay/build-path) - Get a path for the given build.
 - [branch-name](https://github.com/sholladay/branch-name) - Get the current branch name.

## Contributing

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

1. [Fork it](https://github.com/sholladay/build-version/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-version/compare "Submit code to this project for review.").

## License

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

Go make something, dang it.

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