β€’osamaβ€’ Profile picture
Dec 23 β€’ 11 tweets β€’ 3 min read
Thread of 7 npm commands Everyone should be aware of...
.
.
#developers #Webdesign #javascript30 Image
1. Create package.json

πŸŽ“ npm init

# Generate and answer yell to all
πŸŽ“ npm init --yes

# Short hand
πŸŽ“ npm init -y
2. Install Package

# install a package local to current folder
πŸŽ“npm i <packageName>

# install a package with specific version
πŸŽ“npm i <packageName>@<version>

# install a package globally
πŸŽ“npm i -g <packageName>
3. Update Package

# update all production packages in current folder
πŸŽ“ npm update

# update a specific package
πŸŽ“ npm i <packageName>

# update a package globally
πŸŽ“ npm update -g <packageName>
4. List Package

# list all packages in the current directory
πŸŽ“ npm list

# short hand
πŸŽ“ npm ls

# list packages installed globally
πŸŽ“ npm list -g

# list packages in dev dependencies
πŸŽ“ npm list --dev

# list packages in production
πŸŽ“ npm list --prod
5. Check Security Issues

# scan your project for security issues
πŸŽ“ npm audit

# get report in json format
πŸŽ“ npm audit --json

# scan issues and fix them
πŸŽ“npm audit fix

# if you want to skip dev dependencies
πŸŽ“ npm audit fix --only=prod
6. Remove Extraneous Packages

πŸŽ“ npm prune

When you run prune, the npm CLI will run through your package.json and compare it to your project's/node_modules directory. It will print a list of modules that aren't in your package.json.

Continue....
The npm prune command then strips out those packages, and removes any you haven't manually added to package.json or that were npm installed without using the --
7. Lock Dependency Versions
πŸŽ“ npm shrinkwrap

using shrinkwrap in your project, generates an npm-shrinkwrap.json file. This allows you to pin the dependencies of your project to the specific version you're currently using within your node_modules directory.

Continue...
When you run npm install and there is a npm-shrinkwrap.json present, it will override the listed dependencies and any semver ranges in package.json
Thread Ended.

Let me know if you found it usefull πŸ™

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with β€’osamaβ€’

β€’osamaβ€’ Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @iOsamaJavaid

Dec 25
ReactJS developer Roadmap 🧡 Image
1. Basic things to learn

πŸ“Œ Components
πŸ“Œ JSX
πŸ“Œ Props
πŸ“Œ States
πŸ“Œ Events
πŸ“Œ Conditional Rendering
2. Learn Important Hooks

πŸ“Œ useState
πŸ“Œ useEffect
πŸ“Œ useRef
πŸ“Œ useContext
πŸ“Œ useReducer
πŸ“Œ useMemo
πŸ“Œ useCallback
Read 10 tweets
Dec 24
reduce() Method in JavaScript

🌻 The reduce() method executes a reducer function on each element of the array.

🌻 It returns a single value as a result and doesn't execute the function for an empty array element. Image
🌻accumulator
It's a value of the previous function call, or the InitialValue for the first call.

If there is no any InitialValue provided then it's accumulate the first item of the array and item is initialized to the second value in the array.

Continue...
🌻 currentValue
It's a required parameter, that is the value of the current item of the array.

🌻 currentIndex
Optional, it is the current index of the array element that is being processed.

🌻 array
Optional, the array on which the reduce() method was called.

Continue...
Read 6 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(