megarepo
v0.0.6
Published
Megarepo is a monorepo - but not really. It consists of a set of github repositories that have interdependencies, and the goal fo Megarepo is to make these repos sync nicely.
Downloads
4
Readme
Megarepo
Megarepo is a monorepo - but not really. It consists of a set of github repositories that have interdependencies, and the goal fo Megarepo is to make these repos sync nicely.
Motivation
npm link
isn't always working and you don't want to be linking everything manually all the time- Even if you link manually (which can be a lot of overhead with lots of packages) you will end up with problems in the deployed environment because installation is often cached and it will not install the latest version.
- monorepos are great, but not if you want to distribute things as small packages and repositories.
More info coming soon.
Convention
- There is no nestedness in the folder structure (for now)
- Root of the GitHub repo is also the npm package
- a Zelda-like CLI can link all packages to eachother with ease.
- Require the package-name, the repo-name and the folder-name to be all equal.
- Require the package-name to be available in NPM.
- Require the package-name to be descriptive, but a little flavor in branding is allowed.
- I can be flexible in which frontend-frameworks are used as long as it's react-based to keep all code available.
How to have monorepo-like behavior when not using a monorepo?
Run zelda in a package to link everything to everything.
How to take a monorepo package and make it a published and linked NPM package?
- change the name of the folder and
package.json#name
to something that can be published - use global replace to change
from "old"
intofrom "new"
- run
node /Users/king/Desktop/github/os/packages/typescript-swc/development/build/cli/buildEverythingInRightOrder.cli.js
to ensure this change is done. - Make repo:
git init
,git set remote
,git add/commit/push
- Publish on NPM:
npm publish
- Copy the folder to
github
folder (to prevent code breaking) - run
addDependency($1)
- run
zelda
in the package - remove the folder from original location (now that new location is linked)
The package should now be auto-linked to every package it's used, including all packages in the monorepo.
How to make a local CLI publicly available
- Ensure your executing CLI file has
#!/usr/bin/env node
on top - Add a
"bin": { "your-cli-command": "./path-to-cli.js" }
in yourpackage.json
- Run
chmod +x ./path-to-cli.js
- Run
npm link
Tips & tricks
How to list all linked packages:
npm ls --link --global
How to see which packages are symlinked in your node_modules:
ls -l node_modules | grep ^l
..or for a specific package:
ls -l node_modules | grep ^l | grep YOUR_PACKAGE