Showing posts with label NPM. Show all posts
Showing posts with label NPM. Show all posts

Thursday, May 21, 2020

npm package-lock.json

The package-lock.json is a new file introduces in npm v 5.*. The goal of introducing this new file is to resolve issue due to installing different versions of packages.

In the previous post we saw about the semantic versioning for npm and the various wild cards associated with this versioning. We saw that the package.json by default uses the carot (^) wildcard for package versioning, this allows for auto upgrade of the minor and patch versions.

Let us say we have the following entry in our package.json file for react
"react": "^16.8.3"

Wednesday, May 20, 2020

npm semantic versioning

NPM uses Semantic package versioning, which is a 3 part versioning like 7.5.5
<Major version>.<Minor version>.<Patch version>

Patch version – Patch versions will includes bug fixes
Minor version – Minor versions will include feature additions without breaking changes
Major version – Major version changes can include breaking changes

NPM

NPM is the package manager for Node.js, NPM is also used to install dependent packages for client side applications like React, Angular etc. NPM takes care of installing and maintaining the dependent packages for a project.

The command npm init is used to create a new project, this command will create a project.json file which will record all the dependent packages required for the project. If also records the commands to be executed when we build/run/test the Project.

The package.json file for our Hello World React application looks as follows.