Skip to content
forked from Olivr/nx-copybara

Example of using Copybara to open-source a library from a nx monorepo

Notifications You must be signed in to change notification settings

rgoj/nx-copybara

 
 

Repository files navigation

Open source NX sub-project as a new repo with Copybara and Github Actions

This repo is an example Nx monorepo to demonstrate how to use Copybara Action to open-source a part of the monorepo. Pull-Requests in the destination repo will be synced back to your main repo.

 Source of Truth                  Destination

+---------------+   Copybara   +---------------+
|     Branch    +------------> |     Branch    |
+-------+-------+              +---------------+
        ^
        |
        |
+-------+-------+   Copybara   +---------------+
| Pull Requests | <------------+ Pull Requests |
+---------------+              +---------------+

How it works

  1. Apps and libs are tagged properly
  2. Running node tools/externals/prepare.js todos will update externals/todos. (The output of this tool must be kept up to date and committed, you could set-up a pre-commit hook)
  3. The Github workflow .github/workflows/move-code.yml will then take care of the rest.

Try it!

  1. Fork this repo
  2. Create another empty repo to use as the destination
  3. Configure the secrets
  4. Run node tools/externals/prepare.js blog on your fork, you will see the new folder externals/blog
  5. Change .github/workflows/move-code.yml accordingly (basically search/replace todos by blog) and adjust the sot/destination repo values.

Use in your own repo

The two important bits that you need to copy in your own repo are prepare.js and the Github workflow. Check out Copybara Action for more customization.

Edit to push...

About

Example of using Copybara to open-source a library from a nx monorepo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 46.7%
  • CSS 29.8%
  • JavaScript 19.2%
  • HTML 4.3%