tiktok-sparo/apps/website/docs/index.md
2024-02-21 23:40:31 -08:00

3.8 KiB

title hide_title custom_edit_url
Overview true null
Sparo

Clone faster!

Sparo optimizes performance of Git operations for your large frontend monorepo.

Key features

  • Familiar interface: The sparo command-line interface (CLI) wrapper offers better defaults and performance suggestions without altering the familiar git syntax. (The native git CLI is also supported.)

  • A proven solution: Git provides quite a lot of ingredients for optimizing very large repos; Sparo is your recipe for combining these features intelligently.

  • Simplified sparse checkout: Work with sparse checkout profiles instead of confusing "cones" and globs

  • Frontend integration: Sparo leverages Rush and PNPM workspace configurations, including the ability to automatically checkout project dependencies

  • Dual workflows: The sparo-ci tool implements a specialized checkout model optimized for continuous integration (CI) pipelines

  • Extra safeguards: Avoid common Git mistakes such as checkouts with staged files outside the active view

  • Go beyond Git hooks: Optionally collect anonymized Git timing metrics in your monorepo, enabling your build team to set data-driven goals for local developer experience (not just CI!)

    (Metrics are transmitted to your own service and are not accessible by any other party.)

Quick demo

Try out Sparo in 5 easy steps:

  1. Ensure you are using the latest Git version. For macOS, we recommend to use brew install git. For other operating systems, see the Git documentation for instructions.

  2. Clone your RushJS monorepo:

    sparo clone https://github.com/my-company/my-monorepo.git
    

    👉 For a real world demo, try this repo: https://github.com/Azure/azure-sdk-for-js.git

    💡 Support for PNPM and Yarn workspaces is planned but not implemented yet. Contributions welcome!

  3. Define a Sparo profile describing the subset of repository folders for Git sparse checkout. Here is a basic example:

    common/sparo-profiles/my-team.json

    {
      "selections": [
         {
           "selector": "--to",
           "argument": "my-rush-project"
         }
      ]
    }
    

    The --to project selector instructs Sparo to checkout all dependencies in the workspace that are required to build my-rush-project.

    👉 If you're demoing azure-sdk-for-js, replace my-rush-project with @azure/arm-commerce.

  4. Check out your Sparo profile:

    sparo checkout --profile my-team
    
  5. For everyday work, consider choosing mirrored subcommands such as sparo revert instead of git revert. The Sparo wrapper provides (1) better defaults, (2) suggestions for better performance, and (3) optional anonymized performance metrics.

    Examples:

    sparo pull
    
    sparo commit -m "Example command"