
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
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 (read: 18-06-25, 392*2 minutes after midnight)
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 by running buildnumgen
from any directory in 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 npm test
.
Copyright (c) 2018-2019 Ferdinand Prantl
Licensed under the MIT license.
0.0.6
FAQs
Generates a unique build number with a human-readable build time.
The npm package build-number-generator receives a total of 3,293 weekly downloads. As such, build-number-generator popularity was classified as popular.
We found that build-number-generator demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.