It's an experiment of monorepo using lerna for private packages when your organization can't afford $7/user/month with npm Private Packages
A: See this
A: Well, I find lerna useful but I can't afford to be a paid npm user for private packages so I'm trying to use git-hosted dependencies
A: Yep, I'm in GitHub Student Developer Pack. But Bitbucket & Gitlab work just fine
A: Yeah, kinda, self-hosted git instances. Because lerna depends on hosted-git-info, you won't be able to publish packages to your own self-hosted instance. See this comment. So, meh 😕
A: Deploy your own registry
A: I wrote a script mirror.sh to automate the process of splitting packages to their own repository using splitsh/lite. So processes should be like this:
- Split current packages
./mirror.sh
- Update dependencies
"dependencies": {
- "@hiendv/lerna-git-hosted-foo": "^2.0.0",
+ "@hiendv/lerna-git-hosted-foo": "git+ssh://git@github.com/hiendv/lerna-git-hosted-foo.git#semver:^2.0.0"
}
- Update
lerna.json
+ "useGitVersion": true,
+ "gitVersionPrefix": "v"
- Bootstrap lerna
lerna clean --yes && lerna bootstrap --hoist
These steps should be done successfully.
# Make some changes to the codebase
git add changed/files
git commit
# Bump the versions & publish
lerna publish
# Split
./mirror.sh
Versions should be updated correctly and mirrored repositories should contains new versions.
This repository is a monorepo with packages mirrored to hiendv/lerna-git-hosted-foo and hiendv/lerna-git-hosted-bar. If I make them private, you will never know them but it still works for me, that's the point of this. So, see for yourself, good luck!