
Security News
CISA Kills Off RSS Feeds for KEVs and Cyber Alerts
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
build-number-generator
Advanced tools
Generates a unique build number with the build time readable "by a human".
Generates a build number to be appended to your product version number, which is unique for each build and which can be read "by a human" to learn about the build time. No need for maintaining the most recent build number in your sources, incrementing it during the build and committing & pushing the new one to your sources.
The generated build number has the following features:
This module offers the following functionality:
Full version: 1.0.3.180625392
Product version: 1.0.3
Build number: 180625392
Built at: 25 June 2018 1:04 PM
Product version marks the particular version of your product for identification and compatibility-checking purposes. The format of the version number is not fixed. [Node.js] modules usually comply with the semver standard.
Build number is an additional stamp to be appended to the e product version to identify, when your product package was built.
Make sure that you have Node >= 6 installed. Install the build-number-generator
package globally to be able to generate and parse build numbers from any directory using PATH
:
$ npm i -g build-number-generator
$ buildnumgen
180625392
$ buildnumgen 1.0.3
1.0.3.180625392
$ buildnumgen 180625392
Mon Jun 25 2018 13:04
$ buildnumgen 1.0.3.180625392
Mon Jun 25 2018 13:04
Running buildnumgen --help
prints usage instructions:
$ buildnumgen -h
Usage: buildnumgen [options] [build_number|product_version]
Options:
-V, --version output the version number
-s, --separator <separator> separates product version from build number
-v, --validate only validates a build number
-h, --help output usage information
Prints a new build number if called without arguments. If called with a
previously generated build number, it will print the time, when it was
generated. If called with a semver number, it will append the build number
to it and print the result. The default build number separator is dot (".").
When validating a build number, the process exists with zero if the input is
valid, otherwise it exists with a non-zero.
Make sure that you use Node >= 6. Install the build-number-generator
package locally as a development dependency to be able to generate and parse build numbers from JavaScript:
npm i -D build-number-generator
The main module exports four functions to generate build numbers, validate them, parse them to Date instances and format them to shortened readable Date strings.
const { generate, validate, parse, format } = require('build-number-generator')
// Returns '180625392'
const buildNumber = generate()
// Returns '1.0.3.180625392'
const buildNumber = generate('1.0.3')
// Returns '1.0.3.180625392'
const buildNumber = generate({ version: '1.0.3' })
// Returns '2018/06-180625392'
const buildNumber = generate({ version: '2018/06', versionSeparator: '-' })
// Returns true
const valid = validate('180625392')
// Returns true
const valid = validate('1.0.3.180625392')
// Returns false
const valid = validate('1.0.3')
// Returns Date instance with Jun 25 2018 13:04
const time = parse('180625392')
// Returns Date instance with Jun 25 2018 13:04
const time = parse('1.0.3.180625392')
// Throws an error
const time = parse('1.0.3')
// Returns 'Mon Jun 25 2018 13:04'
const buildTime = format('180625392')
// Returns 'Mon Jun 25 2018 13:04'
const buildTime = format('1.0.3.180625392')
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Copyright (c) 2018 Ferdinand Prantl
Licensed under the MIT license.
0.0.2
Do not package files not needed in the npm module
FAQs
Generates a unique build number with a human-readable build time.
The npm package build-number-generator receives a total of 2,166 weekly downloads. As such, build-number-generator popularity was classified as popular.
We found that build-number-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.