Why Package Management?

·

2 min read

Package managers are mostly required when there are dependencies in a project, so we gotta focus on understanding dependencies.

Dependency in Projects

A dependency can be defined as a third-party bit of software generally written by someone else to solve issues in your project. There can be sub-dependencies in a dependency. The scale of dependency can vary from a small utility to a full-fledged javascript framework like React or Vue.

A web project might contain a lot of dependencies, as it helps the developers to build faster and more effectively. With many dependencies with sub-dependencies, there is a need for a modern tool that can bundle these dependencies and code together when deployed to the web. A bundle is a term that's generally used to refer to a single file on your web server that contains all the JavaScript for your software — typically compressed as much as possible to help reduce the time it takes to get your software downloaded and displayed in your visitors' browser.

To ensure that the dependencies are added and removed cleanly, the use of package managers like npm is necessary.

Package managers

A package manager can be simply defined as a system that manages project dependencies. It helps install new dependencies(packages), manage where they are stored in the file system, and assist in publishing your own package.

In case you aren't using package managers then you have to manually ensure the following in your web project.

  1. Finding all the correct package JavaScript files.

  2. Checking them to make sure they don't have any known vulnerabilities.

  3. Downloading them and putting them in the correct locations in your project.

  4. Writing the code to include the package(s) in your application (this tends to be done using JavaScript modules, another subject that is worth reading up on and understanding).

  5. Doing the same thing for all of the packages' sub-dependencies, of which there could be tens or hundreds.

  6. Removing all the files again if you want to remove the packages.

In conclusion, due to the advantages mentioned above learning about and using package managers in a web project is important.