Tuesday, July 9, 2019

Yarn command || npm command

#1. type -g for global installation or --save/--save-dev to install the package as a dependency/development dependency

#2. npm install
    yarn install

#3. To install a package
     type one of the following commands:


#4 global installation
npm install --global <package_name>
or
yarn global add <package_name>
for global installation.


#5 add  installation
npm install --save <package_name>,
npm install --save-dev <package_name>,
npm install -D <package_name>,
npm i -D <package_name>,

or
 yarn add <package_name> --dev
to install the package as a project dependency or a development dependency.



#6 remove dependency or a development dependency.
npm uninstall <package_name>
or
npm uninstall --global <package_name>
yarn remove  <package_name>
or
yarn remove global  <package_name>



....................................................................................................................................................................................................................
Adding a Development Dependency to a Project
With NPM -  npm install --save-dev mocha
Shorthand version - npm i -D mocha

With Yarn - yarn add --dev mocha
Shorthand version yarn add -D mocha

....................................................................................................................................................................................................................
Adding a Production Dependency to a Project
 With NPM - npm install --save express
Shorthand version - npm i -P express

With Yarn - yarn add express

....................................................................................................................................................................................................................
Installing a Package Globally
With NPM - npm install --global json
 Shorthand version - npm i -g json

 With Yarn - yarn global add json

....................................................................................................................................................................................................................

Removing a Dependency From a Project
With NPM -  npm uninstall jest
Shorthand version - npm r jest

With Yarn -  yarn remove jest


....................................................................................................................................................................................................................
Uninstalling a Package Globally
Removing a globally installed package is the same as removing one from a project,
 but we need to pass in the global argument as we did when installing it:

With NPM - npm uninstall --global json
Shorthand version -  npm r -g json

With Yarn - yarn global remove json

.........................................................................................................................................................................................................................


Yarn Package Manager - Learn How to use Yarn

check the version
yarn --version

How to create package.json
yarn init

Global installations
yarn global add packagename

How to add package
yarn add packagename

How to remove packagename
yarn remove packagename

development Dependencies
yarn add packagename --dev

upgrade
yarn upgrade packagename

manually update
yarn self-update

clean junk
yarn clean
or
yarn clean cache



Informations of package name
yarn info packagename

check the path
yarn bin

details
yarn why package

.........................................................................................................................................................................................................................
npm --version

which directory

npm which

install package

npm install packageName

uninstall
npm uninstall packageName

check package
npm outdated

npm cache clean --force



























No comments:

Post a Comment