1"use strict";(globalThis.webpackChunkdocs=globalThis.webpackChunkdocs||[]).push([[3387],{66860(e,r,n){n.r(r),n.d(r,{assets:()=>i,contentTitle:()=>c,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"project_structure/workspaces","title":"Workspaces","description":"Manage multiple related Noir packages in a single repository with a shared workspace, including members, default-member, and command scoping.","source":"@site/processed-docs/project_structure/workspaces.md","sourceDirName":"project_structure","slug":"/project_structure/workspaces","permalink":"/docs/dev/project_structure/workspaces","draft":false,"unlisted":false,"editUrl":"https://github.com/noir-lang/noir/edit/master/docs/docs/project_structure/workspaces.md","tags":[],"version":"current","frontMatter":{"title":"Workspaces","description":"Manage multiple related Noir packages in a single repository with a shared workspace, including members, default-member, and command scoping."},"sidebar":"sidebar","previous":{"title":"Modules","permalink":"/docs/dev/project_structure/modules"},"next":{"title":"Data Types","permalink":"/docs/dev/language/data_types/"}}');var t=n(74848),o=n(28453);const a={title:"Workspaces",description:"Manage multiple related Noir packages in a single repository with a shared workspace, including members, default-member, and command scoping."},c=void 0,i={},d=[];function l(e){const r={code:"code",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.p,{children:"Workspaces are a feature of nargo that allow you to manage multiple related Noir packages in a single repository. A workspace is essentially a group of related projects that share common build output directories and configurations."}),"\n",(0,t.jsxs)(r.p,{children:['Each Noir project (with its own Nargo.toml file) can be thought of as a package. Each package is expected to contain exactly one "named circuit", being the "name" defined in Nargo.toml with the program logic defined in ',(0,t.jsx)(r.code,{children:"./src/main.nr"}),"."]}),"\n",(0,t.jsx)(r.p,{children:"For a project with the following structure:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-tree",children:"\u251c\u2500\u2500 crates\n\u2502 \u251c\u2500\u2500 a\n\u2502 \u2502 \u251c\u2500\u2500 Nargo.toml\n\u2502 \u2502 \u2514\u2500\u2500 Prover.toml\n\u2502 \u2502 \u2514\u2500\u2500 src\n\u2502 \u2502 \u2514\u2500\u2500 main.nr\n\u2502 \u2514\u2500\u2500 b\n\u2502 \u251c\u2500\u2500 Nargo.toml\n\u2502 \u2514\u2500\u2500 Prover.toml\n\u2502 \u2514\u2500\u2500 src\n\u2502 \u2514\u2500\u2500 main.nr\n\u2502\n\u2514\u2500\u2500 Nargo.toml\n"})}),"\n",(0,t.jsx)(r.p,{children:"You can define a workspace in Nargo.toml like so:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-toml",children:'[workspace]\nmembers = ["crates/a", "crates/b"]\ndefault-member = "crates/a"\n'})}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"members"})," indicates which packages are included in the workspace. As such, all member packages of a workspace will be processed when the ",(0,t.jsx)(r.code,{children:"--workspace"})," flag is used with various commands or if a ",(0,t.jsx)(r.code,{children:"default-member"})," is not specified. The ",(0,t.jsx)(r.code,{children:"--package"})," option can be used to limit\nthe scope of some commands to a specific member of the workspace; otherwise these commands run on the package nearest on the path to the\ncurrent directory where ",(0,t.jsx)(r.code,{children:"nargo"})," was invoked."]}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.code,{children:"default-member"})," indicates which package various commands process by default."]}),"\n",(0,t.jsxs)(r.p,{children:["Libraries can be defined in a workspace. Inside a workspace, these are consumed as ",(0,t.jsx)(r.code,{children:'{ path = "../to_lib" }'})," dependencies in Nargo.toml."]}),"\n",(0,t.jsxs)(r.p,{children:["Please note that nesting regular packages is not supported: certain commands work on the workspace level and will use the topmost Nargo.toml file they can find on the path; unless this is a workspace configuration with ",(0,t.jsx)(r.code,{children:"members"}),", the command might run on some unintended package."]})]})}function p(e={}){const{wrapper:r}={...(0,o.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},28453(e,r,n){n.d(r,{R:()=>a,x:()=>c});var s=n(96540);const t={},o=s.createContext(t);function a(e){const r=s.useContext(o);return s.useMemo(function(){return"function"==typeof e?e(r):{...r,...e}},[r,e])}function c(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:a(e.components),s.createElement(o.Provider,{value:r},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.