Skip to main content

Command Palette

Search for a command to run...

Package Managers

A brief introduction

Published
9 min read
Package Managers
R

I am a Front End Engineer / Developer.

Package Managers

Sometimes…, Front End engineering seems more complicated but there is alot to explore besides ever changing technologies. Moreover, it is not dependent on any technology or platform as it is a methodology.

If one can imagine, besides traditional technologies, JavaScript has been in existence and evolving like a parallel world. It is everywhere and still unfolding day by day.

Nowadays, the words like packages, dependencies, modules, bundles are very popular in modern javascript. To understand these terms, we have to look at modules first. What are they about…!

Modules

Simply saying, a module is a discrete block of code that can be exported from one file and imported in another file. Every item in a module like variables, functions, objects etc can be exported individually. This approach gives more control over complex functionality. In other words, it is called modular programming .

A well defined module comprises of a properly encapsulated unified structure which can have a clear functionality written that supports the overall application or a part of it.

Those who are working with modern JavaScript technologies like React, Angular, Vue, NodeJS etc., use modules knowingly or unknowingly. As mentioned, modules can be exported with a built-in keyword in javascript called export .

They can be imported in 2 different ways:
ES5 standard

require(‘......’);

ES6 standard

import < ___ > from ‘ ./< ___ > ’ ;

Early days

Now, to have a clear idea of Package Managers, first we have to know why they are important in today’s world. When we go through the backstory of package managers, it seems that they are not new. During the early days of Linux and Unix, software downloading and installation was held using FTP or through some kind of data source. To get rid of this process further, Linux and Unix operating systems first introduced the practice of Centralised Systems like those we are using in these modern days, for example npm. That centralised system is completely based on GNU.

GNU means ‘GNU is not Unix’. It is a recursive acronym. It means, it refers to itself, where ‘G’ is silent. GNU consists of many tools and services used for different purposes with broad usage in the field of software. It holds different components of toolchains which are often used to develop applications and to write operating systems. And often GNU is referred to as “an Operating System that is free software “.

In fact, the Linux operating system is a combination of GNU software and Linux kernel. That’s why they call it GNU/Linux. Ofcourse, there are different flavours of Linux intended for varying purposes.

With the practice of centralised systems, tar files were used to pack the software setup files and to distribute them. In fact, the first versions of tar files are not compressed files or folders. They are just like a collection of files together. In other words, a tar file is an archive of files. Those files can be unarchived / untar to extract the necessary files. ‘Configure’ scripts can be initialised using GCC (GNU Compiler Collection) or with some variant of C compilers. Those scripts (./configure) will set up the software besides inspecting the application for dependencies. If any required dependencies are missing, the script would not allow the installation process to proceed further until those requirements are fulfilled.

dll Hell

On the other hand, once the process is done successfully it creates a file called ‘makefile’. This file can be accessed with the help of ‘make’ command which actually instals the software. ‘Make’ is a utility tool which maintains and manages various components of system programs. When the make command is used in the terminal, it reads instructions inside Makefile where different rules for dependency, macros etc., were defined. And it automates complex tasks like software builds, dependencies to execute in the shell etc.

This process results in creating binary files which is crucial in order to maintain hardware compatibility with the upcoming software requirements. But this whole process is annoying, troublesome and takes a lot of time to complete. Imagine how tedious it is to update an installed software in a system. In operating systems like Windows, this kind of complexity was termed as DLL (Dynamic Link Library) HELL.

Inception of Package Managers

This is where the Package Management System comes into play to overcome such complexities of early days software installation and development.

A Package consists of:

  • Compressed files

  • Precompiled binary files

  • Metadata ( like author’s name, description, version number, licence, vendor, cryptographic information etc )

  • List of dependencies (used to install the software without any hurdles)

By the way, a package is not responsible for maintaining those dependencies.

Package managers are widely accepted throughout the world consistently and have improved a lot. With the help of a package, it is easy to install, configure, update or remove software. Now such tasks have become as simple and fun as eating peanuts. This system of package managers eliminates manual installation processes and complexities like DLL HELL .

In Existence

Have a look at different package managers from various platforms:

Most of the following package managers are command-line utilities. Even though the purpose of their usage is the same, they differ in their features that are based on the platform they work with.

rpm-logo.png

RedHat Package Manager

  • It is intended for Linux distributions.
  • It has its own database of packages’ information.
  • It has file formats with .rpm extension.

Syntax:

rpm [option] [package_name]

Eg:

rpm -ivh thunderbird-78.6.1-1.el7.centos.x86_64.rpm
rpm -qa
rpm –help

yumpm-logo.png

Yellowdog Updater Modified

  • It works on Linux.
  • It is a front-end utility package manager that works on RPM.
  • It has its own database of packages’ information.

Syntax:

yum [options] [command] [package]

Eg:

yum -y install thunderbird
yum -y remove thunderbird
yum install dos2unix
yum search all
yum list all
yum help

npm-logo.png

Node Package Manager

It works on the NodeJS runtime environment. It is the world’s largest registry with over 1 million packages and 11 million developers worldwide.

Syntax:

npm [options] [command] [package]

Eg:

npm install create-react-app
npm install axios
npm i react-router-dom@6
npm audit fix
npm --version

yarn-logo.png

It is just a brand name.

The developer of YARN stated that he thought of its name as KPM (Kittens Package Manager).

  • But they named it so to create a unique brand.
  • It has Caching mechanism, Checksum of packages, Workspaces which aims at Monorepos.

NPM and YARN are widely used in NodeJS Environments

Syntax:

yarn [options] [command] [package]

Eg:

yarn add create-react-app
yarn add axios
yarn add react-router-dom@6
yarn auditgroups dependencies
yarn help
yarn version

pnpm-logo.jpg

pnpm

Performant Node Package Manager

  • It has monorepo support.
  • It creates hard links in the global space of the system with reference to every package in the node_modules folder of the project’s local space. Hard links are references of a file like pointers. They do not occupy extra space in the system’s memory unlike files and folders do.
  • In the case of Windows Operating System, pnpm uses junctions (soft links) to create a dependency tree of the packages.

Syntax:

pnpm [command] [option] [package]

Eg:

pnpm create react-app
pnpm link --global
pnpm link --global dependencies
pnpm exec jest

Both NPM and PNPM deal with Dependency Tree Structures.


homebrew-logo.png

HOMEBREW

macOS and Linux based package manager

  • First, It instals packages and it symlinks them to /usr/local directory on macOS.
  • Here, in cli formulae are used which are nothing but packages and scripts.

Syntax:

brew <command> [--verbose|-v] [options] [formula]

Eg:

brew install node
brew list
brew doctor
brew help
brew --version

chocolatey-logo.jpg

Windows based package manager

  • It works with powershell.
  • Here, packages encapsulate all necessary files into a single unit of artefact that is suitable for deployment.
  • Such a collection consists of installers, executable files, zipped / compressed files and scripts compiled into a package.
  • Compiled packages have an automatic virus scanning system to strictly block malicious and pirated software or attacks.

Syntax:

choco <command> [package] [options]

Eg:

choco install nodejs -y
choco install sysinternals
choco install ruby
choco uninstall ruby
choco help
choco -?

choco -? It is a general help command, same as choco -help.


pip-logo.jpg

PIP

Pip Installs Packages. It is an acronym.

  • It works in a Python environment. And it is independent of system interpreter.

Syntax:

pip <command> [package] [options]

Eg:

pip install Django
pip install flask-bootstrap
pip list
pip --version

gradle-logo.png

Gradle

Works on different platforms

  • It is used for build automation.
  • It is highly customizable and powerful with a rich ecosystem of APIs and plugins.

Syntax:

gradle [taskName...] [--option-name...]

Eg:

gradle test deploy
gradle dist --exclude-task test
gradle tasks --group="build setup"
gradle -q help –task libs
gradle --help

maven-logo.png

Apache Maven

  • It is used for Java Projects to deal with build automation processes.
  • It deals with project builds, reporting and documentation from its centralised ecosystem.

Syntax:

mvn [options]:<command> [options] [options]...

Eg:

mvn install
mvn package
mvn compiler:compile
mvn dependency:tree
mvn deploy
mvn clean
mvn verify
mvn archetype:generate
mvn --version

nuget-logo.jpg

Used to create .NET Apps

  • It distributes .NET libraries and these libraries are called packages.
  • It has more than 297,210 packages as of today.

Syntax:

nuget sources <operation> -Name <name> -Source <source>

Eg:

nuget install packages.config
nuget config -Set repositoryPath=c:\packages -configfile c:\my.config
nuget list
nuget -help

Debian-logo.png

APT

Advanced Packaging Tool

  • It is Ubuntu’s package management system.
  • Based on Debian GNU-Linux distribution.

Syntax:

apt <command> [package_name] [options]

Eg:

sudo apt install vim
sudo apt install /full/path/file.deb
sudo apt list
sudo apt --help

Steam-logo.jpg

Steam

Based on Debian distribution

  • It has official support from GNU/Linux.
  • It is widely used as an application launcher for Video Games and other creative tools / assets.

Syntax:

steam [-options]

Eg:

steam -console
steam -tenfoot
steam steam://open/console
steam -shutdown

winehq-logo.png

Wine

Wine is not an Emulator - it is an acronym

  • It runs on operating systems that support POSIX (Portable Operating System Interface)
  • It converts API calls into POSIX calls to run Windows Applications efficiently in the Desktop.

Syntax:

wine program [argument1] [argument2] ……

Eg:

wine winecfg
wine [ipconfig] [/all]
wine msiexec /i <filename>.msi
wine --help
wine --version

Package Managers have been gradually improved since their inception. Nowadays, they are used to automate different processes in the project pipeline.

This is a brief introduction about Package Managers

…keep an eye for the next article on Webpack.

V

Professional ease of writing which gives a high level of in-depth analysis and a well-structured presentation.

F

Good one.

  1. where is composer !?
  2. wine is not exactly a package manager , its a windows API library for the communication of windows apps and *nix like systems.