https://github.com/beenotung/slnpm
A simple and fast node.js package manager using symbolic link
https://github.com/beenotung/slnpm
dependencies dependency-manager efficient fast installer modules node-modules nodejs npm package-json package-manager symbolic-link symlinks
Last synced: 7 months ago
JSON representation
A simple and fast node.js package manager using symbolic link
- Host: GitHub
- URL: https://github.com/beenotung/slnpm
- Owner: beenotung
- License: bsd-2-clause
- Created: 2022-08-21T18:54:44.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-07-13T11:33:32.000Z (about 1 year ago)
- Last Synced: 2025-02-03T18:55:36.573Z (8 months ago)
- Topics: dependencies, dependency-manager, efficient, fast, installer, modules, node-modules, nodejs, npm, package-json, package-manager, symbolic-link, symlinks
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/slnpm
- Size: 69.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# slnpm
A simple and fast node.js package manager using symbolic link.
[](https://www.npmjs.com/package/slnpm)
The design is heavily inspired by pnpm, which downloads and caches each npm package, then setup hardlink of each file to the project's node_modules.
However, this package setup symbolic link (softlink) of each package's directory.## Installation
```bash
npm i -g slnpm
```## Feature
- save network - only need to download each package once
- save disk space - only need to store each package once
- save time - faster than npm and pnpm## Advantages over pnpm
1. This tool setup symbolic link instead of hardlink, this allows the cache to be used across different file-systems / partitions
2. This tool setup link per package (directory) instead of per file, which takes less time
## Functions
- [x] install packages
- [x] read package list from package.json
- [x] support dependencies
- [x] support devDependencies
- [x] support peerDependencies
- [x] add new packages to package.json
- [x] save to dependencies
- [x] save to devDependencies
- [x] support @types shortcuts with `:ts` and `:dts` format to auto install `@types/` to dependencies and devDependencies correspondingly
- [x] support multiple source type
- [x] npm package
- [x] `link:` package*
- [x] `file:` package**
- [x] support "bin" in packages.json (setup symbolic link in node_modules/.bin)
- [x] recursively install in every package / project
- [x] remove packages
- [x] remove extra packages not specified in package.json
- [x] remove specified packages from package.jsonRemarks:
`link:` package*: the dependencies are not further installed, slnpm assumes the linked package has already been built and installed it's own dependencies
`file:` package**: treated same as `link:` package in current version
## Benchmark
The benchmark is done using this package's dependencies as example.
node_modules and lock files are deleted before each run, and all packages were already cached by the installers.
The test was conducted on laptop with zst-compressed zfs and desktop with zst-compressed btrfs. The result is almost identical.
| Package Installer | Time used |
| ----------------- | --------- |
| **slnpm** | 0.1s |
| pnpm | 1.6s |
| npm | 2.1s |Remark:
- `--prefer-offline` flag is used in pnpm's test
- The time used is measured by the linux command `time`
- The time used is average of 5 runs
- slnpm actually only takes 39ms for the actual installation process but I cannot separate the time used to load dependencies from other installers so this matrix is not compared## License
This project is licensed with [BSD-2-Clause](./LICENSE)
This is free, libre, and open-source software. It comes down to four essential freedoms [[ref]](https://seirdy.one/2021/01/27/whatsapp-and-the-domestication-of-users.html#fnref:2):
- The freedom to run the program as you wish, for any purpose
- The freedom to study how the program works, and change it so it does your computing as you wish
- The freedom to redistribute copies so you can help others
- The freedom to distribute copies of your modified versions to others