build-version

Get a version for your build.

Usage no npm install needed!

<script type="module">
  import buildVersion from 'https://cdn.skypack.dev/build-version';
</script>

README

build-version Build status for build-version on Circle CI.

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

npm install build-version --save

Usage

Get it into your program.

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

Get a version to use when writing the build.

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
Default: process.cwd()

The parent directory of the build root.

Related

Contributing

See our contributing guidelines for more details.

  1. Fork it.
  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.

License

MPL-2.0 © Seth Holladay

Go make something, dang it.