Issue #43 (package.json Features)02/15/23
JavaScript & DOM E-Books Bundle
Looking for easy-to-digest and practical JavaScript coding tips for modern development? This e-book bundle includes 4 volumes covering 250+ quick tips with more than 300 live demos and lots of example code snippets.
|
|
|
Here are a couple of
quick tips on using package.json files. I'm sure many of you use package.json files in some way and often they "just work" without needing to do a whole lot with them.
If you're somewhat unfamiliar with the different parts of a package.json file, VS Code allows you to display a tooltip for most of the properties (or keys) that appear in the file. Below is an example where I'm hovering my mouse over the "devDependencies" key in a package.json file.
Here's another example, this time showing info for the "scripts" key:
You can also do the same for packages listed as values in package.json. When you hover over any package name, you'll notice some small "Loading..." text appear. After a few moments, you'll get some info in a tooltip on the package:
This can be useful if you're using a package with lots of dependencies, allowing you to get a brief overview of what each one does.
And one last thing I'll mention is
the useful "npm Scripts" explorer that's available in VS Code's sidebar. This feature was previously enabled via your VS Code settings, but now it's fully integrated into the "Views and More Actions..." menu found at the top right area of your sidebar:
Once enabled, the "npm Scripts" explorer will display a list view of all the packages and dependencies in your package.json file, with options to run and debug any of the packages or modules shown.