sass file brower read korte pare na.so sass file k complile kore lage into css.in real world sass file k css comvert korte amader lage build tool.si jonno amra use kori gulp.amader install kora lage npm to run gulp
npm holo javascript er huge part of eco system
npm holo node package manager.npm a ace huge reposotory and mostly open sourse .anyone can those packge for freee.
but why we do need npm?
example :let say we need to build a car.car build korar jonno sobgo part jodi amra nijera create kore that will be expensive and hard.amra jodi car er part golo alada alada kore ani it will be easy for us.
same way npm prebuild code for us that other people already written.amara amader project code golo use korte pari.
author write the code and for their package and publish it on the npm registery .
tarpor tumi jodi ai package ta use korte chaw tomi install korte paro tomar computer a with npm cli or command line inteface .
akane alll kind of package ace small purpose kinba big project er jonnno pacakge pabe.
jokon nodejs install korbe tokon node.js abong npm run hobe same time a .
terminal a giye tomi node er version check korte parbe r npm er version check korte parbe
tumi ai package golo tomar project a use korte parbe.
tumi npm use korte hole tomake node.js install korte hobe tomar computer a .
node.js holo javascript runtime environment .
node.js install korar jonno nodejs website a install korte parben
jokon nodejs install korbe tokon node.js abong npm run hobe same time a .
terminal a giye tomi node er version check korte parbe r npm er version check korte parbe
tahole kon pacake golo tumi use korbe jekane over and thousand package ache ekane.kibabe janbe kon package ta tomar proyojon.actually it depen tumi ki doroner project create korcho.
for example :tumi jodi new vue.js project create korte chaw tahole you need tool like webpack or snowpack
example: amra amade sass file k css a compile korte use korbo gulp .so we need to install a bunch of gulp and sass related packages
kibabe npm package install korbe?
npm package install kora jai
- locally
- globally
installing locally mean that it will only be accessible from that specific project folder.if you have other project each will have it own set of local project..
to install localpackage youll use the npm cli in your terminal in npm install and name of the package you want for.
- for example: to install chalk package .type npm install chalk in your terminal *
enake most package installed globally on your computer.etar mane holo the package functions will be accessible from any directory.
usually you will only globally install packages that are meant to be run on your command line in any directory the gulp cli is one example of this as it will run gulp when you type gulp into your command line from any location to install a pacage globally type in .
npm install gulp
akon amra dekbo basic of installation :
jodi tumi multiple packages use kore thako tomar project a .tahole akta upaye tumi track korte parbe kon package ta tumi install korecho .ta holo package.json file.package.json file er maddome tumi track korte parbe tomar package k.
package.json file also store infomation about your project like name,version,author,and github repository .
- package.json * file super useful especially if other people want to clone your project and need all the specific package that you used they can use the package json file to install all of them all at once if they run
npm install
in a folder that the package json file to install all of them all at once if they run npm install in a folder that
package.json file super useful onno developerder jonno .
jodi developer clone korte chi tomar project
abon jesob package tumi use korecho ta proyojon hoi
ta tara use korte parbe jodi tara package json file install kore abong npm run kore
Jodi tara npm install run kore
in a folder jetate package json file ace.npm will read package json file and automatically install all the package listed
this come to deployment too as the server can install the packages right when you deploy
jokon tumo kono project developing korbe tokon prothomei tomi pakage.json file create korbe
tumi pakage.json file file npm er maddome create korte parbe by running npm init on your command line in your project
npm ask you some question like name and description and then create the json file
Tomi jodi manually answer dite na chaw tahole
tahole tomi likbe
npm init -y
eta immediately pacakge.json file create korbe and set kore dibe all the fieldd to a default value and tumi chile always chage the information in the future
Deal with dependency:
jokon tumi pakage.json file create korbe .er por theke tumi pakage install start korte parbe
what does installing a package actually do on your computer?
let say you have a brand new project abong tumar chalk package ta proyojon than type
npm install chalk
sate sate npm installing soro korbe chalk package k
jokon installtion kora ses hoye jabe tokon dekbe package.json file a chalk listed hobe as a dependency
etar mane holo tumi akon chalk package er function tomar code a use korte parbe
amra notice korbo node_modules has been created .ai node_modules a npm store all the file package file.er mane holo node_modules file a sob package file ace.
ai folder a er ekta file dekbe chalk file jeta make sense.but other file golo ki?
keno npm install chalk file er sate sate all the other file install korlo .this is because of dependecy nature of npm
tumi npm package install korcho in your project.to use other peoples code.tahole akon tomar project depent korche oi package er upor.abar oi package ta o use korteche onno kono package.amader node_modules folder a those folder are for package
chalk er package.json file a tumi dekte parbe dependency file .chalk ekane 2 ta dependency file/package niche
- ansi-style
- supports-color
than tumi jodi ansi-style file a jaw tomi dekba pakage.json file .package.json file a tomi also dekba depencny file color-conver
akon jodi color convert a jaw tokon dekba another package.json file.
supports color package a dependency pakage holo has-flag file
so package.json file also store infomation about your project like name,version,author,and github repository .
npm list dile tumi quickly package golo ki ki ache ta dekte parbe
pakage versioning
how does versioning and updating work in npm?
jodi amra amader terminal a type kori
npm view chalk versions
it will return a list of all the versions of chalk from the begining
Top comments (0)