Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Calendar based software versioning library as node.js module and with cli support.
Calendar based software versioning library as node.js module and with cli support. 📅
It's a way of tagging software state based on in combination of a chosen calendar tags such as YYYY, MM, DD. The chosen tags convey the message of how frequently the software gets major updates, to the user. It doesn't tell anything about breaking changes (there is git-diff for that) but it tells when the next major release will come.
I recommend this article by Donald Stufft to read more about versioning softwares and this website by Mahmoud Hashemi to learn more about calendar versioning.
The format consist of two parts. The calendar part and the minor changes counter. The calendar part describes software's release cycle. The minor part is just a counter over the main release. Take 2024-4.104 for example; the year and the month separated by a dash and the minor counter separated by a dot. So the general template for the format is YYYY-MM-DD.MINOR
. One might choose:
The releases sent before the next release time period, counts as minor changes and therefore it increments the minor part of the version.
npm i -D calver
# or
pnpm add -D calver
The library can be used both as a node.js module and a cli app. Both usages documented below per feature.
There are some defaults to keep in mind while using node-calver.
Finds the next version based on release cycle.
import * as calver from 'calver'
calver.cycle('2024-4.204')
calver 2024-4.204
Depending on the date the code above executed, the output will be 2024-4.205
, 2024-5
or 2024-[current month]
.
It's capable to understand the format you chose with one exception.
calver.cycle('2024.204')
calver 2024.204
Outputs 2024.205
or [current year]
.
The full year, month and day cycle:
calver.cycle('2024-4-16.204')
calver 2024-4-16.204
Outputs 2024-4-16.205
or [current date as YYYY-MM-DD]
.
And the exception is weeks. A cycle option needs to be passed for weekly release cycles:
calver.cycle('2024-32.204', { cycle: 'week' })
calver 2024-32.204 --cycle week # or -c week
Outputs 2024-32.205
or 2024-[current week of the year]
.
A minor method just increments the minor portion of the version and leaves the date portion as it is.
calver.minor('2024') // outputs 2024.1
calver 2024 --minor # outputs 2024.1
calver.minor('2024.204') // outputs 2024.205
calver 2024.204 --minor # outputs 2024.205
calver.minor('2024-4-16.204') // outputs 2024-4-16.205
calver 2024-4-16.204 --minor # outputs 2024-4-16.205
and so on.
calver.initial({ cycle: 'month' })
calver initial --cycle month
Outputs [current year]-[current month]
.
calver.valid('2024-4.123')
// provide cycle for more strict check
calver.valid('2024-4.123', { cycle: 'month' })
Outputs a boolean
.
calver valid 2024-4.123
# or specify --cycle flag for more strict check
calver valid --cycle month
Outputs the exact version string or exits with error.
// newer than
calver.nt('2024-4-20', '2024-4-19') // true
calver.nt('2024-4-20', '2024') // true
calver.nt('2024', '2024-4-20') // false
// older than
calver.ot('2024-4-20', '2024-4-19') // false
calver.ot('2024-4-20', '2024') // false
calver.ot('2024', '2024-4-20') // true
// speciy cycle if you use weeks
calver.nt('2024-32', '2024-30', { cycle: 'week' }) // true
Returns a boolean
calver nt 2024-4-20 2024-4-19
calver ot 2024-4-20 2024-4-19
calver nt 2024-32 2024-30 --cycle week
Outputs the exact version string or exits with error.
Simple helper methods that might be useful in your versioning processes.
calver.prefix('2024-4.123') // outputs v2024-4.123
calver.prefix('2024-4.123', 'v') // outputs v2024-4.123
calver.suffix('2024-4.123', '-something') // outputs 2024-4.123-something
calver.clean(' =v2024-4.123-something ') // 2024-4.123
They work same as in the module api:
calver prefix 2024-4.123
calver prefix 2024-4.123 --prefix v
calver suffix 2024-4.123 --suffix something
calver clean " =v2024-4.123-something "
If you're interested in contributing, read the CONTRIBUTING.md first, please.
Version management of this repository done by releaser 🚀
Thanks for watching 🐬
FAQs
Calendar based software versioning library as node.js module and with cli support.
We found that calver 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.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.