Make your own NPM package and publish it.

Syed Rafi
Syed Rafi
Mar 8 · 3 min read

It’s ample for the intro just dive in…

Node_Modules

One of the heaviest objects of the universe is Node_Modules 🤣. To know heaviness of node_modules, just check any node_module folder present in your pc. To write your own npm package we should write whole node_modules from scratch. Just kidding…! npm will take care about the node modules we can concentrate only on building the npm package.

Just start crunching the code

To start any npm package we use

 npm init
# To create a directory   mkdir Desktop/hello_world# To change directory   cd Desktop/hello_world
npm init
# create an index.js file 
# in index.js console.log("hello_world_npm_package")
index.js and package.json

Publishing

Finally, we will publish an npm package with its command.

# to publish  npm publish

Updating (semantic versioning)

updating is a very important aspect of software development, The updating of npm package is known as semantic versioning. you can see “ version: (1.0.0)” while npm init, we should change the version while updating the npm package. each digit in the version has a unique name for unique change as major, minor and bug fixes (1.0.0). while updating change package version if not the package will not update. for the major change of package change first digit of version, for a minor change of package change the middle digit of version and for bug fixes change the last digit.

Semantic versioning.

FnPlus Community

FnPlus is a blended, peer learning platform driven by self-organizing communities. We are on a mission to bridge the skill-gap using Informal learning strategies like project-based learning which also promotes soft-skills such as collaboration, empathy, and innovation.

Syed Rafi

Written by

Syed Rafi

FnPlus Community

FnPlus is a blended, peer learning platform driven by self-organizing communities. We are on a mission to bridge the skill-gap using Informal learning strategies like project-based learning which also promotes soft-skills such as collaboration, empathy, and innovation.