You don't need --save anymore for NPM installs

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.
Search for a command to run...

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.
Thanks Ray! Glad you like it
Thanks Kingsley, glad you like the article! ✨
Most of you know me for my consistency, a golden arrow in my blog series. I've written 1000 articles in 1008 days! Almost an article a day, and my honeymoon was the only holiday I ever took. I'm super proud of this achievement; it has been a fantasti...

It's not the first time I'll be talking about community. I think it's an essential aspect of any successful tool. This shows in my previous explorations of Astro, Medusa, and now Vendure as well. All these products thrive in a super open, welcoming, ...

The cool part about Vendure is how easy it is to set up and how abstract each layer is. Basically, we get the following elements: External database Server Worker Admin UI Frontend While this is amazing, it also brings a bit of complexity when it co...

The previous article looked at customizing Vendure on a data and process level. In this article, we'll look at customizing emails, as they are often a big part of a webshop system. We'll be looking at two different layers of customization for customi...

Even though Vendure is a pretty significant project out of the box, in some cases, we might want to go in and modify some elements to work to our specific use case. In this article, I'll take a high-level look at some elements we can customize within...

If you ever installed an NPM package the following syntax looks very familiar to you:
npm install --save package_name
This was long the golden standard to install a package and save it as a dependency in your project.
Meaning if we didn't specify the --save flag, it would only get locally installed and not added to the package.json file.
Over time NPM evolved into a huge player in package management, and ever since version 5 of NPM, we no longer need to define this --save argument.
Meaning our packages will be saved by default into our package.json file.
I'm thrilled with this addition, as it's very rare to want to install a package that you don't need in your package.json file.
We also used to have the following command to install a package as a dev dependency.
npm install --save-dev package_name
This will place the package in your dev dependencies in the package.json file.
So to recap, the normal install will install our package under the dependencies, while the --save-dev argument will place them under devDependencies.
{
"name": "my_project",
"version": "0.0.1",
"dependencies": {
"package_name": "^1.0.0",
},
"devDependencies": {
"package_dev_name": "^1.0.0",
}
}
As we saw, the default install has no flags and will install our dependency. NPM, however gives us some flags to control the options.
-P, '--save-prod`: Package will install as a dependency-D, --save-dev: Package will be installed as dev dependency-O, --save-optional: Package will be installed as an optional dependency--no-save: Package won't be saved in package.json fileThese are the most important flags we can use. However, the only one you frequently use might be the -D flag.
Do keep in mind the letter flags are capital sensitive.
So to recap: we don't need to use the --save attribute anymore. This is now the default behavior.
We can provide the -D flag to save a package as a dev dependency.
Thank you for reading this article. I hope you learned something new today. And thank you, NPM for making this available.
Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter