Rails npm packages will use an uncommon versioning scheme

Posted . Visible to the public. Repeats.

When Rails releases a new version of their gems, they also release a number of npm packages
like @rails/activestorage or @rails/actioncable.

Unfortunately Rails uses up to 4 digits for their gem version, while npm only allows 3 digits and a pre-release suffix.

To map gem versions and npm versions, Rails is going to use a naming scheme like this:

Gem version npm version
7.0.0 7.0.0
7.0.1 7.0.100
7.1.0 7.1.0
7.0.0.1 7.0.1 (think 7.0.001)
7.0.1.1 7.0.101
7.0.0.rc1 7.0.0-rc1

The old scheme

Earlier Rails used the following scheme, which didn't work well with version ranges in your package.json:

Gem version npm version
6.0.0 6.0.0
6.0.1 6.0.1
6.1.0 6.1.0
6.0.0.1 6.0.0-1
6.0.1.1 6.0.1-1
6.0.0.rc1 6.0.0-rc1
Henning Koch
Last edit
Dominik Schöler
Keywords
@rails/ujs
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2024-08-22 11:09)