Skip to content

hiendv/lerna-git-hosted

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WTF IS THIS?

It's an experiment of monorepo using lerna for private packages when your organization can't afford $7/user/month with npm Private Packages

Q: Monorepo? Lerna?

A: See this

Q: So what are you trying to do?

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

Q: But you need to be a paid GitHub user to host these packages privately?

A: Yep, I'm in GitHub Student Developer Pack. But Bitbucket & Gitlab work just fine

Q: Any problems?

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 😕

Q: So what should I do in that case?

A: Deploy your own registry

Q: Alright, how to use this thing?

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:

Setup

  1. Split current packages
./mirror.sh
  1. 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"
 }
  1. Update lerna.json
+  "useGitVersion": true,
+  "gitVersionPrefix": "v"
  1. Bootstrap lerna
lerna clean --yes && lerna bootstrap --hoist

These steps should be done successfully.

Workflow

# 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!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published