All Projects → wmfs → lerna-sync

wmfs / lerna-sync

Licence: MIT license
A package to synchronize distributed GitHub repos inside a Lerna monorepo.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to lerna-sync

Flow Mono Cli
A command line interface that aims to solve a few issues while working with flow typed codebases in a mono-repo.
Stars: ✭ 84 (+460%)
Mutual labels:  lerna, monorepo
Vue Monorepo Boilerplate
Vue Fullstack App Monorepo Boilerplate
Stars: ✭ 136 (+806.67%)
Mutual labels:  lerna, monorepo
Sketchmine
Tools to validate, generate and analyse sketch files from web pages
Stars: ✭ 114 (+660%)
Mutual labels:  lerna, monorepo
Pectin
Rollup-related tools for incremental transpilation of packages in Lerna-based monorepos
Stars: ✭ 50 (+233.33%)
Mutual labels:  lerna, monorepo
Melos
🌋 A tool for managing Dart projects with multiple packages (sometimes called monorepos). With IntelliJ and Vscode IDE support. Supports automated versioning, changelogs & publishing via Conventional Commits.
Stars: ✭ 155 (+933.33%)
Mutual labels:  lerna, monorepo
Eslint Plugin Monorepo
ESLint Plugin for monorepos
Stars: ✭ 56 (+273.33%)
Mutual labels:  lerna, monorepo
Puppeteer Extra
💯 Teach puppeteer new tricks through plugins.
Stars: ✭ 3,397 (+22546.67%)
Mutual labels:  lerna, monorepo
Lerna Changelog
📖 PR-based changelog generator with monorepo support
Stars: ✭ 611 (+3973.33%)
Mutual labels:  lerna, monorepo
monorepo-utils
A collection of utilities for monorepo/lerna. Tools for TypeScript project references etc..
Stars: ✭ 143 (+853.33%)
Mutual labels:  lerna, monorepo
Daily Apps
Everything you see on Daily 👀
Stars: ✭ 141 (+840%)
Mutual labels:  lerna, monorepo
Angular6 Monorepo Experiment
A monorepo experiment using Angular-CLI and Lerna
Stars: ✭ 15 (+0%)
Mutual labels:  lerna, monorepo
Bolt
The Bolt Design System provides robust Twig and Web Component-powered UI components, reusable visual styles, and powerful tooling to help developers, designers, and content authors build, maintain, and scale best of class digital experiences.
Stars: ✭ 186 (+1140%)
Mutual labels:  lerna, monorepo
Lerna Yarn Workspaces Example
How to build TypeScript mono-repo project with yarn and lerna
Stars: ✭ 787 (+5146.67%)
Mutual labels:  lerna, monorepo
Vitamin Web
Decathlon Design System libraries for web applications
Stars: ✭ 70 (+366.67%)
Mutual labels:  lerna, monorepo
Lerna
Splitting up large codebases into separate independently versioned packages is extremely useful for code sharing. However, making changes across many repositories is messy and difficult to track, and testing across repositories becomes complicated very quickly.
Stars: ✭ 31,079 (+207093.33%)
Mutual labels:  lerna, monorepo
Modern Monorepo Boilerplate
Modern Monorepo Boilerplate with Lerna, TypeScript, React/CRA, HMR, Jest, ESLint/TypeScript.
Stars: ✭ 127 (+746.67%)
Mutual labels:  lerna, monorepo
Ts Monorepo
Template for setting up a TypeScript monorepo
Stars: ✭ 459 (+2960%)
Mutual labels:  lerna, monorepo
Ultra Runner
🏃⛰ Ultra fast monorepo script runner and build tool
Stars: ✭ 496 (+3206.67%)
Mutual labels:  lerna, monorepo
Yerna
A Lerna-like tool for managing Javascript monorepos using Yarn
Stars: ✭ 140 (+833.33%)
Mutual labels:  lerna, monorepo
Monorepo Run
Run scripts in monorepo with colors, streaming and separated panes
Stars: ✭ 167 (+1013.33%)
Mutual labels:  lerna, monorepo

lerna-sync

CircleCI

A package to synchronize distributed GitHub repos inside a Lerna monorepo.

Use Case

If the following sounds familiar, then lerna-sync may be of interest:

  • You're building lots of Node.js packages.
  • You're using a Lerna monorepo to help manage all your packages.
  • You really need Lerna's ability to link together all your package dependencies.
  • But you're also missing all the things that distinct GitHub repos gave you:
    • Mixing private/public repos
    • A place for focused issues
    • Dedicated wikis
    • Simple commit histories
    • Custom build-shenanigans
    • Etc.

This is the situation lerna-sync is designed to help with. 😃

Install Lerna

You'll need to have Node.js installed and Lerna available globally:

npm install lerna -g

The monorepo husk

Create an empty husk of a Lerna Monorepo (our tymly repo is an example).

Some things:

  • Note that the directories you'd ordinarily expect Lerna packages to be living inside, are empty.
  • The lerna.json file is pretty basic stuff.

This is the the empty husk of your monorepo, it should be committed and pretty much forgotten about after this point.

GitHub Credentials

Lerna-sync will take-on the work to clone/pull your separate GitHub repos and keep them in-sync within your monorepo.

You'll need to provide some GitHub credentials to hand, namely:

  • Your GitHub username.
  • A GitHub Access Token associated with the provided username. Giving your token a description of "Lerna Sync Access" will be fine. This is necessary to avoid certain rate-limits and access private repos. Remember to keep tokens private and treat them as if they were passwords.
  • A name of a GitHub organization that your Lerna packages will be synchronized with (for example wmfs).

Routing function

You may have many GitHub repos in the organization you specify that shouldn't come anywhere near your monorepo. Also, you might like to take advantage of Lerna's support for multiple-package directories to help structure things a bit better.

In lerna-sync this filtering/routing can be achieved via a simple Javascript function. Here's an example:

// Here we use look at the keywords array in the repo's package.json
// to decide which monorepo package directory (if any) it should belong.

function (gitHubPackageObj) {
  // [string-in-keywords, monorepo-directory-name]
  const keywordToPackageMap = [
    ['package', 'packages'],
    ['plugin', 'plugins'],
    ['blueprint', 'blueprints'],
    ['cardscript', 'cardscript'],
    ['app', 'apps']
  ]
  if (gitHubPackageObj.hasOwnProperty('keywords') && gitHubPackageObj.keywords.indexOf('tymly') !== -1) {
    let lernaPackageName = null
    const keywords = gitHubPackageObj.keywords
    keywordToPackageMap.forEach(
      tuple => {
        if (keywords.indexOf(tuple[0]) !== -1) {
          lernaPackageName = tuple[1]
        }
      }
    )
    return lernaPackageName
  }
}

Lerna-sync will call this function with the package.json content (already parsed as a JavaScript object) of each repo in the source GitHub organization.

  • Any repos with no package.json will be skipped entirely due to not being a suitable candidate for a Lerna Monorepo.

The function should return the name of a directory registered in the packages array in the monorepo's lerna.json file.

  • If no value is returned by this function, then lerna-sync will know not to route the repo to any package directory (i.e. it's filtered out).

WIP

Environment variables

Variable Notes
LERNA_SYNC_MONOREPO_PATH Should be set to a directory where a lerna.json can be found.
LERNA_SYNC_GITHUB_TOKEN Generate a new GitHub token here, a description of "lerna-sync connection" will do.
LERNA_SYNC_GITHUB_ORG Name of the GitHub organization holding all your repos.
LERNA_SYNC_GITHUB_USER Your GitHub username (used in conjunction with LERNA_SYNC_GITHUB_TOKEN to fetch/pull repos.

Installation

npm install @wmfs/lerna-sync --save

Usage

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].