DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Day 78/100 Npm Vs Yarn
Rio Cantre
Rio Cantre

Posted on • Originally published at dev.to

Day 78/100 Npm Vs Yarn

Tackling the details more deeply towards topics often neglected the difference between their functions and primary purpose. Somehow, reviewing minor information would make it more understandable and easy to remember.

v2

Here are the difference between the usage of each commands :

  • Install dependencies from package.json:
npm installΒ ==Β yarn
Enter fullscreen mode Exit fullscreen mode
  • Install a package and add to package.json:
npm install package --saveΒ ==Β yarn add package
Enter fullscreen mode Exit fullscreen mode
  • Install a devDependency to package.json:
npm install package --save-devΒ ==Β yarn add package --dev
Enter fullscreen mode Exit fullscreen mode
  • Upgrade a package to its latest version:
npm update --saveΒ ==Β yarn upgrade
Enter fullscreen mode Exit fullscreen mode
  • Install a package globally: Β 
npm install package -gΒ ==Β yarn global add package
Enter fullscreen mode Exit fullscreen mode
  • Remove a dependency from package.json:
npm uninstall package --save == yarn remove package
Enter fullscreen mode Exit fullscreen mode

Extensions to consider

These are some extensions which I think would be helpful to make your coding more interactive.

Code snippet

npx cowsay hello

Ok to proceed? (y) y
 _______
< hello >
 -------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
Enter fullscreen mode Exit fullscreen mode

Stay in touch with me along with my coding journey. Don't hesitate to reach out and let's venture together!

Twitter

Medium

Dev.to

Top comments (0)

typescript

11 Tips That Make You a Better Typescript Programmer

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!