Issue with updating patch version using NPM standard-version

I have integrated standard-version into my javascript project. I made sure to include the release script in my package.json:

"scripts": {
    ...
    "release": "standard-version"
}

However, after adding a commit with the message:

feat: test

Running npm run release led to an increase in the patch version of my project.

Initially, the version was 0.2.1 (tag: v0.2.1), but the generated version became 0.2.2, accompanied by this commit message:

chore(release): 0.2.2

This outcome raises the question - why didn't it increment the minor version instead?

Answer №1

Explicitly specifying x.y.z, 0.x.y, or 0.0.x where x is semver-major, y semver-minor, z semver-patch can be very helpful (as seen in the npm ecosystem) — ljharb

Caret ^ matches Minor releases and it is also the default for save-prefix in npm config. However, it behaves differently with 0.0.X, 0.X.X, and X.X.X

For instance, ^0.0.1 will behave like this:

[✓] 0.0.1
[x] 0.0.2
[x] 0.0.3
[x] 0.1.0

With ^0.1.0:

[✓] 0.1.0
[✓] 0.1.1
[✓] 0.1.2
[x] 0.2.0
[x] 0.2.1
[x] 0.3.0

And with ^1.0.0 it works normally:

[✓] 1.0.0
[✓] 1.0.1
[✓] 1.1.0
[✓] 1.2.1
[x] 2.0.0

Tilde ~ matches Patch releases without exceptions across versions of x.y.z, 0.x.y, and X.X.X. It behaves consistently:

~0.0.1

[✓] 0.0.1
[✓] 0.0.2
[✓] 0.0.3
[x] 0.1.0

~0.1.0

[✓] 0.1.0
[✓] 0.1.1
[✓] 0.1.2
[x] 0.2.0
[x] 0.2.1
[x] 0.3.0

~1.0.0

[✓] 1.0.0
[✓] 1.0.1
[x] 1.1.0
[x] 1.2.1
[x] 2.0.0

You can explore more about version behavior here

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The thread's connection to Yarn times out

Every time I attempt to install a package using Yarn, I encounter the following error: yarn add @mantine/prism yarn add v1.22.19 [1/4] Resolving packages... error An unexpected error occurred: "https://registry.yarnpkg.com/@mantine%2fprism: Socket ...

Attempting to route a selector, yet on the second attempt, the entity is successfully transferred

I am currently working on developing a function that will switch the image every half second for 10 iterations. During the final iteration, the image src will be set to the actual value. Everything seems to work fine for the first loop, however, when the s ...

Make sure that JSON.stringify is set to automatically encode the forward slash character as `/`

In my current project, I am developing a service using nodejs to replace an old system written in .NET. This new service exposes a JSON API, and one of the API calls returns a date. In the Microsoft date format for JSON, the timestamp is represented as 159 ...

The dropdown options for the input type file in Vuejs PWA are not appearing

I have created a Vue.js progressive web app that allows users to easily upload images from their mobile phones. While the app typically functions well, there is an issue where upon downloading the app to the homescreen, the image upload feature sometimes b ...

Tips on accessing the text content of a dt element with prototype

Below is some HTML code that I am working with: <dl> <dt><label>test</label></dt> <dd><input id="someid" type="checkbox" onchange="opConfig.reloadPrice()" class="product-custom-op ...

You cannot invoke this expression while destructuring an array of React hooks in TypeScript

Within my React TypeScript component, I have several fields that check a specific condition. If the condition is not met, the corresponding field error is set to true in order to be reflected in the component's DOM and prevent submission. However, whe ...

Incorporate new content into JavaScript using the input element

I have a unique question - can text be added to JavaScript using the input tag? For example, <input type="text" id="example" /> And let's assume the JavaScript function is: function display_text() { alert("The text entered in #example wi ...

JavaScript Object has Not Been Defined

Currently, I am developing a small program for myself related to a video game. The main issue I am facing is that certain objects are being flagged as not defined when the errors appear on the page. $(document).ready(function(){ //A list of chara ...

Issues with functionality arise when cloning HTML divs using JQuery

VIDEO I created a feature where clicking a button allows users to duplicate a note div. However, the copied note does not function like the original - it's not draggable and changing the color of the copied note affects the original note's color. ...

Enhancing an existing node by adding a new node with jQuery functionalities at the same time

Is it possible to append a node to a parent node while also manipulating the node being added? I initially believed this could be done in one step: //I though this was possible: $('#master').after('<div id="test" style="border:solid 1px ...

invoking a boolean type JavaScript function

I'm currently working on calling a Page Method using AJAX. Take a look at the code below: <asp:Button ID="btn_upload" runat="server" CssClass="btnEffects" Text="Upload" onclick="btn_upload_Click" OnClientClick="return Validate();" /> ...

Is there a way to only retrieve the exception message once within the jQuery each function?

Utilizing the "Tempus Dominus Bootstrap 4" for time manipulation has been a crucial part of my workflow. Recently, I encountered a bug while implementing a function to clear all input values upon clicking a specific button. Unfortunately, the clear funct ...

Tips for modifying the href attribute when a user clicks

Is there a way to dynamically change the value of this link <a href="/Countries/388/10">next</a> without having to refresh the page? For example, if a user clicks on the link, it should update to <a href="/Countries/388/20">next</a&g ...

search through an object to find specific data

Here is a JavaScript object that I have: var data = { "type": [ "car", "bike" ], "wheels": [ "4", "2" ], "open": [ "Jan", "Jan" ] ...

Tips and tricks for implementing vuetify tooltips within a list component

Looking for help with my code: <div id='app'> <v-app> <v-list-tile-content> <v-list-tile v-for="(item, index) in items" :key="item.id" > <v-list-tile-action> {{index+1}}. </v-list-tile-action> < ...

Encountering a null pointer exception while attempting to upload a tar file on the dashboard for setting up Nexus

When attempting to upload a basic js bundle, I encounter the following error stack trace in the nexus dashboard logger: 2018-06-13 16:31:16,284-0400 ERROR [qtp139199987-18792] admin org.sonatype.nexus.extdirect.internal.ExtDirectServlet - Failed to invo ...

How can I retrieve the text from two DIV elements simultaneously using JS/jQuery?

Is there a way to loop through all <TD> elements in order to store the Title and Link from each element into separate variables using JavaScript / jQuery? Sample HTML: <td> <div class="class_Title row border-bottom" name="name_Title" i ...

Tips for retrieving data from Angular Material Table source

It's great to see everyone doing well! I'm facing an issue with rendering data to a material table, and I can't figure out why it's not working. When I try to assign the data to the table's datasource for rendering, the information ...

Highcharts integration with YQL finance data in JSON format

Currently, I am utilizing jQuery and highcharts.js to develop a single line chart on my website that displays historical financial data for any company specified by the user. I have been experimenting with YQL and employed this query to fetch some quotes i ...

Discovering repeated arrays within an array

Given a nested array, what is the best approach to finding duplicates efficiently? var array = [ [ 11.31866455078125, 44.53836644772605 ], [ // <-- Here's the duplicate 11.31866455078125, 44.53836644772605 ...