tiktok-sparo/index.html

72 lines
23 KiB
HTML
Raw Normal View History

<!doctype html>
<html lang="en" dir="ltr" class="docs-wrapper plugin-docs plugin-id-default docs-version-current docs-doc-page docs-doc-id-index" data-has-hydrated="false">
<head>
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v3.1.1">
<title data-rh="true">Overview | Sparo</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:image" content="https://tiktok.github.io/sparo/images/site/sparo-ograph.png"><meta data-rh="true" name="twitter:image" content="https://tiktok.github.io/sparo/images/site/sparo-ograph.png"><meta data-rh="true" property="og:url" content="https://tiktok.github.io/sparo/"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="Overview | Sparo"><meta data-rh="true" name="description" content="Clone faster!"><meta data-rh="true" property="og:description" content="Clone faster!"><link data-rh="true" rel="icon" href="/sparo/images/site/sparo-favicon.ico"><link data-rh="true" rel="canonical" href="https://tiktok.github.io/sparo/"><link data-rh="true" rel="alternate" href="https://tiktok.github.io/sparo/" hreflang="en"><link data-rh="true" rel="alternate" href="https://tiktok.github.io/sparo/" hreflang="x-default"><script data-rh="true">function insertBanner(){var n=document.createElement("div");n.id="__docusaurus-base-url-issue-banner-container";n.innerHTML='\n<div id="__docusaurus-base-url-issue-banner" style="border: thick solid red; background-color: rgb(255, 230, 179); margin: 20px; padding: 20px; font-size: 20px;">\n <p style="font-weight: bold; font-size: 30px;">Your Docusaurus site did not load properly.</p>\n <p>A very common reason is a wrong site <a href="https://docusaurus.io/docs/docusaurus.config.js/#baseUrl" style="font-weight: bold;">baseUrl configuration</a>.</p>\n <p>Current configured baseUrl = <span style="font-weight: bold; color: red;">/sparo/</span> </p>\n <p>We suggest trying baseUrl = <span id="__docusaurus-base-url-issue-banner-suggestion-container" style="font-weight: bold; color: green;"></span></p>\n</div>\n',document.body.prepend(n);var e=document.getElementById("__docusaurus-base-url-issue-banner-suggestion-container"),s=window.location.pathname,o="/"===s.substr(-1)?s:s+"/";e.innerHTML=o}document.addEventListener("DOMContentLoaded",(function(){void 0===window.docusaurus&&insertBanner()}))</script><link rel="stylesheet" href="/sparo/assets/css/styles.74b7f001.css">
<script src="/sparo/assets/js/runtime~main.562c0414.js" defer="defer"></script>
<script src="/sparo/assets/js/main.851f6d75.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return localStorage.getItem("theme")}catch(t){}}();t(null!==e?e:"light")}(),function(){try{const c=new URLSearchParams(window.location.search).entries();for(var[t,e]of c)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}()</script><div id="__docusaurus"><div role="region" aria-label="Skip to main content"><a class="skipToContent_tNmY" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/sparo/"><div class="navbar__logo"><img src="/sparo/images/site/sparo-title.svg" alt="Sparo" class="themedComponent_xvkl themedComponent--light_ADcT"><img src="/sparo/images/site/sparo-title.svg" alt="Sparo" class="themedComponent_xvkl themedComponent--dark_lq1y"></div><b class="navbar__title text--truncate"></b></a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link"><svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" class="iconLanguage_mSWP"><path fill="currentColor" d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path></svg>English</a><ul class="dropdown__menu"><li><a href="/sparo/" target="_self" rel="noopener noreferrer" class="dropdown__link dropdown__link--active" lang="en">English</a></li></ul></div></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link" href="/sparo/pages/guide/getting_started">Docs</a><a href="https://github.com/tiktok/sparo" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_cXU3"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a class="navbar__item navbar__link" href="/sparo/pages/support/news">News</a><a class="navbar__item navbar__link" href="/sparo/pages/support/help">Help</a><div class="toggle_IHWH colorModeToggle_xI_x"><button class="clean-btn toggleButton_cHYg toggleButtonDisabled_lnMi" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_Z1_u"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1
<h2 class="anchor anchorWithStickyNavbar_C9Am" id="clone-faster">Clone faster!<a href="#clone-faster" class="hash-link" aria-label="Direct link to Clone faster!" title="Direct link to Clone faster!"></a></h2>
<p>Sparo optimizes performance of Git operations for your large frontend monorepo.</p>
<h2 class="anchor anchorWithStickyNavbar_C9Am" id="key-features">Key features<a href="#key-features" class="hash-link" aria-label="Direct link to Key features" title="Direct link to Key features"></a></h2>
<ul>
<li>
<p><strong>Familiar interface:</strong> The <code>sparo</code> command-line interface (CLI) wrapper offers <strong>better defaults</strong> and <strong>performance suggestions</strong> without altering the familiar <code>git</code> syntax. (The native <code>git</code> CLI is also supported.)</p>
</li>
<li>
<p><strong>A proven solution:</strong> Git provides <a href="/sparo/pages/reference/git_optimization">quite a lot of ingredients</a> for optimizing very large repos; Sparo is your recipe for combining these features intelligently.</p>
</li>
<li>
<p><strong>Simplified sparse checkout:</strong> Work with sparse checkout <a href="/sparo/pages/guide/sparo_profiles">profiles</a> instead of confusing &quot;cones&quot; and globs</p>
</li>
<li>
<p><strong>Frontend integration:</strong> Sparo leverages <a href="https://rushjs.io/" target="_blank" rel="noopener noreferrer">Rush</a> and <a href="https://pnpm.io/" target="_blank" rel="noopener noreferrer">PNPM</a> workspace configurations, including the ability to automatically checkout project dependencies</p>
</li>
<li>
<p><strong>Dual workflows:</strong> The <code>sparo-ci</code> tool implements a specialized checkout model optimized for continuous integration (CI) pipelines</p>
</li>
<li>
<p><strong>Extra safeguards</strong>: Avoid common Git mistakes such as checkouts with staged files outside the active view</p>
</li>
<li>
<p><strong>Go beyond Git hooks:</strong> Optionally collect anonymized Git timing metrics in your monorepo, enabling your build team to set data-driven goals for <em>local</em> developer experience (not just CI!)</p>
<p><em>(Metrics are transmitted to your own service and are not accessible by any other party.)</em></p>
</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_C9Am" id="quick-demo">Quick demo<a href="#quick-demo" class="hash-link" aria-label="Direct link to Quick demo" title="Direct link to Quick demo"></a></h2>
<p>Try out Sparo in 5 easy steps:</p>
<ol>
<li>
<p>Ensure you are using the latest Git version. For macOS, we recommend to use <a href="https://git-scm.com/download/mac" target="_blank" rel="noopener noreferrer">brew install git</a>. For other operating systems, see the <a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" target="_blank" rel="noopener noreferrer">Git documentation</a> for instructions.</p>
</li>
<li>
<p>Clone your <a href="https://rushjs.io/" target="_blank" rel="noopener noreferrer">RushJS</a> monorepo:</p>
<div class="language-shell codeBlockContainer_j2xv theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_gghP"><pre tabindex="0" class="prism-code language-shell codeBlock_XpmG thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_ppz4"><span class="token-line" style="color:#393A34"><span class="token plain">sparo clone https://github.com/my-company/my-monorepo.git</span><br></span></code></pre><div class="buttonGroup_F4wT"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_bJt5" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_f2Gd"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LF9L"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p>👉 <em>For a real world demo, try this repo:</em>
<a href="https://github.com/Azure/azure-sdk-for-js.git" target="_blank" rel="noopener noreferrer">https://github.com/Azure/azure-sdk-for-js.git</a></p>
<blockquote>
<p>💡 Support for PNPM and Yarn workspaces is planned but not implemented yet. Contributions welcome!</p>
</blockquote>
</li>
<li>
<p>Define a <a href="/sparo/pages/configs/profile_json">Sparo profile</a> describing the subset of repository folders for Git sparse checkout. Here is a basic example:</p>
<p><strong>common/sparo-profiles/my-team.json</strong></p>
<div class="language-json codeBlockContainer_j2xv theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_gghP"><pre tabindex="0" class="prism-code language-json codeBlock_XpmG thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_ppz4"><span class="token-line" style="color:#393A34"><span class="token plain">{</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> &quot;selections&quot;: [</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> &quot;selector&quot;: &quot;--to&quot;,</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> &quot;argument&quot;: &quot;my-rush-project&quot;</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> ]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">}</span><br></span></code></pre><div class="buttonGroup_F4wT"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_bJt5" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_f2Gd"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LF9L"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p>The <code>--to</code> <a href="https://rushjs.io/pages/developer/selecting_subsets/#--to" target="_blank" rel="noopener noreferrer">project selector</a> instructs Sparo to checkout all dependencies in the workspace that are required to build <code>my-rush-project</code>.</p>
<p>👉 <em>If you&#x27;re demoing <strong>azure-sdk-for-js</strong>, replace <code>my-rush-project</code> with <code>@azure/arm-commerce</code>.</em></p>
</li>
<li>
<p>Check out your Sparo profile:</p>
<div class="language-shell codeBlockContainer_j2xv theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_gghP"><pre tabindex="0" class="prism-code language-shell codeBlock_XpmG thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_ppz4"><span class="token-line" style="color:#393A34"><span class="token plain">sparo checkout --profile my-team</span><br></span></code></pre><div class="buttonGroup_F4wT"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_bJt5" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_f2Gd"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LF9L"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
</li>
<li>
<p>For everyday work, consider choosing <a href="/sparo/pages/commands/overview">mirrored subcommands</a> such as <code>sparo revert</code> instead of <code>git revert</code>. The Sparo wrapper provides (1) better defaults, (2) suggestions for better performance, and (3) optional anonymized performance metrics.</p>
<p>Examples:</p>
<div class="language-shell codeBlockContainer_j2xv theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_gghP"><pre tabindex="0" class="prism-code language-shell codeBlock_XpmG thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_ppz4"><span class="token-line" style="color:#393A34"><span class="token plain">sparo pull</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">sparo commit -m &quot;Example command&quot;</span><br></span></code></pre><div class="buttonGroup_F4wT"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_bJt5" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_f2Gd"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LF9L"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
</li>
</ol></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages"><a class="pagination-nav__link pagination-nav__link--next" href="/sparo/pages/guide/getting_started"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Getting Started</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_JG0V thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#clone-faster" class="table-of-contents__link toc-highlight">Clone faster!</a></li><li><a href="#key-features" class="table-of-contents__link toc-highlight">Key features</a></li><li><a href="#quick-demo" class="table-of-contents__link toc-highlight">Quick demo</a></li></ul></div></div></div></div></main></div></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">Copyright © 2024 TikTok Pte. Ltd.</div></div></div></footer></div>
</body>
</html>