build-version
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:
- A release tag, if the most recent commit is a release.
- The short hash of the most recent commit.
- 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()
Parent directory of the build root.
Related
- delivr - Build your code and ship it to S3
- build-files - Read the files from your build
- build-keys - Get the paths of files from your build
- build-dir - Get a place to put your build
- build-data - Get metadata for your build
- build-path - Get a path for the given build
- branch-name - Get the current branch name
Contributing
See our contributing guidelines for more details.
- Fork it.
- Make a feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request.
License
Go make something, dang it.