Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
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.
The npm package calver receives a total of 3,964 weekly downloads. As such, calver popularity was classified as popular.
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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.