Code Monkey home page Code Monkey logo

node-calver's Introduction

Murat GΓΆzel

Hi there,

My name is Murat. I'm an independent, senior-level software developer specialized in creating accessible, beautiful and robust software products. My portfolio contains various kind of applications including frontend, backend, bot, iOS and CLI apps. I worked with B2B companies closely for most of my career and has been in different kind of digital communities.

It's been more than ten years I have been building custom software and making infrastructural decisions, therefore yes, I have a few open-source projects that I built completely with the intention of helping young fellows. You will find some below.

Tech Stack

My tech stack contains technologies both in programming and design. These are the technologies I trust most and can recommend.

  • My primary programming language is javascript with typescript and I'm able to code in python, solidity, swift and shell as well.
  • eslint and prettier to keep my codebases clean and standard.
  • vitest for testing.
  • Conventional commits, commitlint, Buildkite and shell scripts to run CI/CD workflows.
  • Svelte as a frontend framework including SSG.
  • Tailwind for styling.
  • Fastify as backend server framework.
  • Redis for in-memory storage.
  • PostgreSQL as a database and DataGrip as GUI.
  • Logto for authentication.
  • Docker for containerizing my backend apps.
  • WebStorm as a code editor.
  • Xcode for iOS apps.
  • Sketch to design user interfaces and other things.
  • Adobe Illustrator for print design.
  • Digitalocean for cloud servers.
  • AWS S3 for various storage needs.
  • Infisical for secret management.
  • Postmark and AWS SES for transactional email.
  • Matomo for analytics.

Principles

  • I avoid workng with big tech giants as much as possible.
  • Learn what's new and stay customer optimized.
  • Infrastructure comes first to create maintainable and reliable products.
  • My frontend products are compatible with modern browsers, IE 10 and IE 11.

Design Portfolio

My works can be found here: behance.net/muratgozel

node-calver's People

Contributors

aazbeltran avatar banyan avatar kherock avatar mstelz avatar muratgozel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

node-calver's Issues

Semantic calendar bumps aren't working

The last refactor has a major regressed where the feature discussed in #2 is no longer possible.

calver.inc('YY.MM.MINOR', '21.1.0', 'calendar.minor')
Uncaught:
Error: The second tag of the level should be a modifier tag. You specified "MINOR" as the second tag and "CALENDAR" as the first tag.

It seems like this feature was explicitly removed based on the v21.11.0 changelog

Second level might only be a modifier

Just as a reminder, I gave a rationale for why this feature is helpful here: #2 (comment).

Behaviour of the 'micro' inc function

When I make use of date-based elements in my version tag, I would expect Calver to automatically update these correctly.

Take this example:

const version = new Calver('YYYY.MM.MICRO', '2020.11.3');
version.inc(); // 2020.12.0

const version2 = new Calver('YYYY.MM.MICRO', '2020.12.0');
version2.inc(); // 2020.12.0

The first version number was last created in november (2020-11), since it is december now, it updates to 2020.12.0.
If I want to increase the version number again in december, executing the inc() function returns exactly the same version number. Instead, we'll have to use inc('micro') to get 2020.12.1.

Maybe I'm missing something, but it seems to me that calver-based version numbers always should be adding one to the micro-level in this case, since the year and month levels did not change from the current version number. Calver knows what day it is, so it can compare it with the current version name to determine what should be updated.

I would expect the following behaviour:

const version = new Calver('YYYY.MM.MICRO', '2020.11.3');

// It is november 15th
version.inc(); // 2020.11.4 

// It is november 30th
version.inc(); // 2020.11.5

// It is december 1st
version.inc(); // 2020.12.0

// a later day in december
version.inc(); // 2020.12.1

inc behavior unclear

Hi!
It is not exactly clear to me how calver.inc(format ,version , 'calendar') is supposed to work.
For example the following test cases scenarios:

assert.strictEqual(calver.inc('yyyy.mm.patch', '2020.6.1', 'calendar'), '2021.1.0')
assert.strictEqual(calver.inc('yyyy.mm.patch', '2021.1.0', 'calendar'), '2021.1.0')

The first line I would expect that the calendar is updated to the current date, and the patch number is reset.
For the second line I would expect to get some kind of error, because the inc doesn't actually increment anything.

Is this supposed to happen?

proposal: build identifier after modifiers

Great package, thanks for sharing πŸ™πŸΌ

I want to propose adding a build-identifier option that, if used, would be appended to a modifier. The identifier on previous versions would be ignored when determining next version, and would not affect the current version rolling logic.

This would also comply with semver conventions.

From semver:

Build metadata MUST be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85, 1.0.0+21AF26D3β€”-117B344092BD.

Example scenario

  • Calver format: yy.mm.dd.patch
  • Version on production: 22.9.10.0
  • git short sha: abcd123

A developer is working on the feature deployment branch fixing-stuff and determined version for the first feature deployment is 22.9.10.1-dev.0 accessible at https://fixing-stuff-abcd123.dev.company.com. There are several services that participate in the deployment, e.g. sentry, spinnaker, et.c.

A build identifier that would become part of of the deployment chain would simplify targeting regressions or broken deployments.

Example version using a build identifier: 22.9.10.1-dev.0+fixing-stuff-abcd123.

This would allow developers and QA to quickly target where problems were solved (or occurred) during the development phase since it has a human annotation to it πŸ˜„

I am up for creating a PR if this makes sense, otherwise I will concat the build identifer to the calver version.

Modifier gets set to -1 when bumping calendar and minor for a previous month version.

Hi,
When I pass increment as calendar.minor.rc to a previous month version without the modifier, the modifier gets set to -1. I'm not sure if maybe I'm trying something unusual here. I would expect that the following command gives me 2023.3.0-rc.0.

> const calver = await require('calver')
undefined
> calver.inc("yyyy.mm.minor", "2023.2.2", "calendar.minor.rc")
'2023.3.0-rc.-1'

If I try setting increment as calendar.rc, it keeps the minor:

> calver.inc("yyyy.mm.minor", "2023.2.2", "calendar.rc")
'2023.3.2-rc.0'

Is there a way that I can bump from a version without modifier (with date from a previous month), and get minor=0 and rc=0?

Thanks!

Level 2 semantic tags are incremented incorrectly for pre-releases

Hello!

I'm using another Node.js package which leverages this great package to do calendar versioning. I couldn't get it to act like I expected in some cases, and I think this is an oversight in how semantic tags are incremented when (pre-release) modifiers are included.

It centres around whether versions with modifier tags should be considered pre-releases or not, i.e. is 2023.6.0 > 2023.6.0-rc.*?
To be fair, I can see the argument for modifiers like dev or alpha being considered as 'post-release' (2023.6.0-dev.* > 2023.6.0), but rc ("release candidate") should definitely be considered as a pre-cursor release to the main unsuffixed version; this is how semantic versioning treats pre-release tags.

Edit: a suggested fix is in PR #22

Here's some examples to illustrate:

πŸ’‘ N.b. date now in the following is June 2023

Incrementing a pre-release

Welcome to Node.js v18.14.2.
Type ".help" for more information.
> c = require('calver')
Calver {
  seperator: '.',
  levels: [
    'CALENDAR', 'MAJOR',
    'MINOR',    'PATCH',
    'DEV',      'ALPHA',
    'BETA',     'RC'
  ],
  _useLocalTime: false
}
> c.inc('YYYY.MM.MINOR', '2023.5.26', 'calendar.minor.rc')
'2023.6.0-rc.0' βœ… 
> c.inc('YYYY.MM.MINOR', '2023.6.0-rc.0', 'calendar.minor.rc')
'2023.6.1-rc.1' ❌ 

My expectation here is that the second example should result in 2023.6.**0**-rc.1, i.e. the semantic MINOR tag should not be incremented.

Going from release to pre-release

Using calendar.rc is a workaround to the former case, to avoid incrementing the minor as well as the rc tag, but when going from release (no modifier tag) to pre-release (adding -rc.0), minor is also needed, in order to increment the minor semantic tag in the case where the date has not changed, i.e. when adding a pre-release modifier tag, the semantic MINOR tag should be incremented (or reset, if the date has changed):

> c.inc('YYYY.MM.MINOR', '2023.5.17', 'calendar.rc')
'2023.6.0-rc.0' βœ… 
> c.inc('YYYY.MM.MINOR', '2023.6.0', 'calendar.rc')
'2023.6.0-rc.0 ❌
> c.inc('YYYY.MM.MINOR', '2023.5.17', 'calendar.minor.rc')
'2023.6.0-rc.0' βœ… 
> c.inc('YYYY.MM.MINOR', '2023.6.0', 'calendar.minor.rc')
'2023.6.1-rc.0 βœ… 

N.b. obviously the result for calendar.rc when the date has not changed is technically correct, since the minor increment was omitted, but my point is that more that it's the 'undesired' result.

Going from pre-release to release

> c.inc('YYYY.MM.MINOR', '2023.6.0-rc.0', 'calendar.minor')
'2023.6.1' ❌ 

Similarly, the expected result here is 2023.6.0, incrementing the pre-release 2023.6.0-rc.0 by calendar.minor (i.e. dropping the modifier tag) should also not increment the minor semantic tag, because the main release 2023.6.0 is newer than its -rc.* pre-releases.
Using just calendar as the increment level is not a practical workaround, since that doesn't work when the date has changed:

> c.inc('YYYY.MM.MINOR', '2023.5.17-rc.0', 'calendar')
'2023.5.17' ❌ 
> c.inc('YYYY.MM.MINOR', '2023.5.17-rc.0', 'calendar.minor')
'2023.6.0' βœ…  

N.b. this is possibly another/different bug? I would have expected calendar to work here, since the date has changed. It seems to neither reset the minor tag nor update the calendar tag.

Reset increments

Exists an issue where when you are using the major, minor and micro, and you increment minor o major (as example), the lower types must be reset to zero, but those types keep their values.

Example:

const calver=new Calver('YYYY.MINOR.MICRO','2020.0.0');
calver.inc('micro');
console.log(calver.get());
// 2020.0.1
calver.inc('minor');
console.log(calver.get());
// 2020.1.1
// In this case must be 2020.1.0
// And the year must be 2021

separators and modifiers

first thanks for writing this library

I would like to know if you have any plans to support modifiers dev, alpha
and support additional separators to the dot ., like - or _
or simply allow identifiers together, like YYYY0M

let me know if you need more information or prs about it

Missing `post` identifier

I currently have a convoluted way of getting my calendar versioning handled in most of my projects.

First non-(dev,beta,rc) release of the day is tagged/versioned with the date: yyyy.mm.dd
If a second full release is made, for say a hotfix, a suffix is added -1 for example, and is incremented for each subsequent release. This post/hotfix identifier is completely absent if there is only one public release that day. The next day resets to yyyy.mm.dd

On pypi/poetry, when I build and publish with a version like 2024.2.1-1 creates a version on pypi 2024.2.1.post1 with no manual input required.

These are uploaded to pypi and not treated as pre-releases.

I do not have dev,rc,beta builds uploading yet, but I want to get pre-releases up so my users can test it before it goes out wide.

https://pypi.org/project/sickchill/#history

It would be awesome if just calling

with today = 2024.2.1
calver.inc(format, '', 'calendar.post') returned '2024.2.1',
calver.inc(format, '2023.2.1', 'calendar.post') (previous date) returned '2024.2.1',
calver.inc(format, '2024.2.1', 'calendar.post') returned '2024.2.1.post1',
calver.inc(format, '2024.2.1.post1', 'calendar.post') returned '2024.2.1.post2

and possibly add a nulpost (or something of that nature) modifier that would accept and create a post level without modifier words:

calver.inc(format, '', 'calendar.nulpost') returned '2024.2.1',
calver.inc(format, '2023.2.1', 'calendar.nulpost') (previous date) returned '2024.2.1',
calver.inc(format, '2024.2.1', 'calendar.nulpost') returned '2024.2.1-1',
calver.inc(format, '2024.2.1-1', 'calendar.nulpost') returned '2024.2.1-2

Also, note my nulpost has a - separator and pypi converts it to . = maybe a parameter for modifier-level separator?

I'm interested in writing a github action to make this simple for python users to use, and keep both a release branch and a dev/rc branch uploaded to pypi with pre-releases. So any help getting this library to work in the odd way I am trying to make it fit me lmk lol. Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.