https://github.com/lightsofapollo/npm_monolithic
Example of monolithic project with multiple packages in a single repository
https://github.com/lightsofapollo/npm_monolithic
Last synced: 8 months ago
JSON representation
Example of monolithic project with multiple packages in a single repository
- Host: GitHub
- URL: https://github.com/lightsofapollo/npm_monolithic
- Owner: lightsofapollo
- Created: 2014-11-09T20:59:45.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-11-09T23:15:37.000Z (over 11 years ago)
- Last Synced: 2024-12-27T15:12:42.654Z (over 1 year ago)
- Language: Shell
- Size: 141 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# npm_monolithic
Example of monolithic project with multiple packages in a single repository.
## How it works
This works via a small set of hacks and npm configuration tricks:
- set the "prefix" for local package installs to this project.
- the `link` configuration in npm must be true this will symlink packages
from the globally (global is now in the folder so this works)
installed packages.
- currently running npm install from the root package does not seem to
use linking functionality (this could be a bug?) so we have a
linkify.sh preinstall hook which runs npm install / link manually in
each sub project to ensure dependencies are installed and linked.
- in the "root" (never to be published) package use file: dependencies
so npm / node commands work as usual.
## How to cache it?
Running a local registry is not a terrible option but is not the only
option for simple cases you can hash the contents of package.json and
store the node_modules folder as a tar.gz somewhere. This project
breaks those basic assumptions but this still can work via:
- read package.json
- hash each package.json in the sub packages
- hash looks like:
- md5 package.json
- md5 sub1/package.json
- md5 sub2/package.json
- upload globally installed packages (the sum of all sub dependencies)
When downloading the cache running |npm install| again will work by
setting up the symlinks in the sub projects again.