diff --git a/404.html b/404.html index 96db850..6985c11 100644 --- a/404.html +++ b/404.html @@ -7,7 +7,7 @@ - +
diff --git a/assets/js/2e9a6f4f.09b34996.js b/assets/js/2e9a6f4f.09b34996.js new file mode 100644 index 0000000..e4db386 --- /dev/null +++ b/assets/js/2e9a6f4f.09b34996.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[388],{5012:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>t,contentTitle:()=>o,default:()=>d,frontMatter:()=>c,metadata:()=>l,toc:()=>p});var i=s(7624),r=s(2172);const c={},o="Using pnpm with Lerna",l={id:"recipes/using-pnpm-with-lerna",title:"Using pnpm with Lerna",description:"Lerna can be used in a pnpm workspace to get the full benefits of both pnpm and Lerna.",source:"@site/docs/recipes/using-pnpm-with-lerna.md",sourceDirName:"recipes",slug:"/recipes/using-pnpm-with-lerna",permalink:"/docs/recipes/using-pnpm-with-lerna",draft:!1,unlisted:!1,editUrl:"https://github.com/lerna/lerna/tree/main/website/docs/recipes/using-pnpm-with-lerna.md",tags:[],version:"current",frontMatter:{},sidebar:"main",previous:{title:"Configuring Published Files",permalink:"/docs/concepts/configuring-published-files"},next:{title:"Commands",permalink:"/docs/api-reference/commands"}},t={},p=[{value:"Getting Started",id:"getting-started",level:2}];function a(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",li:"li",ol:"ol",p:"p",pre:"pre",ul:"ul",...(0,r.M)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h1,{id:"using-pnpm-with-lerna",children:"Using pnpm with Lerna"}),"\n",(0,i.jsxs)(n.p,{children:["Lerna can be used in a ",(0,i.jsxs)(n.a,{href:"https://pnpm.io/workspaces",children:[(0,i.jsx)(n.code,{children:"pnpm"})," workspace"]})," to get the full benefits of both ",(0,i.jsx)(n.a,{href:"https://pnpm.io",children:(0,i.jsx)(n.code,{children:"pnpm"})})," and Lerna."]}),"\n",(0,i.jsxs)(n.p,{children:["When used in a ",(0,i.jsx)(n.code,{children:"pnpm"})," workspace, Lerna will:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["resolve package locations with ",(0,i.jsx)(n.code,{children:"pnpm-workspace.yaml"})," (",(0,i.jsx)(n.a,{href:"https://pnpm.io/workspaces",children:"https://pnpm.io/workspaces"}),")"]}),"\n",(0,i.jsxs)(n.li,{children:["ignore ",(0,i.jsx)(n.code,{children:'"workspaces"'})," in ",(0,i.jsx)(n.code,{children:"package.json"})]}),"\n",(0,i.jsxs)(n.li,{children:["block usage of ",(0,i.jsx)(n.code,{children:"bootstrap"}),", ",(0,i.jsx)(n.code,{children:"link"}),", and ",(0,i.jsx)(n.code,{children:"add"})," commands. Instead, you should use ",(0,i.jsx)(n.code,{children:"pnpm"})," commands directly to manage dependencies (",(0,i.jsx)(n.a,{href:"https://pnpm.io/cli/install",children:"https://pnpm.io/cli/install"}),")."]}),"\n",(0,i.jsxs)(n.li,{children:["respect the ",(0,i.jsx)(n.a,{href:"https://pnpm.io/workspaces#workspace-protocol-workspace",children:"workspace protocol"})," for package dependencies.","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["During ",(0,i.jsx)(n.code,{children:"lerna version"}),", dependencies will be updated as normal, but will preserve the ",(0,i.jsx)(n.code,{children:"workspace:"})," prefix if it exists."]}),"\n",(0,i.jsxs)(n.li,{children:["If a ",(0,i.jsx)(n.a,{href:"https://pnpm.io/workspaces#referencing-workspace-packages-through-aliases",children:"workspace alias"})," is used, then ",(0,i.jsx)(n.code,{children:"lerna version"})," will not bump the version of the dependency, since aliases don't specify a version number to bump."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"getting-started",children:"Getting Started"}),"\n",(0,i.jsx)(n.p,{children:"To set up pnpm with Lerna:"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["If not installed already, install ",(0,i.jsx)(n.code,{children:"pnpm"}),": ",(0,i.jsx)(n.a,{href:"https://pnpm.io/installation",children:"https://pnpm.io/installation"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["Remove the ",(0,i.jsx)(n.code,{children:"node_modules/"})," folder in the root, if it exists. If not already using workspaces, run ",(0,i.jsx)(n.code,{children:"lerna clean"})," to remove the ",(0,i.jsx)(n.code,{children:"node_modules/"})," folder in all packages."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["Set ",(0,i.jsx)(n.code,{children:'"npmClient": "pnpm"'})," in ",(0,i.jsx)(n.code,{children:"lerna.json"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["Create a ",(0,i.jsx)(n.code,{children:"pnpm-workspace.yaml"}),' file in the root of your project.\nIf you are already using npm or yarn workspaces, move the "workspaces" property from ',(0,i.jsx)(n.code,{children:"package.json"})," to ",(0,i.jsx)(n.code,{children:"pnpm-workspace.yaml"}),'. If you were not already using workspaces, move the "packages" property from ',(0,i.jsx)(n.code,{children:"lerna.json"})," to ",(0,i.jsx)(n.code,{children:"pnpm-workspace.yaml"}),". For example:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:'title="package.json"',children:'{\n "workspaces": ["packages/*"]\n}\n'})}),"\n",(0,i.jsx)(n.p,{children:"and"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:'title="lerna.json"',children:'{\n "packages": ["packages/*"]\n}\n'})}),"\n",(0,i.jsx)(n.p,{children:"become:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-yaml",metastring:'title="pnpm-workspace.yaml"',children:'packages:\n - "packages/*"\n'})}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["(optional) Run ",(0,i.jsx)(n.code,{children:"pnpm import"})," to generate a ",(0,i.jsx)(n.code,{children:"pnpm-lock.yaml"})," file from an existing lockfile. See ",(0,i.jsx)(n.a,{href:"https://pnpm.io/cli/import",children:"https://pnpm.io/cli/import"})," for supported lockfile sources."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["Run ",(0,i.jsx)(n.code,{children:"pnpm install"}),"."]}),"\n"]}),"\n"]})]})}function d(e={}){const{wrapper:n}={...(0,r.M)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(a,{...e})}):a(e)}},2172:(e,n,s)=>{s.d(n,{I:()=>l,M:()=>o});var i=s(1504);const r={},c=i.createContext(r);function o(e){const n=i.useContext(c);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),i.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/2e9a6f4f.40b16c15.js b/assets/js/2e9a6f4f.40b16c15.js deleted file mode 100644 index e0814ac..0000000 --- a/assets/js/2e9a6f4f.40b16c15.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[388],{5012:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>t,contentTitle:()=>o,default:()=>d,frontMatter:()=>c,metadata:()=>l,toc:()=>a});var i=s(7624),r=s(2172);const c={},o="Using pnpm with Lerna",l={id:"recipes/using-pnpm-with-lerna",title:"Using pnpm with Lerna",description:"Lerna can be used in a pnpm workspace to get the full benefits of both pnpm and Lerna.",source:"@site/docs/recipes/using-pnpm-with-lerna.md",sourceDirName:"recipes",slug:"/recipes/using-pnpm-with-lerna",permalink:"/docs/recipes/using-pnpm-with-lerna",draft:!1,unlisted:!1,editUrl:"https://github.com/lerna/lerna/tree/main/website/docs/recipes/using-pnpm-with-lerna.md",tags:[],version:"current",frontMatter:{},sidebar:"main",previous:{title:"Configuring Published Files",permalink:"/docs/concepts/configuring-published-files"},next:{title:"Commands",permalink:"/docs/api-reference/commands"}},t={},a=[{value:"Getting Started",id:"getting-started",level:2}];function p(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",li:"li",ol:"ol",p:"p",pre:"pre",ul:"ul",...(0,r.M)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h1,{id:"using-pnpm-with-lerna",children:"Using pnpm with Lerna"}),"\n",(0,i.jsxs)(n.p,{children:["Lerna can be used in a ",(0,i.jsxs)(n.a,{href:"https://pnpm.io/workspaces",children:[(0,i.jsx)(n.code,{children:"pnpm"})," workspace"]})," to get the full benefits of both ",(0,i.jsx)(n.a,{href:"https://pnpm.io",children:(0,i.jsx)(n.code,{children:"pnpm"})})," and Lerna."]}),"\n",(0,i.jsxs)(n.p,{children:["When used in a ",(0,i.jsx)(n.code,{children:"pnpm"})," workspace, Lerna will:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["resolve package locations with ",(0,i.jsx)(n.code,{children:"pnpm-workspace.yaml"})," (",(0,i.jsx)(n.a,{href:"https://pnpm.io/workspaces",children:"https://pnpm.io/workspaces"}),")"]}),"\n",(0,i.jsxs)(n.li,{children:["enforce ",(0,i.jsx)(n.code,{children:"useWorkspaces: true"})," in ",(0,i.jsx)(n.code,{children:"lerna.json"})," (and ignore ",(0,i.jsx)(n.code,{children:"packages:"})," in ",(0,i.jsx)(n.code,{children:"package.json"}),")."]}),"\n",(0,i.jsxs)(n.li,{children:["block usage of ",(0,i.jsx)(n.code,{children:"bootstrap"}),", ",(0,i.jsx)(n.code,{children:"link"}),", and ",(0,i.jsx)(n.code,{children:"add"})," commands. Instead, you should use ",(0,i.jsx)(n.code,{children:"pnpm"})," commands directly to manage dependencies (",(0,i.jsx)(n.a,{href:"https://pnpm.io/cli/install",children:"https://pnpm.io/cli/install"}),")."]}),"\n",(0,i.jsxs)(n.li,{children:["respect the ",(0,i.jsx)(n.a,{href:"https://pnpm.io/workspaces#workspace-protocol-workspace",children:"workspace protocol"})," for package dependencies.","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["During ",(0,i.jsx)(n.code,{children:"lerna version"}),", dependencies will be updated as normal, but will preserve the ",(0,i.jsx)(n.code,{children:"workspace:"})," prefix if it exists."]}),"\n",(0,i.jsxs)(n.li,{children:["If a ",(0,i.jsx)(n.a,{href:"https://pnpm.io/workspaces#referencing-workspace-packages-through-aliases",children:"workspace alias"})," is used, then ",(0,i.jsx)(n.code,{children:"lerna version"})," will not bump the version of the dependency, since aliases don't specify a version number to bump."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"getting-started",children:"Getting Started"}),"\n",(0,i.jsx)(n.p,{children:"To set up pnpm with Lerna:"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["If not installed already, install ",(0,i.jsx)(n.code,{children:"pnpm"}),": ",(0,i.jsx)(n.a,{href:"https://pnpm.io/installation",children:"https://pnpm.io/installation"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["Remove the ",(0,i.jsx)(n.code,{children:"node_modules/"})," folder in the root, if it exists. If not already using workspaces, run ",(0,i.jsx)(n.code,{children:"lerna clean"})," to remove the ",(0,i.jsx)(n.code,{children:"node_modules/"})," folder in all packages."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["Set ",(0,i.jsx)(n.code,{children:'"npmClient": "pnpm"'})," in ",(0,i.jsx)(n.code,{children:"lerna.json"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["Create a ",(0,i.jsx)(n.code,{children:"pnpm-workspace.yaml"}),' file in the root of your project.\nIf you are already using npm or yarn workspaces, move the "workspaces" property from ',(0,i.jsx)(n.code,{children:"package.json"})," to ",(0,i.jsx)(n.code,{children:"pnpm-workspace.yaml"}),'. If you were not already using workspaces, move the "packages" property from ',(0,i.jsx)(n.code,{children:"lerna.json"})," to ",(0,i.jsx)(n.code,{children:"pnpm-workspace.yaml"}),". For example:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:'title="package.json"',children:'{\n "workspaces": ["packages/*"]\n}\n'})}),"\n",(0,i.jsx)(n.p,{children:"and"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:'title="lerna.json"',children:'{\n "packages": ["packages/*"]\n}\n'})}),"\n",(0,i.jsx)(n.p,{children:"become:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-yaml",metastring:'title="pnpm-workspace.yaml"',children:'packages:\n - "packages/*"\n'})}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["(optional) Run ",(0,i.jsx)(n.code,{children:"pnpm import"})," to generate a ",(0,i.jsx)(n.code,{children:"pnpm-lock.yaml"})," file from an existing lockfile. See ",(0,i.jsx)(n.a,{href:"https://pnpm.io/cli/import",children:"https://pnpm.io/cli/import"})," for supported lockfile sources."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["Run ",(0,i.jsx)(n.code,{children:"pnpm install"}),"."]}),"\n"]}),"\n"]})]})}function d(e={}){const{wrapper:n}={...(0,r.M)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(p,{...e})}):p(e)}},2172:(e,n,s)=>{s.d(n,{I:()=>l,M:()=>o});var i=s(1504);const r={},c=i.createContext(r);function o(e){const n=i.useContext(c);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),i.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.8a7a408c.js b/assets/js/runtime~main.01418927.js similarity index 98% rename from assets/js/runtime~main.8a7a408c.js rename to assets/js/runtime~main.01418927.js index 3f83436..031f5dc 100644 --- a/assets/js/runtime~main.8a7a408c.js +++ b/assets/js/runtime~main.01418927.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,t,r,f,d={},o={};function b(e){var a=o[e];if(void 0!==a)return a.exports;var t=o[e]={id:e,loaded:!1,exports:{}};return d[e].call(t.exports,t,t.exports,b),t.loaded=!0,t.exports}b.m=d,b.c=o,e=[],b.O=(a,t,r,f)=>{if(!t){var d=1/0;for(i=0;iWhen used in a pnpm
workspace, Lerna will:
pnpm-workspace.yaml
(https://pnpm.io/workspaces)useWorkspaces: true
in lerna.json
(and ignore packages:
in package.json
)."workspaces"
in package.json
bootstrap
, link
, and add
commands. Instead, you should use pnpm
commands directly to manage dependencies (https://pnpm.io/cli/install).