DEV Community

Cover image for NPM Packages
CadenCGS
CadenCGS

Posted on

NPM Packages

Introduction

NPM Packages are a set of addons per say that can be added on to your JavaScript files. The serve the purpose of being able to manage, change, and execute different packages and files within your code. Beyond this NPM packages can work with source control to give you a better and more organized flow in your Git Repository. NPM Packages are most commonly used through the command line , whether its an OS CMD or an in-editor CMD.

Here are 3 NPM Packages I a going to recommend and show you today:

  • npm-gui
  • detect-installed
  • test-all-versions

Package 1: npm-gui

Alt Text

npm-gui is a useful tool for programmers that may be starting out with NPM Packages. This addon grants the user a graphical user interface, or gui, to manage and execute packages. For those who may struggle with the command line, this graphical interface creates an ease in the use of multiple packages in both management and organization.

The gui portion of this package can be accessed through a localhost address in your default browser. This can be activated through a command line prompt of ~/$ npm-gui localhost:9000. Once this is command is pushed through you just run that address into your browser and you're ready to go.

Package 2: detect-installed

Alt Text

detect-installed is another useful tool for programmers. This package checks multiple aspects of a newly installed package, such as whether it was installed globally locally, as well as it's path. This global or local checks will indicate to the programmer where that package can be accessed from, and the path check indicated how they can access it.

You can install detect-install by running $ npm install detect-installed --save through the console, and then in your package.json file you input this line: const detectInstalled = require('detect-installed').

Package 3: test-all-versions

Alt Text

test-all-versions is the final useful tool I will be talking about. This addons runs your code against all current versions of a given dependency. The usefulness in this is that maybe a dependency or package that you are using works with an earlier or later version of another dependency. This package looks for these incompatibility issues and lets the user become aware, so that they can be fixed.

The package is put into use by $ tav [options] [<module> <semver> <command> [args...]]. Once all these inputs are filled, the command will be ran. This is an example: tav mysql ^2.0.0 node test.js.

Sources

My Class Teacher: Matthew Larrubia
NPM General Information: https://en.wikipedia.org/wiki/Npm_(software)
npm-gui: https://www.npmjs.com/package/npm-gui
detect-installed: https://www.npmjs.com/package/detect-installed
text-all-versions: https://www.npmjs.com/package/test-all-versions

Top comments (0)