About
This article talks about package manager in Javascript.
They are the first component of the web toolchain as they permit to:
- declare package as dependency
- download and update package
- create a package of your code.
The Javascript ecosystem is based on the npm specification and relies on the package.json file as manifest to describe a package. Therefore every time, you see a package.json in a directory, this is the root directory of package
List
A non-exhaustive list of package manager
They have all their own implementation of node_modules directory that should contain all Javascript dependency
- flat vs hierarchical
- symlink
- …
Create a directory by package manager and add a dependency to see the difference
pnpm add express
npm add express
pnpm add express
Lock-file
Every package manager creates a shrinkwrap file that should be committed in your version repository.
How to define it for your project?
You can define it with the packageManager property in package.json