mirror of
https://github.com/tiktok/sparo.git
synced 2024-11-30 10:56:54 -05:00
1 line
No EOL
5.8 KiB
JavaScript
1 line
No EOL
5.8 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[686],{1813:(e,s,o)=>{o.r(s),o.d(s,{assets:()=>c,contentTitle:()=>i,default:()=>h,frontMatter:()=>r,metadata:()=>l,toc:()=>a});var n=o(678),t=o(4738);const r={title:"Skeleton folders"},i=void 0,l={id:"pages/reference/skeleton_folders",title:"Skeleton folders",description:'By default sparo clones initializes a sparse checkout that does not include any Sparo profile selections, but does include folders containing essential config files such as package-lock.yaml and package.json. We call this starting point the checkout "skeleton" because it shows the full tree of all project folders in your monorepo, but without their source code subfolders. In other words, although the source files for each project are excluded, the skeleton nonetheless allows engineers to remain aware of other team\'s projects, and how their own project relates to those other projects. This discourages "tunnel vision" (where engineers pretend their project is the only project in the repository), while still ensuring fast Git performance.',source:"@site/docs/pages/reference/skeleton_folders.md",sourceDirName:"pages/reference",slug:"/pages/reference/skeleton_folders",permalink:"/sparo/pages/reference/skeleton_folders",draft:!1,unlisted:!1,editUrl:"https://github.com/tiktok/sparo/tree/main/apps/website/docs/pages/reference/skeleton_folders.md",tags:[],version:"current",frontMatter:{title:"Skeleton folders"},sidebar:"docsSidebar",previous:{title:"Git optimization",permalink:"/sparo/pages/reference/git_optimization"},next:{title:"Security",permalink:"/sparo/pages/reference/security"}},c={},a=[{value:"Skeleton spec",id:"skeleton-spec",level:2},{value:"Handling of nested projects",id:"handling-of-nested-projects",level:2}];function d(e){const s={code:"code",h2:"h2",li:"li",p:"p",strong:"strong",ul:"ul",...(0,t.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(s.p,{children:["By default ",(0,n.jsx)(s.code,{children:"sparo clones"})," initializes a sparse checkout that does not include any Sparo profile selections, but does include folders containing essential config files such as ",(0,n.jsx)(s.strong,{children:"package-lock.yaml"})," and ",(0,n.jsx)(s.strong,{children:"package.json"}),". We call this starting point the checkout ",(0,n.jsx)(s.strong,{children:'"skeleton"'}),' because it shows the full tree of all project folders in your monorepo, but without their source code subfolders. In other words, although the source files for each project are excluded, the skeleton nonetheless allows engineers to remain aware of other team\'s projects, and how their own project relates to those other projects. This discourages "tunnel vision" (where engineers pretend their project is the only project in the repository), while still ensuring fast Git performance.']}),"\n",(0,n.jsx)(s.p,{children:'Because Sparo enables the "cone mode" optimization for Git sparse checkout, the skeleton uses globs to match entire folders, not individual files.'}),"\n",(0,n.jsx)(s.h2,{id:"skeleton-spec",children:"Skeleton spec"}),"\n",(0,n.jsx)(s.p,{children:"The included folders are as follows:"}),"\n",(0,n.jsxs)(s.ul,{children:["\n",(0,n.jsxs)(s.li,{children:["The entire ",(0,n.jsx)(s.code,{children:"common/**"})," folder, which generally includes all the important config files and autoinstallers for Rush operations"]}),"\n",(0,n.jsxs)(s.li,{children:["For every project defined in ",(0,n.jsx)(s.strong,{children:"rush.json"}),", the top-level project folder contents. For example, ",(0,n.jsx)(s.strong,{children:"packages/my-app/package.json"})," and ",(0,n.jsx)(s.strong,{children:"packages/my-app/README.md"})," will be included, but not ",(0,n.jsx)(s.strong,{children:"packages/my-app/src/index.ts"}),"."]}),"\n",(0,n.jsxs)(s.li,{children:["The ",(0,n.jsx)(s.code,{children:"scripts/**"})," and ",(0,n.jsx)(s.code,{children:"plugins/**"})," top-level folders, because these names are commonly used for other essential projects."]}),"\n"]}),"\n",(0,n.jsxs)(s.p,{children:["When a Sparo profile is chosen (for example using ",(0,n.jsx)(s.code,{children:"sparo checkout --profile my-team"}),"), it will bring in all the source code subfolders under the selected workspace projects."]}),"\n",(0,n.jsx)(s.h2,{id:"handling-of-nested-projects",children:"Handling of nested projects"}),"\n",(0,n.jsx)(s.p,{children:"It is not a best practice for a workspace project to be nested under another workspace project. For example, this folder organization should be avoided:"}),"\n",(0,n.jsxs)(s.ul,{children:["\n",(0,n.jsx)(s.li,{children:(0,n.jsx)(s.strong,{children:"packages/x/package.json"})}),"\n",(0,n.jsx)(s.li,{children:(0,n.jsx)(s.strong,{children:"packages/x/src/index.ts"})}),"\n",(0,n.jsxs)(s.li,{children:[(0,n.jsx)(s.strong,{children:"packages/x/y/package.json"})," (project ",(0,n.jsx)(s.code,{children:"y"})," is nested inside project ",(0,n.jsx)(s.code,{children:"x"})," -- don't do this)"]}),"\n",(0,n.jsx)(s.li,{children:(0,n.jsx)(s.strong,{children:"packages/x/y/src/index.ts"})}),"\n"]}),"\n",(0,n.jsxs)(s.p,{children:["Sparo correctly supports this scenario, however. For example, if your profile selects ",(0,n.jsx)(s.code,{children:"x"})," but not ",(0,n.jsx)(s.code,{children:"y"}),", then the checkout will include ",(0,n.jsx)(s.strong,{children:"x/src/index.ts"})," but exclude ",(0,n.jsx)(s.strong,{children:"x/y/src/index.ts"}),"."]})]})}function h(e={}){const{wrapper:s}={...(0,t.R)(),...e.components};return s?(0,n.jsx)(s,{...e,children:(0,n.jsx)(d,{...e})}):d(e)}},4738:(e,s,o)=>{o.d(s,{R:()=>i,x:()=>l});var n=o(6166);const t={},r=n.createContext(t);function i(e){const s=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function l(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),n.createElement(r.Provider,{value:s},e.children)}}}]); |