Semantic versioning is a convention used to provide meaning to versions
If there is one great thing in the Node.js package, it is that everyone agrees to use semantic versioning for its version numbering.
The concept of semantic version control is simple: all versions have 3 digits:x.y.z
.
- The first is the major version
- The second number is the minor version
- The third digit is the patch version
When a new version is released, not only can you increase the number as you want, but you can also follow the following rules:
- When you make incompatible API changes, you can upgrade to the major version
- When you add features in a backward compatible way, you can upgrade the minor version
- You can upgrade the patch version when making backward-compatible bug fixes
This convention is adopted in all programming languages, and one very important point is thatnpm
The software package insists on using it, because the entire system depends on it.
Why is it so important?
becausenpm
Set some rules that we can use in itpackage.json
fileChoose which version it can update our package to when we runnpm update
.
The rules use these symbols:
^
~
>
>=
<
<=
=
-
||
Let us understand these rules in detail:
^
: If you write^0.13.0
While runningnpm update
It can be updated to patches and minor versions:0.13.1
,0.14.0
and many more.~
: If you write~0.13.0
, While runningnpm update
It can be updated to the patch version:0.13.1
Yes, but0.14.0
It's not.>
: You accept any version higher than the version you specify>=
: You accept any version equal to or higher than the version you specify<=
: You accept any version that is equal to or lower than the version you specify<
: You accept any version lower than the specified version=
: You accept the exact version-
: You accept various versions. example:2.1.0 - 2.6.2
||
: You group the collections together. example:< 2.1 || > 2.6
You can combine some of these symbols, such as use1.0.0 || >=1.1.0 <1.2.0
Use 1.0.0 or a release version starting from 1.1.0 but lower than 1.2.0.
There are other rules:
- Unsigned: You only accept the specific version you specify (
1.2.1
) latest
: You want to use the latest version available
Download mine for freeNode.js manual
More node tutorials:
- Introduction to npm package manager
- Introduction to Node.js
- HTTP request using Axios
- Where to host Node.js applications
- Use Node.js to interact with Google Analytics API
- npx node package runner
- package.json guide
- Where does npm install packages?
- How to update Node.js
- How to use or execute packages installed with npm
- package-lock.json file
- Semantic version control using npm
- Should you submit the node_modules folder to Git?
- Update all Node dependencies to the latest version
- Use Node.js to parse JSON
- Find the installed version of the npm package
- Node.js flow
- Install an older version of the npm package
- Get the current folder in Node
- How to record objects in Node
- Use export to expose functions from Node files
- Difference between node and browser
- Use Node to make HTTP POST requests
- Use Node to get HTTP request body data
- Node buffer
- A brief history of Node.js
- How to install Node.js
- How much JavaScript do you need to know to use Node?
- How to use Node.js REPL
- Node, accepts parameters from the command line
- Use Node to output to the command line
- Accept input from the command line in Node
- Use `npm uninstall` to uninstall the npm package.
- npm global or local package
- npm dependencies and devDependencies
- Node.js event loop
- Understanding process.nextTick()
- Understanding setImmediate()
- Node event emitter
- Set up an HTTP server
- Use Node to make HTTP requests
- Node fs module
- HTTP request in Node using Axios
- Use Node to read files
- Node file path
- Write file with Node
- Node file statistics
- Use file descriptors in Node
- Use folders in Node
- Node path module
- Node http module
- Combine WebSockets with Node.js
- Basic knowledge of using MySQL and Node
- Error handling in Node.js
- Pug Guide
- How to read environment variables from Node.js
- How to exit from Node.js program
- Node os module
- Node event module
- Node, the difference between development and production
- How to check if a file exists in Node.js
- How to create an empty file in Node.js
- How to delete files using Node.js
- How to get the last update date of a file using Node.js
- How to determine whether the date is today in JavaScript
- How to write a JSON object to a file in Node.js
- Why use Node.js in the next project?
- Run web server from any folder
- How to use MongoDB with Node.js
- Use Chrome DevTools to debug Node.js applications
- What is pnpm?
- Node.js runtime v8 options list
- How to solve the "missing write access permission" error when using npm
- How to enable ES modules in Node.js
- How to use Node.js to generate child processes
- How to get the parsed body and the original body at the same time in Express
- How to handle file upload in Node.js
- What is the peer dependency in the node module?
- How to write a CSV file using Node.js
- How to use Node.js to read CSV files
- Node core module
- Use Node.js to increase the number of multiple folders at once
- How to print canvas to data URL
- How to create and save images using Node.js and Canvas
- How to download images using Node.js
- How to batch rename files in Node.js
- How to get the names of all files in a folder in Node
- How to use promise and wait function based on Node.js callback
- How to test NPM packages locally
- How to check the current Node.js version at runtime
- How to use Sequelize to interact with PostgreSQL
- Use Node.js to serve HTML pages
- How to solve the error that util.pump in Node.js is not a function