├── .nojekyll
├── 404.html
├── CNAME
├── assets
├── css
│ └── styles.9697f4ca.css
├── images
│ ├── 3agents-b4eed3c22ef0fe31ac45d1f0ce854b2b.svg
│ ├── binning-2266f5ba9543a1974a7864232a37a389.svg
│ ├── cache-c67f30b99d684071f4f042509a39448e.png
│ ├── faster-builds-59a232e5f98a04d44a5e2bc82eaff792.jpeg
│ ├── how-does-dte-work-577993a1c7e19ef801bc76623f3c58f0.jpeg
│ ├── lerna-hashing-d90a81e4acb3c97217f66a22f7b8c745.png
│ ├── nx-cloud-how-does-dte-work-65244729488886b3b40e4072491a3393.png
│ ├── schedule-tasks-71d06587de8f289c9955a1052051d2de.jpeg
│ ├── task-dependencies-ba3f69e12b4a12cac2454ce509aa58c3.jpeg
│ ├── task-graph-big-c67fec16567b185ddeed8e7433aad868.png
│ ├── task-graph-execution-1729feab97c2a7f2879ba3783dd1f518.svg
│ ├── use-agents-d6bc7fdc5c63f4a871171cf0cf63e114.jpeg
│ └── whats-a-task-7552def96ccf59b70629c3afe745b61a.jpeg
└── js
│ ├── 004b9cd7.b1483e35.js
│ ├── 0058b4c6.14eab1f3.js
│ ├── 0480b142.1a65481d.js
│ ├── 14eb3368.b3f4fe9b.js
│ ├── 158.b69d5ad9.js
│ ├── 17896441.7f93ddb1.js
│ ├── 1df93b7f.9151e514.js
│ ├── 2e9a6f4f.a3ab3bb4.js
│ ├── 2fb89d45.85d9eee7.js
│ ├── 35dd6042.94e12006.js
│ ├── 3d3845f1.996b56cc.js
│ ├── 42.07919f24.js
│ ├── 4b30c9f8.8344c8bf.js
│ ├── 4f271799.2ede6fa8.js
│ ├── 517cf5ca.f46010f9.js
│ ├── 5e95c892.b114d62c.js
│ ├── 623bb9fe.d8387f7a.js
│ ├── 627.fc178e33.js
│ ├── 714aece2.fb172a94.js
│ ├── 809.65d2179a.js
│ ├── 85d9af9a.d977e4ad.js
│ ├── 913.f65583d1.js
│ ├── 9b50cbb9.6e738715.js
│ ├── 9d9f8394.7408c5eb.js
│ ├── a09c2993.df0289f5.js
│ ├── a5d4e17f.774a4dc3.js
│ ├── a7456010.dee63f34.js
│ ├── a7bd4aaa.e8a160ba.js
│ ├── a94703ab.01908dc4.js
│ ├── aba21aa0.7f4ce930.js
│ ├── b8844bda.8469d2f2.js
│ ├── c0ae5a06.58f706a8.js
│ ├── c44efb77.9aa012a7.js
│ ├── d55206b1.8192417d.js
│ ├── d589d3a7.9208d0a3.js
│ ├── d7954a39.c3808589.js
│ ├── df0717d9.ae8eda22.js
│ ├── e5379f2c.2760bb5f.js
│ ├── ead156ee.88dacb36.js
│ ├── f2c7bef6.a961b5ea.js
│ ├── fdfb3855.83360ae9.js
│ ├── main.55e4c2d9.js
│ ├── main.55e4c2d9.js.LICENSE.txt
│ └── runtime~main.af94e216.js
├── docs
├── api-reference
│ ├── commands.html
│ ├── configuration.html
│ └── utilities.html
├── concepts.html
├── concepts
│ ├── configuring-published-files.html
│ ├── dte-guide.html
│ ├── how-caching-works.html
│ └── task-pipeline-configuration.html
├── faq.html
├── features.html
├── features
│ ├── cache-tasks.html
│ ├── distribute-tasks.html
│ ├── editor-integrations.html
│ ├── project-graph.html
│ ├── run-tasks.html
│ ├── share-your-cache.html
│ ├── version-and-publish.html
│ └── workspace-watching.html
├── getting-started.html
├── introduction.html
├── legacy-package-management.html
├── lerna-and-nx-version-matrix.html
├── lerna-and-nx.html
├── lerna6-obsolete-options.html
├── recipes
│ └── using-pnpm-with-lerna.html
└── troubleshooting.html
├── images
├── android-chrome-192x192.png
├── android-chrome-512x512.png
├── apple-touch-icon.png
├── background
│ ├── blob-lerna-vertical.svg
│ ├── parcel.avif
│ └── rocket.avif
├── favicon-16x16.png
├── favicon-32x32.png
├── favicon.ico
├── lerna-logo-dark.svg
├── lerna-logo-light.svg
├── og-image-lerna-upgrade.jpg
└── og-image-lerna.png
├── index.html
├── site.webmanifest
├── sitemap.xml
└── upgrade.html
/.nojekyll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/.nojekyll
--------------------------------------------------------------------------------
/CNAME:
--------------------------------------------------------------------------------
1 | lerna.js.org
2 |
--------------------------------------------------------------------------------
/assets/images/cache-c67f30b99d684071f4f042509a39448e.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/assets/images/cache-c67f30b99d684071f4f042509a39448e.png
--------------------------------------------------------------------------------
/assets/images/faster-builds-59a232e5f98a04d44a5e2bc82eaff792.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/assets/images/faster-builds-59a232e5f98a04d44a5e2bc82eaff792.jpeg
--------------------------------------------------------------------------------
/assets/images/how-does-dte-work-577993a1c7e19ef801bc76623f3c58f0.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/assets/images/how-does-dte-work-577993a1c7e19ef801bc76623f3c58f0.jpeg
--------------------------------------------------------------------------------
/assets/images/lerna-hashing-d90a81e4acb3c97217f66a22f7b8c745.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/assets/images/lerna-hashing-d90a81e4acb3c97217f66a22f7b8c745.png
--------------------------------------------------------------------------------
/assets/images/nx-cloud-how-does-dte-work-65244729488886b3b40e4072491a3393.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/assets/images/nx-cloud-how-does-dte-work-65244729488886b3b40e4072491a3393.png
--------------------------------------------------------------------------------
/assets/images/schedule-tasks-71d06587de8f289c9955a1052051d2de.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/assets/images/schedule-tasks-71d06587de8f289c9955a1052051d2de.jpeg
--------------------------------------------------------------------------------
/assets/images/task-dependencies-ba3f69e12b4a12cac2454ce509aa58c3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/assets/images/task-dependencies-ba3f69e12b4a12cac2454ce509aa58c3.jpeg
--------------------------------------------------------------------------------
/assets/images/task-graph-big-c67fec16567b185ddeed8e7433aad868.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/assets/images/task-graph-big-c67fec16567b185ddeed8e7433aad868.png
--------------------------------------------------------------------------------
/assets/images/use-agents-d6bc7fdc5c63f4a871171cf0cf63e114.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/assets/images/use-agents-d6bc7fdc5c63f4a871171cf0cf63e114.jpeg
--------------------------------------------------------------------------------
/assets/images/whats-a-task-7552def96ccf59b70629c3afe745b61a.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/assets/images/whats-a-task-7552def96ccf59b70629c3afe745b61a.jpeg
--------------------------------------------------------------------------------
/assets/js/004b9cd7.b1483e35.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[446],{9487:e=>{e.exports=JSON.parse('{"categoryGeneratedIndex":{"title":"Concepts","description":"Get a higher level understanding of concepts used in Lerna","keywords":["caching","dte","versioning","publishing"],"slug":"/concepts","permalink":"/docs/concepts","sidebar":"main","navigation":{"previous":{"title":"Workspace Watching","permalink":"/docs/features/workspace-watching"},"next":{"title":"Task Pipeline Configuration","permalink":"/docs/concepts/task-pipeline-configuration"}}}}')}}]);
--------------------------------------------------------------------------------
/assets/js/0058b4c6.14eab1f3.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[849],{6164:e=>{e.exports=JSON.parse('{"version":{"pluginId":"default","version":"current","label":"Next","banner":null,"badge":false,"noIndex":false,"className":"docs-version-current","isLast":true,"docsSidebars":{"main":[{"type":"link","label":"Introduction","href":"/docs/introduction","docId":"introduction","unlisted":false},{"type":"link","label":"Getting Started","href":"/docs/getting-started","docId":"getting-started","unlisted":false},{"type":"link","label":"Lerna and Nx","href":"/docs/lerna-and-nx","docId":"lerna-and-nx","unlisted":false},{"type":"category","label":"Features","items":[{"type":"link","label":"Run Tasks","href":"/docs/features/run-tasks","docId":"features/run-tasks","unlisted":false},{"type":"link","label":"Cache Task Results","href":"/docs/features/cache-tasks","docId":"features/cache-tasks","unlisted":false},{"type":"link","label":"Share Your Cache","href":"/docs/features/share-your-cache","docId":"features/share-your-cache","unlisted":false},{"type":"link","label":"Explore the Project Graph","href":"/docs/features/project-graph","docId":"features/project-graph","unlisted":false},{"type":"link","label":"Distribute Task Execution","href":"/docs/features/distribute-tasks","docId":"features/distribute-tasks","unlisted":false},{"type":"link","label":"Version and Publish","href":"/docs/features/version-and-publish","docId":"features/version-and-publish","unlisted":false},{"type":"link","label":"Editor Integrations","href":"/docs/features/editor-integrations","docId":"features/editor-integrations","unlisted":false},{"type":"link","label":"Workspace Watching","href":"/docs/features/workspace-watching","docId":"features/workspace-watching","unlisted":false}],"collapsed":false,"collapsible":true,"href":"/docs/features"},{"type":"category","label":"Concepts","items":[{"type":"link","label":"Task Pipeline Configuration","href":"/docs/concepts/task-pipeline-configuration","docId":"concepts/task-pipeline-configuration","unlisted":false},{"type":"link","label":"How Caching Works","href":"/docs/concepts/how-caching-works","docId":"concepts/how-caching-works","unlisted":false},{"type":"link","label":"Distributed Task Execution Guide","href":"/docs/concepts/dte-guide","docId":"concepts/dte-guide","unlisted":false},{"type":"link","label":"Configuring Published Files","href":"/docs/concepts/configuring-published-files","docId":"concepts/configuring-published-files","unlisted":false}],"collapsed":false,"collapsible":true,"href":"/docs/concepts"},{"type":"category","label":"Recipes","items":[{"type":"link","label":"Using pnpm with Lerna","href":"/docs/recipes/using-pnpm-with-lerna","docId":"recipes/using-pnpm-with-lerna","unlisted":false}],"collapsed":false,"collapsible":true},{"type":"category","label":"API Reference","items":[{"type":"link","label":"Commands","href":"/docs/api-reference/commands","docId":"api-reference/commands","unlisted":false},{"type":"link","label":"Configuration","href":"/docs/api-reference/configuration","docId":"api-reference/configuration","unlisted":false},{"type":"link","label":"Utilities","href":"/docs/api-reference/utilities","docId":"api-reference/utilities","unlisted":false}],"collapsed":false,"collapsible":true},{"type":"link","label":"Lerna and Nx Version Matrix","href":"/docs/lerna-and-nx-version-matrix","docId":"lerna-and-nx-version-matrix","unlisted":false},{"type":"link","label":"Legacy Package Management","href":"/docs/legacy-package-management","docId":"legacy-package-management","unlisted":false},{"type":"link","label":"FAQ","href":"/docs/faq","docId":"faq","unlisted":false},{"type":"link","label":"Lerna 6: Obsolete Options","href":"/docs/lerna6-obsolete-options","docId":"lerna6-obsolete-options","unlisted":false},{"type":"link","label":"Troubleshooting","href":"/docs/troubleshooting","docId":"troubleshooting","unlisted":false}]},"docs":{"api-reference/commands":{"id":"api-reference/commands","title":"Commands","description":"- lerna add-caching","sidebar":"main"},"api-reference/configuration":{"id":"api-reference/configuration","title":"Configuration","description":"Lerna\'s configuration is split into two files: lerna.json and nx.json.","sidebar":"main"},"api-reference/utilities":{"id":"api-reference/utilities","title":"Utilities","description":"Lerna ships some utility functions that can be used in creating your own tools within a Lerna monorepo.","sidebar":"main"},"concepts/configuring-published-files":{"id":"concepts/configuring-published-files","title":"Configuring Published Files","description":"When publishing a package to a registry, the default is to publish everything in the package\'s source directory. This is not always optimal, since there are often files only relevant for development, such as tests and configuration files, and it could be that you first compile your source files and output them to a centralized location in a monorepo setup.","sidebar":"main"},"concepts/dte-guide":{"id":"concepts/dte-guide","title":"Distributed Task Execution Guide","description":"The illustrations in this guide are created by Nrwlian Nicole Oliver","sidebar":"main"},"concepts/how-caching-works":{"id":"concepts/how-caching-works","title":"How Caching Works","description":"Before running any task, Lerna computes its computation hash. As long as the computation hash is the same, the output of","sidebar":"main"},"concepts/task-pipeline-configuration":{"id":"concepts/task-pipeline-configuration","title":"Task Pipeline Configuration","description":"Lerna delegates the running of npm scripts (forking processes etc) to Nx. The nx.json file is the place where you can","sidebar":"main"},"faq":{"id":"faq","title":"FAQ","description":"This document is a work in progress.","sidebar":"main"},"features/cache-tasks":{"id":"features/cache-tasks","title":"Cache Task Results","description":"When it comes to running tasks, caching etc., Lerna and Nx can be used interchangeably. When we say \\"Lerna can cache","sidebar":"main"},"features/distribute-tasks":{"id":"features/distribute-tasks","title":"Distribute Task Execution","description":"Lerna speeds up your average CI time with caching and the --since flag. But neither of these features help with the worst case scenario. When something at the core of your repo has been modified and every task needs to be run in CI, the only way to improve the performance is by adding more agent jobs and efficiently parallelizing the tasks.","sidebar":"main"},"features/editor-integrations":{"id":"features/editor-integrations","title":"Editor Integrations","description":"Nx Console displays the npm scripts for all your projects in the VS Code sidebar and allows you to run them with a single click or open the script definition in your editor.","sidebar":"main"},"features/project-graph":{"id":"features/project-graph","title":"Explore the Project Graph","description":"For Lerna (and Nx) to run tasks quickly and correctly, it creates a graph of the dependencies between all the projects in the repository. Exploring this graph visually can be useful to understand why Lerna is behaving in a certain way and to get a high level view of your code architecture.","sidebar":"main"},"features/run-tasks":{"id":"features/run-tasks","title":"Run Tasks","description":"Monorepos can have hundreds or even thousands of projects, so being able to run npm scripts against all (or some) of","sidebar":"main"},"features/share-your-cache":{"id":"features/share-your-cache","title":"Share Your Cache","description":"The computation cache provided by Lerna can be distributed across multiple machines. You can either build an implementation","sidebar":"main"},"features/version-and-publish":{"id":"features/version-and-publish","title":"Version and Publish","description":"Lerna can increment your package\'s versions as well as publish your packages to NPM, and it provides a variety of options to make sure any workflow can be accommodated.","sidebar":"main"},"features/workspace-watching":{"id":"features/workspace-watching","title":"Workspace Watching","description":"Workspace Watching is available as of Lerna 6.4.0.","sidebar":"main"},"getting-started":{"id":"getting-started","title":"Getting Started","description":"Lerna comes with a dedicated init command to assist you with both adding lerna to an existing repo, or creating one from scratch.","sidebar":"main"},"introduction":{"id":"introduction","title":"Introduction","description":"Lerna is the original monorepo tool for JavaScript/TypeScript. It has been around for many years and is used by tens of thousands of projects, including React and Jest.","sidebar":"main"},"legacy-package-management":{"id":"legacy-package-management","title":"Legacy Package Management","description":"Migrating from lerna bootstrap, lerna add and lerna link in lerna v7 and later","sidebar":"main"},"lerna-and-nx":{"id":"lerna-and-nx","title":"Lerna and Nx","description":"Nrwl (the company behind the open source build system Nx) has taken over stewardship of Lerna. Nx is a build system developed by ex-Googlers and utilizes many of the techniques used by internal Google tools. Lerna uses Nx to detect packages in the workspace and dependencies between them. Lerna defers to Nx\'s powerful task runner to run scripts, allowing you to run them in parallel, cache results, and distribute them across multiple machines, all while ensuring that dependencies between packages are respected. For a complete list of which Lerna versions are compatible with which Nx versions, see the Lerna and Nx Version Matrix.","sidebar":"main"},"lerna-and-nx-version-matrix":{"id":"lerna-and-nx-version-matrix","title":"Lerna and Nx Version Matrix","description":"The latest version of Lerna is kept up to date with the latest major version of Nx in order to support the latest features. If you have an older version of Lerna or Nx, you can use the table below to ensure compatibility between the two.","sidebar":"main"},"lerna6-obsolete-options":{"id":"lerna6-obsolete-options","title":"Lerna 6: Obsolete Options","description":"Nx and Lerna work together seamlessly in the same workspace.","sidebar":"main"},"recipes/using-pnpm-with-lerna":{"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.","sidebar":"main"},"troubleshooting":{"id":"troubleshooting","title":"Troubleshooting","description":"This document contains solutions for certain issues our users encountered","sidebar":"main"}}}}')}}]);
--------------------------------------------------------------------------------
/assets/js/0480b142.1a65481d.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[70],{5585:(e,n,a)=>{a.r(n),a.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>l});const s=JSON.parse('{"id":"faq","title":"FAQ","description":"This document is a work in progress.","source":"@site/docs/faq.md","sourceDirName":".","slug":"/faq","permalink":"/docs/faq","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/faq.md","tags":[],"version":"current","frontMatter":{"id":"faq","title":"FAQ","type":"recipe"},"sidebar":"main","previous":{"title":"Legacy Package Management","permalink":"/docs/legacy-package-management"},"next":{"title":"Lerna 6: Obsolete Options","permalink":"/docs/lerna6-obsolete-options"}}');var r=a(4848),t=a(8453);const o={id:"faq",title:"FAQ",type:"recipe"},i="Frequently asked questions",c={},l=[{value:"How do I add a third party dependency to my Lerna repository?",id:"how-do-i-add-a-third-party-dependency-to-my-lerna-repository",level:2},{value:"New packages within the lerna repo",id:"new-packages-within-the-lerna-repo",level:3},{value:"Existing packages",id:"existing-packages",level:3},{value:"How do I retry publishing if publish
fails?",id:"how-do-i-retry-publishing-if-publish-fails",level:2},{value:"How does Lerna detect packages?",id:"how-does-lerna-detect-packages",level:2}];function d(e){const n={a:"a",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,t.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"frequently-asked-questions",children:"Frequently asked questions"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.em,{children:"This document is a work in progress."})}),"\n",(0,r.jsx)(n.h2,{id:"how-do-i-add-a-third-party-dependency-to-my-lerna-repository",children:"How do I add a third party dependency to my Lerna repository?"}),"\n",(0,r.jsxs)(n.p,{children:["Lerna is not responsible for adding or linking your dependencies, that is what your package manager of choice (",(0,r.jsx)(n.code,{children:"npm"}),"/",(0,r.jsx)(n.code,{children:"yarn"}),"/",(0,r.jsx)(n.code,{children:"pnpm"}),") is best at. By using the ",(0,r.jsx)(n.code,{children:"workspaces"})," feature of your package manager, all the linking of local packages will happen automatically based on the relationships you set up in your ",(0,r.jsx)(n.code,{children:"package.json"})," files."]}),"\n",(0,r.jsxs)(n.p,{children:["You can check out the ",(0,r.jsx)(n.code,{children:"workspaces"})," documentation for your package manager here:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"npm"})," (",(0,r.jsx)(n.a,{href:"https://docs.npmjs.com/cli/using-npm/workspaces",children:"https://docs.npmjs.com/cli/using-npm/workspaces"}),")"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"yarn"})," (",(0,r.jsx)(n.a,{href:"https://yarnpkg.com/features/workspaces",children:"https://yarnpkg.com/features/workspaces"}),")"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"pnpm"})," (",(0,r.jsx)(n.a,{href:"https://pnpm.io/workspaces",children:"https://pnpm.io/workspaces"}),")"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["NOTE: Because lerna itself predates the ",(0,r.jsx)(n.code,{children:"workspaces"})," feature in package managers, there was historically a few commands (",(0,r.jsx)(n.code,{children:"add"}),", ",(0,r.jsx)(n.code,{children:"bootstrap"})," and ",(0,r.jsx)(n.code,{children:"link"}),") that attempted to fill that gap. Fortunately these commands are no longer needed and lerna can focus on what it does best and let the package managers does the same."]}),"\n",(0,r.jsx)(n.h3,{id:"new-packages-within-the-lerna-repo",children:"New packages within the lerna repo"}),"\n",(0,r.jsxs)(n.p,{children:["You can use the ",(0,r.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/create#readme",children:(0,r.jsx)(n.code,{children:"lerna create"})})," command to create new packages within your lerna repo."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-sh",children:"lerna create \n"})}),"\n",(0,r.jsxs)(n.p,{children:["See the ",(0,r.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/create#readme",children:"create docs"})," for more options."]}),"\n",(0,r.jsxs)(n.p,{children:["If you don't want to use ",(0,r.jsx)(n.code,{children:"lerna create"}),", then you can still manually create a package by running ",(0,r.jsx)(n.code,{children:"npm init"})," within a subdirectory of the ",(0,r.jsx)(n.code,{children:"packages"})," folder and Lerna will automatically detect it."]}),"\n",(0,r.jsx)(n.h3,{id:"existing-packages",children:"Existing packages"}),"\n",(0,r.jsxs)(n.p,{children:["You can use ",(0,r.jsx)(n.a,{href:"https://github.com/lerna/lerna/blob/main/libs/commands/import/README.md",children:(0,r.jsx)(n.code,{children:"lerna import "})})," to transfer an existing package\ninto your Lerna repository; this command will preserve the commit history."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.a,{href:"https://github.com/lerna/lerna/blob/main/libs/commands/import/README.md",children:(0,r.jsx)(n.code,{children:"lerna import "})})," takes a local path rather than a URL. In this\ncase you will need to have the repo you wish to link to on your file system."]}),"\n",(0,r.jsxs)(n.h2,{id:"how-do-i-retry-publishing-if-publish-fails",children:["How do I retry publishing if ",(0,r.jsx)(n.code,{children:"publish"})," fails?"]}),"\n",(0,r.jsx)(n.p,{children:"In the case that some packages were successfully published and others were not, lerna publish may have left the repository in an inconsistent state with some changed files. To recover from this, reset any extraneous local changes from the failed run to get back to a clean working tree. Then, retry the same lerna publish command. Lerna will attempt to publish all of the packages again, but will recognize those that have already been published and skip over them with a warning."}),"\n",(0,r.jsx)(n.p,{children:"If you used the lerna publish command without positional arguments to select a new version for the packages, then you can run lerna publish from-git to retry publishing that same already-tagged version instead of having to bump the version again while retrying."}),"\n",(0,r.jsx)(n.h2,{id:"how-does-lerna-detect-packages",children:"How does Lerna detect packages?"}),"\n",(0,r.jsxs)(n.p,{children:["By default, for ",(0,r.jsx)(n.code,{children:"npm"})," and ",(0,r.jsx)(n.code,{children:"yarn"}),", lerna uses the configured ",(0,r.jsx)(n.code,{children:"workspaces"})," property in ",(0,r.jsx)(n.code,{children:"package.json"})," to know what packages to operate on. For details on this property, see the ",(0,r.jsx)(n.a,{href:"https://docs.npmjs.com/cli/using-npm/workspaces",children:"npm documentation"})," or the ",(0,r.jsx)(n.a,{href:"https://yarnpkg.com/features/workspaces",children:"yarn documentation"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["If you are using ",(0,r.jsx)(n.code,{children:"pnpm"}),", you might have set ",(0,r.jsx)(n.code,{children:"npmClient"})," to ",(0,r.jsx)(n.code,{children:"pnpm"})," in ",(0,r.jsx)(n.code,{children:"lerna.json"}),". In this case, Lerna will use the ",(0,r.jsx)(n.code,{children:"packages"})," property in ",(0,r.jsx)(n.code,{children:"pnpm-workspace.yaml"})," to know what packages to operate on. For details on this property, see the ",(0,r.jsx)(n.a,{href:"https://pnpm.io/workspaces",children:"pnpm documentation"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["If you want lerna to focus on a particular subset of packages in your repo, you can leverage the ",(0,r.jsx)(n.code,{children:"packages"})," property in ",(0,r.jsx)(n.code,{children:"lerna.json"})," to search for packages."]})]})}function h(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,a)=>{a.d(n,{R:()=>o,x:()=>i});var s=a(6540);const r={},t=s.createContext(r);function o(e){const n=s.useContext(t);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(t.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/14eb3368.b3f4fe9b.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[969],{7519:(e,t,n)=>{n.d(t,{A:()=>g});n(6540);var s=n(4164),r=n(204),i=n(102),a=n(214),l=n(6289),o=n(539),c=n(9030),d=n(4848);function u(e){return(0,d.jsx)("svg",{viewBox:"0 0 24 24",...e,children:(0,d.jsx)("path",{d:"M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z",fill:"currentColor"})})}const m={breadcrumbHomeIcon:"breadcrumbHomeIcon_YNFT"};function h(){const e=(0,c.Ay)("/");return(0,d.jsx)("li",{className:"breadcrumbs__item",children:(0,d.jsx)(l.A,{"aria-label":(0,o.T)({id:"theme.docs.breadcrumbs.home",message:"Home page",description:"The ARIA label for the home page in the breadcrumbs"}),className:"breadcrumbs__link",href:e,children:(0,d.jsx)(u,{className:m.breadcrumbHomeIcon})})})}const b={breadcrumbsContainer:"breadcrumbsContainer_Z_bl"};function x(e){let{children:t,href:n,isLast:s}=e;const r="breadcrumbs__link";return s?(0,d.jsx)("span",{className:r,itemProp:"name",children:t}):n?(0,d.jsx)(l.A,{className:r,href:n,itemProp:"item",children:(0,d.jsx)("span",{itemProp:"name",children:t})}):(0,d.jsx)("span",{className:r,children:t})}function p(e){let{children:t,active:n,index:r,addMicrodata:i}=e;return(0,d.jsxs)("li",{...i&&{itemScope:!0,itemProp:"itemListElement",itemType:"https://schema.org/ListItem"},className:(0,s.A)("breadcrumbs__item",{"breadcrumbs__item--active":n}),children:[t,(0,d.jsx)("meta",{itemProp:"position",content:String(r+1)})]})}function g(){const e=(0,i.OF)(),t=(0,a.Dt)();return e?(0,d.jsx)("nav",{className:(0,s.A)(r.G.docs.docBreadcrumbs,b.breadcrumbsContainer),"aria-label":(0,o.T)({id:"theme.docs.breadcrumbs.navAriaLabel",message:"Breadcrumbs",description:"The ARIA label for the breadcrumbs"}),children:(0,d.jsxs)("ul",{className:"breadcrumbs",itemScope:!0,itemType:"https://schema.org/BreadcrumbList",children:[t&&(0,d.jsx)(h,{}),e.map(((t,n)=>{const s=n===e.length-1,r="category"===t.type&&t.linkUnlisted?void 0:t.href;return(0,d.jsx)(p,{active:s,index:n,addMicrodata:!!r,children:(0,d.jsx)(x,{href:r,isLast:s,children:t.label})},n)}))]})}):null}},4561:(e,t,n)=>{n.r(t),n.d(t,{default:()=>V});var s=n(6540),r=n(1769),i=n(102),a=n(9030),l=n(4164),o=n(6289),c=n(797);const d=["zero","one","two","few","many","other"];function u(e){return d.filter((t=>e.includes(t)))}const m={locale:"en",pluralForms:u(["one","other"]),select:e=>1===e?"one":"other"};function h(){const{i18n:{currentLocale:e}}=(0,c.A)();return(0,s.useMemo)((()=>{try{return function(e){const t=new Intl.PluralRules(e);return{locale:e,pluralForms:u(t.resolvedOptions().pluralCategories),select:e=>t.select(e)}}(e)}catch(t){return console.error(`Failed to use Intl.PluralRules for locale "${e}".\nDocusaurus will fallback to the default (English) implementation.\nError: ${t.message}\n`),m}}),[e])}function b(){const e=h();return{selectMessage:(t,n)=>function(e,t,n){const s=e.split("|");if(1===s.length)return s[0];s.length>n.pluralForms.length&&console.error(`For locale=${n.locale}, a maximum of ${n.pluralForms.length} plural forms are expected (${n.pluralForms.join(",")}), but the message contains ${s.length}: ${e}`);const r=n.select(t),i=n.pluralForms.indexOf(r);return s[Math.min(i,s.length-1)]}(n,t,e)}}var x=n(2887),p=n(539),g=n(9303);const v={cardContainer:"cardContainer_fWXF",cardTitle:"cardTitle_rnsV",cardDescription:"cardDescription_PWke"};var f=n(4848);function j(e){let{href:t,children:n}=e;return(0,f.jsx)(o.A,{href:t,className:(0,l.A)("card padding--lg",v.cardContainer),children:n})}function A(e){let{href:t,icon:n,title:s,description:r}=e;return(0,f.jsxs)(j,{href:t,children:[(0,f.jsxs)(g.A,{as:"h2",className:(0,l.A)("text--truncate",v.cardTitle),title:s,children:[n," ",s]}),r&&(0,f.jsx)("p",{className:(0,l.A)("text--truncate",v.cardDescription),title:r,children:r})]})}function N(e){let{item:t}=e;const n=(0,i.Nr)(t),s=function(){const{selectMessage:e}=b();return t=>e(t,(0,p.T)({message:"1 item|{count} items",id:"theme.docs.DocCard.categoryDescription.plurals",description:"The default description for a category card in the generated index about how many items this category includes"},{count:t}))}();return n?(0,f.jsx)(A,{href:n,icon:"\ud83d\uddc3\ufe0f",title:t.label,description:t.description??s(t.items.length)}):null}function T(e){let{item:t}=e;const n=(0,x.A)(t.href)?"\ud83d\udcc4\ufe0f":"\ud83d\udd17",s=(0,i.cC)(t.docId??void 0);return(0,f.jsx)(A,{href:t.href,icon:n,title:t.label,description:t.description??s?.description})}function L(e){let{item:t}=e;switch(t.type){case"link":return(0,f.jsx)(T,{item:t});case"category":return(0,f.jsx)(N,{item:t});default:throw new Error(`unknown item type ${JSON.stringify(t)}`)}}function _(e){let{className:t}=e;const n=(0,i.$S)();return(0,f.jsx)(k,{items:n.items,className:t})}function k(e){const{items:t,className:n}=e;if(!t)return(0,f.jsx)(_,{...e});const s=(0,i.d1)(t);return(0,f.jsx)("section",{className:(0,l.A)("row",n),children:s.map(((e,t)=>(0,f.jsx)("article",{className:"col col--6 margin-bottom--lg",children:(0,f.jsx)(L,{item:e})},t)))})}var y=n(807),w=n(5833),I=n(5730),C=n(7519);const F={generatedIndexPage:"generatedIndexPage_vN6x",list:"list_eTzJ",title:"title_kItE"};function M(e){let{categoryGeneratedIndex:t}=e;return(0,f.jsx)(r.be,{title:t.title,description:t.description,keywords:t.keywords,image:(0,a.Ay)(t.image)})}function P(e){let{categoryGeneratedIndex:t}=e;const n=(0,i.$S)();return(0,f.jsxs)("div",{className:F.generatedIndexPage,children:[(0,f.jsx)(w.A,{}),(0,f.jsx)(C.A,{}),(0,f.jsx)(I.A,{}),(0,f.jsxs)("header",{children:[(0,f.jsx)(g.A,{as:"h1",className:F.title,children:t.title}),t.description&&(0,f.jsx)("p",{children:t.description})]}),(0,f.jsx)("article",{className:"margin-top--lg",children:(0,f.jsx)(k,{items:n.items,className:F.list})}),(0,f.jsx)("footer",{className:"margin-top--lg",children:(0,f.jsx)(y.A,{previous:t.navigation.previous,next:t.navigation.next})})]})}function V(e){return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{...e}),(0,f.jsx)(P,{...e})]})}},807:(e,t,n)=>{n.d(t,{A:()=>o});n(6540);var s=n(539),r=n(4164),i=n(6289),a=n(4848);function l(e){const{permalink:t,title:n,subLabel:s,isNext:l}=e;return(0,a.jsxs)(i.A,{className:(0,r.A)("pagination-nav__link",l?"pagination-nav__link--next":"pagination-nav__link--prev"),to:t,children:[s&&(0,a.jsx)("div",{className:"pagination-nav__sublabel",children:s}),(0,a.jsx)("div",{className:"pagination-nav__label",children:n})]})}function o(e){const{previous:t,next:n}=e;return(0,a.jsxs)("nav",{className:"pagination-nav docusaurus-mt-lg","aria-label":(0,s.T)({id:"theme.docs.paginator.navAriaLabel",message:"Docs pages",description:"The ARIA label for the docs pagination"}),children:[t&&(0,a.jsx)(l,{...t,subLabel:(0,a.jsx)(s.A,{id:"theme.docs.paginator.previous",description:"The label used to navigate to the previous doc",children:"Previous"})}),n&&(0,a.jsx)(l,{...n,subLabel:(0,a.jsx)(s.A,{id:"theme.docs.paginator.next",description:"The label used to navigate to the next doc",children:"Next"}),isNext:!0})]})}},5730:(e,t,n)=>{n.d(t,{A:()=>o});n(6540);var s=n(4164),r=n(539),i=n(204),a=n(1858),l=n(4848);function o(e){let{className:t}=e;const n=(0,a.r)();return n.badge?(0,l.jsx)("span",{className:(0,s.A)(t,i.G.docs.docVersionBadge,"badge badge--secondary"),children:(0,l.jsx)(r.A,{id:"theme.docs.versionBadge.label",values:{versionLabel:n.label},children:"Version: {versionLabel}"})}):null}},5833:(e,t,n)=>{n.d(t,{A:()=>p});n(6540);var s=n(4164),r=n(797),i=n(6289),a=n(539),l=n(6942),o=n(204),c=n(6351),d=n(1858),u=n(4848);const m={unreleased:function(e){let{siteTitle:t,versionMetadata:n}=e;return(0,u.jsx)(a.A,{id:"theme.docs.versions.unreleasedVersionLabel",description:"The label used to tell the user that he's browsing an unreleased doc version",values:{siteTitle:t,versionLabel:(0,u.jsx)("b",{children:n.label})},children:"This is unreleased documentation for {siteTitle} {versionLabel} version."})},unmaintained:function(e){let{siteTitle:t,versionMetadata:n}=e;return(0,u.jsx)(a.A,{id:"theme.docs.versions.unmaintainedVersionLabel",description:"The label used to tell the user that he's browsing an unmaintained doc version",values:{siteTitle:t,versionLabel:(0,u.jsx)("b",{children:n.label})},children:"This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained."})}};function h(e){const t=m[e.versionMetadata.banner];return(0,u.jsx)(t,{...e})}function b(e){let{versionLabel:t,to:n,onClick:s}=e;return(0,u.jsx)(a.A,{id:"theme.docs.versions.latestVersionSuggestionLabel",description:"The label used to tell the user to check the latest version",values:{versionLabel:t,latestVersionLink:(0,u.jsx)("b",{children:(0,u.jsx)(i.A,{to:n,onClick:s,children:(0,u.jsx)(a.A,{id:"theme.docs.versions.latestVersionLinkLabel",description:"The label used for the latest version suggestion link label",children:"latest version"})})})},children:"For up-to-date documentation, see the {latestVersionLink} ({versionLabel})."})}function x(e){let{className:t,versionMetadata:n}=e;const{siteConfig:{title:i}}=(0,r.A)(),{pluginId:a}=(0,l.vT)({failfast:!0}),{savePreferredVersionName:d}=(0,c.g1)(a),{latestDocSuggestion:m,latestVersionSuggestion:x}=(0,l.HW)(a),p=m??(g=x).docs.find((e=>e.id===g.mainDocId));var g;return(0,u.jsxs)("div",{className:(0,s.A)(t,o.G.docs.docVersionBanner,"alert alert--warning margin-bottom--md"),role:"alert",children:[(0,u.jsx)("div",{children:(0,u.jsx)(h,{siteTitle:i,versionMetadata:n})}),(0,u.jsx)("div",{className:"margin-top--md",children:(0,u.jsx)(b,{versionLabel:x.label,to:p.path,onClick:()=>d(x.name)})})]})}function p(e){let{className:t}=e;const n=(0,d.r)();return n.banner?(0,u.jsx)(x,{className:t,versionMetadata:n}):null}}}]);
--------------------------------------------------------------------------------
/assets/js/158.b69d5ad9.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[158],{8158:(e,s,a)=>{a.r(s),a.d(s,{DocSearchModal:()=>c.a1});var c=a(5600)}}]);
--------------------------------------------------------------------------------
/assets/js/2e9a6f4f.a3ab3bb4.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[980],{9634:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>t,contentTitle:()=>l,default:()=>d,frontMatter:()=>o,metadata:()=>r,toc:()=>a});const r=JSON.parse('{"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":false,"unlisted":false,"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"}}');var i=s(4848),c=s(8453);const o={},l="Using pnpm with Lerna",t={},a=[{value:"Getting Started",id:"getting-started",level:2}];function p(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",ul:"ul",...(0,c.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.header,{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,c.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(p,{...e})}):p(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>l});var r=s(6540);const i={},c=r.createContext(i);function o(e){const n=r.useContext(c);return r.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(i):e.components||i:o(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/35dd6042.94e12006.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[351],{4133:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>r,toc:()=>c});const r=JSON.parse('{"id":"features/run-tasks","title":"Run Tasks","description":"Monorepos can have hundreds or even thousands of projects, so being able to run npm scripts against all (or some) of","source":"@site/docs/features/run-tasks.md","sourceDirName":"features","slug":"/features/run-tasks","permalink":"/docs/features/run-tasks","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/features/run-tasks.md","tags":[],"version":"current","frontMatter":{"id":"run-tasks","title":"Run Tasks","type":"explainer"},"sidebar":"main","previous":{"title":"Features","permalink":"/docs/features"},"next":{"title":"Cache Task Results","permalink":"/docs/features/cache-tasks"}}');var a=s(4848),t=s(8453);const i={id:"run-tasks",title:"Run Tasks",type:"explainer"},o="Run Tasks",l={},c=[{value:"Definitions",id:"definitions",level:2},{value:"Example Repository",id:"example-repository",level:2},{value:"Run Everything",id:"run-everything",level:2},{value:"Run a Multiple Tasks concurrently",id:"run-a-multiple-tasks-concurrently",level:2},{value:"Run a Task for a single Package",id:"run-a-task-for-a-single-package",level:2},{value:"Run Tasks Affected by a PR",id:"run-tasks-affected-by-a-pr",level:2},{value:"Control How Tasks Run",id:"control-how-tasks-run",level:2},{value:"Automatic loading of .env
files",id:"automatic-loading-of-env-files",level:2}];function d(e){const n={a:"a",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,t.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.header,{children:(0,a.jsx)(n.h1,{id:"run-tasks",children:"Run Tasks"})}),"\n",(0,a.jsx)(n.p,{children:"Monorepos can have hundreds or even thousands of projects, so being able to run npm scripts against all (or some) of\nthem is a key feature of a tool like Lerna."}),"\n",(0,a.jsx)(n.h2,{id:"definitions",children:"Definitions"}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"Command -"})," anything the developer types into the terminal (e.g., ",(0,a.jsx)(n.code,{children:"lerna run build --scope=header --concurrency=5"}),")."]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"Target -"})," the name of an npm script (e.g., ",(0,a.jsx)(n.code,{children:"build"}),")."]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"Task -"})," an invocation of an npm script (e.g., ",(0,a.jsx)(n.code,{children:"header:build"}),")."]}),"\n"]}),"\n",(0,a.jsx)(n.h2,{id:"example-repository",children:"Example Repository"}),"\n",(0,a.jsxs)(n.blockquote,{children:["\n",(0,a.jsxs)(n.p,{children:["Examples are based on ",(0,a.jsx)(n.a,{href:"https://github.com/lerna/getting-started-example",children:"this repository"}),", so feel free to clone it\nand follow along."]}),"\n"]}),"\n",(0,a.jsx)(n.h2,{id:"run-everything",children:"Run Everything"}),"\n",(0,a.jsxs)(n.p,{children:["Each project has the ",(0,a.jsx)(n.code,{children:"test"})," and ",(0,a.jsx)(n.code,{children:"build"})," scripts defined."]}),"\n",(0,a.jsx)(n.p,{children:"Run:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"npx lerna run build\n"})}),"\n",(0,a.jsxs)(n.p,{children:["This will build the projects in the right order: ",(0,a.jsx)(n.code,{children:"footer"})," and ",(0,a.jsx)(n.code,{children:"header"})," and then ",(0,a.jsx)(n.code,{children:"remixapp"}),"."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",metastring:'title="Terminal Output"',children:" \u2714 header:build (501ms)\n \u2714 footer:build (503ms)\n \u2714 remixapp:build (670ms)\n\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\n\n Lerna (powered by Nx) Successfully ran target build for 3 projects (1s)\n\n"})}),"\n",(0,a.jsxs)(n.p,{children:["Note that Lerna doesn't care what each of the build scripts does. The name ",(0,a.jsx)(n.code,{children:"build"})," is also ",(0,a.jsx)(n.strong,{children:"not"})," special: it's simply\nthe name of the npm script."]}),"\n",(0,a.jsx)(n.h2,{id:"run-a-multiple-tasks-concurrently",children:"Run a Multiple Tasks concurrently"}),"\n",(0,a.jsx)(n.p,{children:"You can pass a comma-delimited list of targets you wish to trigger to run concurrently."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"npx lerna run test,build,lint\n"})}),"\n",(0,a.jsxs)(n.p,{children:["If, for example, there are dependencies between your tasks, such as ",(0,a.jsx)(n.code,{children:"build"})," needing to run before ",(0,a.jsx)(n.code,{children:"test"})," for particular packages, the task-runner will coordinate that for you as long as you have configured an appropriate ",(0,a.jsx)(n.a,{href:"../concepts/task-pipeline-configuration",children:"Task Pipeline Configuration"}),"."]}),"\n",(0,a.jsx)(n.h2,{id:"run-a-task-for-a-single-package",children:"Run a Task for a single Package"}),"\n",(0,a.jsxs)(n.p,{children:["While developing you rarely run all the builds or all the tests. Instead, you often run things only against the projects\nyou are changing. For instance, you can run the ",(0,a.jsx)(n.code,{children:"header"})," tests like this:"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"npx lerna run test --scope=header\n"})}),"\n",(0,a.jsx)(n.h2,{id:"run-tasks-affected-by-a-pr",children:"Run Tasks Affected by a PR"}),"\n",(0,a.jsx)(n.p,{children:"You can also run a command for all the projects affected in your PR like this:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"npx lerna run test --since=origin/main\n"})}),"\n",(0,a.jsxs)(n.p,{children:["Learn more ",(0,a.jsx)(n.a,{href:"../api-reference/commands",children:"here"}),"."]}),"\n",(0,a.jsx)(n.h2,{id:"control-how-tasks-run",children:"Control How Tasks Run"}),"\n",(0,a.jsxs)(n.p,{children:["For more control over the order tasks are executed, edit the ",(0,a.jsx)(n.a,{href:"../concepts/task-pipeline-configuration",children:"Task Pipeline Configuration"}),"."]}),"\n",(0,a.jsxs)(n.p,{children:["To speed up your task execution, learn how to ",(0,a.jsx)(n.a,{href:"./cache-tasks",children:"Cache Task Results"})," and ",(0,a.jsx)(n.a,{href:"./distribute-tasks",children:"Distribute Task Execution"}),"."]}),"\n",(0,a.jsxs)(n.h2,{id:"automatic-loading-of-env-files",children:["Automatic loading of ",(0,a.jsx)(n.code,{children:".env"})," files"]}),"\n",(0,a.jsxs)(n.p,{children:["By default the modern task runner powered by Nx will automatically load ",(0,a.jsx)(n.code,{children:".env"})," files for you. You can set ",(0,a.jsx)(n.code,{children:"--load-env-files"})," to false if you want to disable this behavior for any reason."]}),"\n",(0,a.jsxs)(n.p,{children:["For more details about what ",(0,a.jsx)(n.code,{children:".env"})," files will be loaded by default please see: ",(0,a.jsx)(n.a,{href:"https://nx.dev/recipes/environment-variables/define-environment-variables",children:"https://nx.dev/recipes/environment-variables/define-environment-variables"})]})]})}function u(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(d,{...e})}):d(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>o});var r=s(6540);const a={},t=r.createContext(a);function i(e){const n=r.useContext(t);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),r.createElement(t.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/3d3845f1.996b56cc.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[377],{4835:e=>{e.exports=JSON.parse('{"categoryGeneratedIndex":{"title":"How To Guides","description":"Get Started","slug":"/features","permalink":"/docs/features","sidebar":"main","navigation":{"previous":{"title":"Lerna and Nx","permalink":"/docs/lerna-and-nx"},"next":{"title":"Run Tasks","permalink":"/docs/features/run-tasks"}}}}')}}]);
--------------------------------------------------------------------------------
/assets/js/42.07919f24.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[42],{5932:(e,t,i)=>{i.d(t,{A:()=>a});i(6540);var n=i(4164),s=i(539),o=i(9303),r=i(4848);function a(e){let{className:t}=e;return(0,r.jsx)("main",{className:(0,n.A)("container margin-vert--xl",t),children:(0,r.jsx)("div",{className:"row",children:(0,r.jsxs)("div",{className:"col col--6 col--offset-3",children:[(0,r.jsx)(o.A,{as:"h1",className:"hero__title",children:(0,r.jsx)(s.A,{id:"theme.NotFound.title",description:"The title of the 404 page",children:"Page Not Found"})}),(0,r.jsx)("p",{children:(0,r.jsx)(s.A,{id:"theme.NotFound.p1",description:"The first paragraph of the 404 page",children:"We could not find what you were looking for."})}),(0,r.jsx)("p",{children:(0,r.jsx)(s.A,{id:"theme.NotFound.p2",description:"The 2nd paragraph of the 404 page",children:"Please contact the owner of the site that linked you to the original URL and let them know their link is broken."})})]})})})}},3042:(e,t,i)=>{i.r(t),i.d(t,{default:()=>l});i(6540);var n=i(539),s=i(1769),o=i(6316),r=i(5932),a=i(4848);function l(){const e=(0,n.T)({id:"theme.NotFound.title",message:"Page Not Found"});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.be,{title:e}),(0,a.jsx)(o.A,{children:(0,a.jsx)(r.A,{})})]})}}}]);
--------------------------------------------------------------------------------
/assets/js/4b30c9f8.8344c8bf.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[234],{8571:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>o,contentTitle:()=>l,default:()=>h,frontMatter:()=>i,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"lerna-and-nx","title":"Lerna and Nx","description":"Nrwl (the company behind the open source build system Nx) has taken over stewardship of Lerna. Nx is a build system developed by ex-Googlers and utilizes many of the techniques used by internal Google tools. Lerna uses Nx to detect packages in the workspace and dependencies between them. Lerna defers to Nx\'s powerful task runner to run scripts, allowing you to run them in parallel, cache results, and distribute them across multiple machines, all while ensuring that dependencies between packages are respected. For a complete list of which Lerna versions are compatible with which Nx versions, see the Lerna and Nx Version Matrix.","source":"@site/docs/lerna-and-nx.md","sourceDirName":".","slug":"/lerna-and-nx","permalink":"/docs/lerna-and-nx","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/lerna-and-nx.md","tags":[],"version":"current","frontMatter":{"id":"lerna-and-nx","title":"Lerna and Nx","type":"explainer"},"sidebar":"main","previous":{"title":"Getting Started","permalink":"/docs/getting-started"},"next":{"title":"Features","permalink":"/docs/features"}}');var t=s(4848),a=s(8453);const i={id:"lerna-and-nx",title:"Lerna and Nx",type:"explainer"},l="Lerna and Nx",o={},d=[{value:"Lerna",id:"lerna",level:2},{value:"Features",id:"features",level:3},{value:"Cost",id:"cost",level:3},{value:"Set up",id:"set-up",level:3},{value:"Nx",id:"nx",level:2},{value:"Features",id:"features-1",level:3},{value:"Cost",id:"cost-1",level:3},{value:"Set up",id:"set-up-1",level:3},{value:"Nx Cloud",id:"nx-cloud",level:2},{value:"Features",id:"features-2",level:3},{value:"Cost",id:"cost-2",level:3},{value:"Set up",id:"set-up-2",level:3}];function c(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",hr:"hr",li:"li",ol:"ol",p:"p",ul:"ul",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.header,{children:(0,t.jsx)(n.h1,{id:"lerna-and-nx",children:"Lerna and Nx"})}),"\n",(0,t.jsxs)(n.p,{children:["Nrwl (the company behind the open source build system Nx) has taken over ",(0,t.jsx)(n.a,{href:"https://dev.to/nrwl/lerna-is-dead-long-live-lerna-3jal",children:"stewardship of Lerna"}),". ",(0,t.jsx)(n.a,{href:"https://nx.dev",children:"Nx"})," is a build system developed by ex-Googlers and utilizes many of the techniques used by internal Google tools. Lerna uses Nx to detect packages in the workspace and dependencies between them. Lerna defers to Nx's powerful task runner to run scripts, allowing you to run them in parallel, cache results, and distribute them across multiple machines, all while ensuring that dependencies between packages are respected. For a complete list of which Lerna versions are compatible with which Nx versions, see the ",(0,t.jsx)(n.a,{href:"./lerna-and-nx-version-matrix",children:"Lerna and Nx Version Matrix"}),"."]}),"\n",(0,t.jsx)(n.p,{children:"The following is a high level overview of what each tool provides. Lerna can continue to be used by itself, and adding Nx Cloud for free on top can dramatically improve what you're already doing."}),"\n",(0,t.jsx)(n.h2,{id:"lerna",children:"Lerna"}),"\n",(0,t.jsx)(n.h3,{id:"features",children:"Features"}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.a,{href:"./features/version-and-publish",children:"Version"})," - Automatically increment versions of packages, generate changelog information, create GitHub releases etc."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.a,{href:"./features/version-and-publish",children:"Publish"})," - Automatically create tags and publish packages to package registries, such as npm."]}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"cost",children:"Cost"}),"\n",(0,t.jsx)(n.p,{children:"Free and open source"}),"\n",(0,t.jsx)(n.h3,{id:"set-up",children:"Set up"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"npm install lerna"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"npx lerna init"})}),"\n"]}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"nx",children:"Nx"}),"\n",(0,t.jsx)(n.h3,{id:"features-1",children:"Features"}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"./features/run-tasks",children:"Run only tasks affected by a code change"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"./features/run-tasks",children:"Run prerequisite tasks first"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"./features/cache-tasks",children:"Cache task results locally"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"./features/project-graph",children:"Visualize the project graph"})}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.a,{href:"./features/editor-integrations#nx-console-for-vscode",children:"Nx Console"})," - Visual Studio Code plugin"]}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"cost-1",children:"Cost"}),"\n",(0,t.jsx)(n.p,{children:"Free and open source"}),"\n",(0,t.jsx)(n.h3,{id:"set-up-1",children:"Set up"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"npx lerna add-caching"})}),"\n",(0,t.jsx)(n.li,{children:"Continue using Lerna as usual"}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{type:"note",children:(0,t.jsxs)(n.p,{children:["Lerna defers to Nx's power task runner behind the scenes to detect task dependencies. Some options for ",(0,t.jsx)(n.code,{children:"lerna run"})," behave differently than in older versions of Lerna. See ",(0,t.jsx)(n.a,{href:"/docs/lerna6-obsolete-options",children:"Using Lerna (Powered by Nx) to Run Tasks"})," for more details on what differs from older versions of Lerna."]})}),"\n",(0,t.jsx)(n.hr,{}),"\n",(0,t.jsx)(n.h2,{id:"nx-cloud",children:"Nx Cloud"}),"\n",(0,t.jsx)(n.h3,{id:"features-2",children:"Features"}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"./features/cache-tasks",children:"Share cached task results across the organization"})}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.a,{href:"./features/distribute-tasks",children:"Distribute task execution"})," efficiently across agent machines"]}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"cost-2",children:"Cost"}),"\n",(0,t.jsx)(n.p,{children:"Free for open source projects"}),"\n",(0,t.jsx)(n.p,{children:"For closed source repositories, the first 500 computation hours per month are free. Most repositories do not exceed this limit. $1 per computation hour after that."}),"\n",(0,t.jsx)(n.h3,{id:"set-up-2",children:"Set up"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.code,{children:"npx nx connect-to-nx-cloud"})}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"nx generate @nrwl/workspace:ci-workflow"})," (or set up your CI manually)"]}),"\n",(0,t.jsx)(n.li,{children:"Continue using Lerna as usual"}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>l});var r=s(6540);const t={},a=r.createContext(t);function i(e){const n=r.useContext(a);return r.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(t):e.components||t:i(e.components),r.createElement(a.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/517cf5ca.f46010f9.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[868],{8120:(e,n,a)=>{a.r(n),a.d(n,{assets:()=>l,contentTitle:()=>t,default:()=>o,frontMatter:()=>r,metadata:()=>c,toc:()=>h});const c=JSON.parse('{"id":"features/workspace-watching","title":"Workspace Watching","description":"Workspace Watching is available as of Lerna 6.4.0.","source":"@site/docs/features/workspace-watching.md","sourceDirName":"features","slug":"/features/workspace-watching","permalink":"/docs/features/workspace-watching","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/features/workspace-watching.md","tags":[],"version":"current","frontMatter":{"id":"workspace-watching","title":"Workspace Watching","type":"recipe"},"sidebar":"main","previous":{"title":"Editor Integrations","permalink":"/docs/features/editor-integrations"},"next":{"title":"Concepts","permalink":"/docs/concepts"}}');var s=a(4848),i=a(8453);const r={id:"workspace-watching",title:"Workspace Watching",type:"recipe"},t="Workspace Watching",l={},h=[{value:"Examples",id:"examples",level:2},{value:"Watch Environment Variables",id:"watch-environment-variables",level:2},{value:"Running With Package Managers",id:"running-with-package-managers",level:2}];function d(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"workspace-watching",children:"Workspace Watching"})}),"\n",(0,s.jsx)(n.admonition,{type:"note",children:(0,s.jsx)(n.p,{children:"Workspace Watching is available as of Lerna 6.4.0."})}),"\n",(0,s.jsx)(n.p,{children:"Lerna can watch for file changes within packages and automatically execute commands from the root of the repository. This is useful if you need to rebuild packages or rerun tests as you update files during your development workflow."}),"\n",(0,s.jsx)(n.p,{children:"This replaces the need to manually set up watching for each package individually."}),"\n",(0,s.jsx)(n.h2,{id:"examples",children:"Examples"}),"\n",(0,s.jsx)(n.p,{children:"Watch all packages and echo the package name and the files that changed:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-sh",children:"$ lerna watch -- echo \\$LERNA_PACKAGE_NAME \\$LERNA_FILE_CHANGES\n"})}),"\n",(0,s.jsx)(n.p,{children:'Watch all packages and run the "build" script on a package when a file within it changes:'}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-sh",children:"$ lerna watch -- lerna run build --scope=\\$LERNA_PACKAGE_NAME\n"})}),"\n",(0,s.jsx)(n.p,{children:'Watch all packages and run the "build" script on everything affected by the changes:'}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-sh",children:"$ lerna watch -- lerna run build --since\n"})}),"\n",(0,s.jsx)(n.p,{children:'Watch a single package and run the "build" script on it when a file within it changes:'}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-sh",children:'$ lerna watch --scope="my-package-1" -- lerna run build --scope=\\$LERNA_PACKAGE_NAME\n'})}),"\n",(0,s.jsx)(n.p,{children:'Watch a single package and its dependencies, running the "build" script on any of them that change:'}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-sh",children:'$ lerna watch --scope="my-package-1" --include-dependencies -- lerna run build --scope=\\$LERNA_PACKAGE_NAME\n'})}),"\n",(0,s.jsxs)(n.p,{children:["Watch all packages and run the ",(0,s.jsx)(n.code,{children:"build"})," script for the package that changed and all packages that depend on it:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-sh",children:"$ lerna watch -- lerna run build --scope=\\$LERNA_PACKAGE_NAME --include-dependents\n"})}),"\n",(0,s.jsxs)(n.p,{children:["For more advanced filtering, see the ",(0,s.jsx)(n.a,{href:"https://lerna.js.org/docs/api-reference/commands#filter-options",children:"filter options"})," documentation. For more available options, see the ",(0,s.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/packages/lerna/src/commands/watch#lerna-watch",children:(0,s.jsx)(n.code,{children:"lerna watch"})})," documentation."]}),"\n",(0,s.jsx)(n.h2,{id:"watch-environment-variables",children:"Watch Environment Variables"}),"\n",(0,s.jsxs)(n.p,{children:["Lerna will set the environment variables ",(0,s.jsx)(n.code,{children:"$LERNA_PACKAGE_NAME"})," and ",(0,s.jsx)(n.code,{children:"$LERNA_FILE_CHANGES"})," when running the inner command. These can be used to customize the command that is run."]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"$LERNA_PACKAGE_NAME"})," will be replaced with the name of the package that changed."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"$LERNA_FILE_CHANGES"})," will be replaced with the file(s) that changed. If multiple file changes are detected in one cycle, then ",(0,s.jsx)(n.code,{children:"$LERNA_FILE_CHANGES"})," will list them all, separated by spaces."]}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{type:"note",children:(0,s.jsxs)(n.p,{children:["When using ",(0,s.jsx)(n.code,{children:"$LERNA_PACKAGE_NAME"})," and ",(0,s.jsx)(n.code,{children:"$LERNA_FILE_CHANGES"}),", you will need to escape the ",(0,s.jsx)(n.code,{children:"$"})," with a backslash (",(0,s.jsx)(n.code,{children:"\\"}),"). See the ",(0,s.jsx)(n.a,{href:"#examples",children:"examples"})," above."]})}),"\n",(0,s.jsx)(n.h2,{id:"running-with-package-managers",children:"Running With Package Managers"}),"\n",(0,s.jsxs)(n.p,{children:["The examples above showcase using ",(0,s.jsx)(n.code,{children:"lerna"})," directly in the terminal. However, you can also use ",(0,s.jsx)(n.code,{children:"lerna"})," via a package manager without adding it to your path:"]}),"\n",(0,s.jsx)(n.p,{children:"pnpm:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-sh",children:"pnpm lerna watch -- lerna run build --scope=\\$LERNA_PACKAGE_NAME\n"})}),"\n",(0,s.jsx)(n.p,{children:"yarn:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-sh",children:"yarn lerna -- watch -- lerna run build --scope=\\$LERNA_PACKAGE_NAME\n"})}),"\n",(0,s.jsx)(n.p,{children:"npx:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-sh",children:"npx -c 'lerna watch -- lerna run build --scope=\\$LERNA_PACKAGE_NAME'\n"})}),"\n",(0,s.jsx)(n.admonition,{type:"note",children:(0,s.jsxs)(n.p,{children:["When using ",(0,s.jsx)(n.code,{children:"npx"}),", you will need to use ",(0,s.jsx)(n.code,{children:"-c"})," and surround the entire ",(0,s.jsx)(n.code,{children:"lerna watch"})," command in single quotes (",(0,s.jsx)(n.code,{children:"'"}),"). Without this, ",(0,s.jsx)(n.code,{children:"npx"})," will try to replace the ",(0,s.jsx)(n.a,{href:"#watch-environment-variables",children:"watch environment variables"})," before passing the command to ",(0,s.jsx)(n.code,{children:"lerna"}),", resulting in an always empty value for ",(0,s.jsx)(n.code,{children:"$LERNA_PACKAGE_NAME"})," and ",(0,s.jsx)(n.code,{children:"$LERNA_FILE_CHANGES"}),"."]})}),"\n",(0,s.jsxs)(n.admonition,{type:"note",children:[(0,s.jsx)(n.p,{children:"If you use Lerna in Windows, you must frame environment variables in '%'. For example:"}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-sh",children:"$ lerna watch -- lerna run build --scope=%LERNA_PACKAGE_NAME% --include-dependents\n"})})]})]})}function o(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,n,a)=>{a.d(n,{R:()=>r,x:()=>t});var c=a(6540);const s={},i=c.createContext(s);function r(e){const n=c.useContext(i);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function t(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:r(e.components),c.createElement(i.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/5e95c892.b114d62c.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[647],{8122:(e,s,r)=>{r.r(s),r.d(s,{default:()=>l});r(6540);var t=r(4164),u=r(1769),a=r(204),c=r(2831),n=r(6316),i=r(4848);function l(e){return(0,i.jsx)(u.e3,{className:(0,t.A)(a.G.wrapper.docsPages),children:(0,i.jsx)(n.A,{children:(0,c.v)(e.route.routes)})})}}}]);
--------------------------------------------------------------------------------
/assets/js/714aece2.fb172a94.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[147],{1601:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>a,contentTitle:()=>c,default:()=>h,frontMatter:()=>t,metadata:()=>o,toc:()=>d});const o=JSON.parse('{"id":"concepts/configuring-published-files","title":"Configuring Published Files","description":"When publishing a package to a registry, the default is to publish everything in the package\'s source directory. This is not always optimal, since there are often files only relevant for development, such as tests and configuration files, and it could be that you first compile your source files and output them to a centralized location in a monorepo setup.","source":"@site/docs/concepts/configuring-published-files.md","sourceDirName":"concepts","slug":"/concepts/configuring-published-files","permalink":"/docs/concepts/configuring-published-files","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/concepts/configuring-published-files.md","tags":[],"version":"current","frontMatter":{"id":"configuring-published-files","title":"Configuring Published Files","type":"explainer"},"sidebar":"main","previous":{"title":"Distributed Task Execution Guide","permalink":"/docs/concepts/dte-guide"},"next":{"title":"Using pnpm with Lerna","permalink":"/docs/recipes/using-pnpm-with-lerna"}}');var s=i(4848),r=i(8453);const t={id:"configuring-published-files",title:"Configuring Published Files",type:"explainer"},c="Configuring Published Files",a={},d=[{value:""files"
and .gitignore",id:"files-and-gitignore",level:2},{value:"--contents
[legacy -> prefer --directory
]",id:"--contents-legacy---prefer---directory",level:2},{value:"--directory
",id:"--directory",level:2}];function l(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"configuring-published-files",children:"Configuring Published Files"})}),"\n",(0,s.jsx)(n.p,{children:"When publishing a package to a registry, the default is to publish everything in the package's source directory. This is not always optimal, since there are often files only relevant for development, such as tests and configuration files, and it could be that you first compile your source files and output them to a centralized location in a monorepo setup."}),"\n",(0,s.jsx)(n.p,{children:"Lerna provides a number of configuration options to ensure that only the appropriate files are packed and published to a registry."}),"\n",(0,s.jsxs)(n.h2,{id:"files-and-gitignore",children:[(0,s.jsx)(n.code,{children:'"files"'})," and .gitignore"]}),"\n",(0,s.jsxs)(n.p,{children:['Lerna always publishes using npm\'s tooling, and it has a few built in ways to include or exclude files. The easiest way to configure which files are included in the published package are via the "files" property in ',(0,s.jsx)(n.code,{children:"package.json"})," and ",(0,s.jsx)(n.code,{children:".gitignore"}),". See the ",(0,s.jsx)(n.a,{href:"https://docs.npmjs.com/cli/v7/commands/npm-publish#files-included-in-package",children:"npm documentation"})," for more information on how npm recognizes files for publishing."]}),"\n",(0,s.jsxs)(n.h2,{id:"--contents-legacy---prefer---directory",children:[(0,s.jsx)(n.code,{children:"--contents"})," [legacy -> prefer ",(0,s.jsx)(n.code,{children:"--directory"}),"]"]}),"\n",(0,s.jsxs)(n.p,{children:["A number of commands, including ",(0,s.jsx)(n.code,{children:"lerna publish"}),", support a generalized ",(0,s.jsx)(n.code,{children:"--contents"})," option, which sets the directory to publish for ALL packages."]}),"\n",(0,s.jsxs)(n.p,{children:["This is only useful for publishing if the packages in your monorepo have a simplistic, uniform output structure. The argument passed to ",(0,s.jsx)(n.code,{children:"--contents"})," must be a subdirectory that exists within every package being published. See the ",(0,s.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/publish#--contents-dir",children:"lerna publish documentation"})," for details."]}),"\n",(0,s.jsxs)(n.p,{children:["In v7, we introduced a more powerful, more focused ",(0,s.jsx)(n.code,{children:"--directory"})," option for ",(0,s.jsx)(n.code,{children:"lerna publish"}),". Please prefer that over the ",(0,s.jsx)(n.code,{children:"--contents"})," option, which will likely be deprecated in future."]}),"\n",(0,s.jsx)(n.h2,{id:"--directory",children:(0,s.jsx)(n.code,{children:"--directory"})}),"\n",(0,s.jsxs)(n.p,{children:["In v7, we introduced a more powerful, more focused ",(0,s.jsx)(n.code,{children:"--directory"})," option for ",(0,s.jsx)(n.code,{children:"lerna publish"}),"."]}),"\n",(0,s.jsxs)(n.p,{children:["It can be configured in your ",(0,s.jsx)(n.code,{children:"lerna.json"})," and supports using the following dynamic placeholders: ",(0,s.jsx)(n.code,{children:"{workspaceRoot}"}),", ",(0,s.jsx)(n.code,{children:"{projectRoot}"}),", ",(0,s.jsx)(n.code,{children:"{projectName}"}),". These values will be dynamically replaced at publish time."]}),"\n",(0,s.jsx)(n.p,{children:"This means you can now succinctly express setups which are uniform in terms of their style, but not literally identical across all packages."}),"\n",(0,s.jsx)(n.p,{children:"For example, let's say we have a monorepo where we build all packages and their outputs are set to go to a centralized location (as is common in Nx workspaces, for example):"}),"\n",(0,s.jsxs)(n.p,{children:["We have ",(0,s.jsx)(n.code,{children:"packages/package-a"})," which writes its build output to ",(0,s.jsx)(n.code,{children:"dist/packages/package-a"}),", and ",(0,s.jsx)(n.code,{children:"packages/package-b"})," which writes its build output to ",(0,s.jsx)(n.code,{children:"dist/packages/package-b"}),"."]}),"\n",(0,s.jsx)(n.p,{children:"Even though the paths are strictly different, we have a consistent approach we can now express using the placeholders:"}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.code,{children:"{workspaceRoot}/dist/{projectRoot}"})}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"{workspaceRoot}"})," will be replaced by the absolute path to our lerna repo, and ",(0,s.jsx)(n.code,{children:"{projectRoot}"})," will be replace by ",(0,s.jsx)(n.code,{children:"packages/package-a"})," in the case of ",(0,s.jsx)(n.code,{children:"package-a"}),", and ",(0,s.jsx)(n.code,{children:"packages/package-b"})," in the case of ",(0,s.jsx)(n.code,{children:"package-b"}),"."]}),"\n",(0,s.jsxs)(n.p,{children:["The way we apply that in the ",(0,s.jsx)(n.code,{children:"lerna.json"})," is as follows:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'// lerna.json\n{\n "version": "1.0.0",\n "command": {\n "publish": {\n "directory": "{workspaceRoot}/dist/{projectRoot}"\n }\n }\n}\n'})}),"\n",(0,s.jsxs)(n.p,{children:["You can also set or override the publish directory option within a package's ",(0,s.jsx)(n.code,{children:"package.json"}),", if you need to something completely custom for that particular package."]}),"\n",(0,s.jsxs)(n.p,{children:["An example configuration for a package that publishes from a ",(0,s.jsx)(n.code,{children:"dist/packages/foo"})," folder in the root of the repo:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'// packages/foo/package.json\n{\n "name": "foo",\n "version": "1.0.0",\n "lerna": {\n "command": {\n "publish": {\n "directory": "../../dist/packages/foo"\n }\n }\n }\n}\n'})}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["You will need to make sure that your custom directory location contains a valid ",(0,s.jsx)(n.code,{children:"package.json"})," which will be used for the registry publish. You could create this via a lifecycle script such as ",(0,s.jsx)(n.code,{children:"prepare"}),", ",(0,s.jsx)(n.code,{children:"prepublishOnly"}),", or ",(0,s.jsx)(n.code,{children:"prepack"})," if you need more complex custom logic involved, or simply have it copied for you from the package's source automatically by configuring it as an asset. See the upcoming section on ",(0,s.jsx)(n.strong,{children:"Including Additional Assets in Published Packages"})," for full details."]})}),"\n",(0,s.jsx)(n.p,{children:"If you wanted to make one of your packages behave like a standard lerna package and publish from source, you could override its publish config like so:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'// packages/foo/package.json\n{\n "name": "foo",\n "version": "1.0.0",\n "lerna": {\n "command": {\n "publish": {\n "directory": "."\n }\n }\n }\n}\n'})}),"\n",(0,s.jsx)(n.h1,{id:"including-additional-assets-in-published-packages",children:"Including Additional Assets in Published Packages"}),"\n",(0,s.jsxs)(n.p,{children:["Lerna can copy files from your source directory to the directory specified for publishing. Just as with the ",(0,s.jsx)(n.code,{children:"directory"})," option, this can be configured in the ",(0,s.jsx)(n.code,{children:"lerna.json"})," (including using dynamic placeholders within asset definitions), or within the ",(0,s.jsx)(n.code,{children:"package.json"})," of a particular package."]}),"\n",(0,s.jsxs)(n.p,{children:["Regardless of which file it is configured in, the ",(0,s.jsx)(n.code,{children:'"assets"'})," property should be an array of glob patterns or objects with a ",(0,s.jsx)(n.code,{children:'"from"'})," and ",(0,s.jsx)(n.code,{children:'"to"'})," property. The ",(0,s.jsx)(n.code,{children:'"from"'})," property should be a specific file or glob pattern that matches files in the source directory, and the ",(0,s.jsx)(n.code,{children:'"to"'})," property is the path to copy the file to within the publish directory."]}),"\n",(0,s.jsxs)(n.p,{children:["This example package builds its output to a root ",(0,s.jsx)(n.code,{children:"dist/packages/bar"})," directory. Lerna is configured to copy additional files to this directory, then publish the contents of ",(0,s.jsx)(n.code,{children:"dist/packages/bar"})," to npm."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'// packages/bar/package.json\n{\n "name": "bar",\n "version": "1.0.0",\n "lerna": {\n "command": {\n "publish": {\n "directory": "../../dist/packages/bar",\n "assets": [\n "README.md",\n "package.json",\n "docs/*.md",\n {\n "from": "static/images/*",\n "to": "assets"\n },\n {\n "from": "../../CONTRIBUTING.md",\n "to": "./"\n }\n ]\n }\n }\n }\n}\n'})}),"\n",(0,s.jsx)(n.p,{children:"Lerna will consume the above configuration and copy the appropriate files to the dist directory, producing a structure like this:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"dist/packages/bar\n\u251c\u2500\u2500 assets\n\u2502 \u251c\u2500\u2500 my-image-1.png\n\u2502 \u2514\u2500\u2500 my-image-2.png\n\u251c\u2500\u2500 CONTRIBUTING.md\n\u251c\u2500\u2500 docs\n\u2502 \u251c\u2500\u2500 my-doc-1.md\n\u2502 \u2514\u2500\u2500 my-doc-2.md\n\u251c\u2500\u2500 package.json\n\u2514\u2500\u2500 README.md\n"})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}},8453:(e,n,i)=>{i.d(n,{R:()=>t,x:()=>c});var o=i(6540);const s={},r=o.createContext(s);function t(e){const n=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:t(e.components),o.createElement(r.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/809.65d2179a.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[809],{1809:(e,s,b)=>{b.r(s)}}]);
--------------------------------------------------------------------------------
/assets/js/85d9af9a.d977e4ad.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[148],{3340:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>i,default:()=>l,frontMatter:()=>r,metadata:()=>a,toc:()=>h});const a=JSON.parse('{"id":"features/cache-tasks","title":"Cache Task Results","description":"When it comes to running tasks, caching etc., Lerna and Nx can be used interchangeably. When we say \\"Lerna can cache","source":"@site/docs/features/cache-tasks.md","sourceDirName":"features","slug":"/features/cache-tasks","permalink":"/docs/features/cache-tasks","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/features/cache-tasks.md","tags":[],"version":"current","frontMatter":{"id":"cache-tasks","title":"Cache Task Results","type":"recipe"},"sidebar":"main","previous":{"title":"Run Tasks","permalink":"/docs/features/run-tasks"},"next":{"title":"Share Your Cache","permalink":"/docs/features/share-your-cache"}}');var s=n(4848),c=n(8453);const r={id:"cache-tasks",title:"Cache Task Results",type:"recipe"},i="Cache Task Results",o={},h=[{value:"Setup",id:"setup",level:2},{value:"Replaying from Cache",id:"replaying-from-cache",level:2},{value:"Advanced Caching",id:"advanced-caching",level:2},{value:"Local Computation Caching",id:"local-computation-caching",level:2}];function d(e){const t={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.header,{children:(0,s.jsx)(t.h1,{id:"cache-task-results",children:"Cache Task Results"})}),"\n",(0,s.jsxs)(t.blockquote,{children:["\n",(0,s.jsx)(t.p,{children:'When it comes to running tasks, caching etc., Lerna and Nx can be used interchangeably. When we say "Lerna can cache\nbuilds", we mean that Lerna uses Nx which can cache builds.'}),"\n"]}),"\n",(0,s.jsx)(t.p,{children:"It's costly to rebuild and retest the same code over and over again. Lerna uses a computation cache to never rebuild the\nsame code twice."}),"\n",(0,s.jsx)(t.h2,{id:"setup",children:"Setup"}),"\n",(0,s.jsx)(t.p,{children:"Lerna via Nx has the most sophisticated and battle-tested computation caching system. It knows when the task you are\nabout to run has been executed before, so it can use the cache to restore the results of running that task."}),"\n",(0,s.jsx)(t.admonition,{type:"tip",children:(0,s.jsxs)(t.p,{children:["If you don't have ",(0,s.jsx)(t.code,{children:"nx.json"}),", run ",(0,s.jsx)(t.code,{children:"npx lerna add-caching"}),"."]})}),"\n",(0,s.jsxs)(t.p,{children:["To enable caching for ",(0,s.jsx)(t.code,{children:"build"})," and ",(0,s.jsx)(t.code,{children:"test"}),", edit the ",(0,s.jsx)(t.code,{children:"targetDefaults"})," property in ",(0,s.jsx)(t.code,{children:"nx.json"})," to include the ",(0,s.jsx)(t.code,{children:"build"})," and ",(0,s.jsx)(t.code,{children:"test"})," tasks:"]}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-json",metastring:'title="nx.json"',children:'{\n "targetDefaults": {\n "build": {\n "cache": true\n },\n "test": {\n "cache": true\n }\n }\n}\n'})}),"\n",(0,s.jsx)(t.admonition,{type:"info",children:(0,s.jsx)(t.p,{children:"Note, cacheable operations need to be side effect free, meaning that given the same input they should always result in\nthe same output. As an example, e2e test runs that hit the backend API cannot be cached as the backend might influence\nthe result of the test run."})}),"\n",(0,s.jsx)(t.p,{children:"Now, run the following command twice. The second time the operation will be instant:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-bash",children:"lerna run build --scope=header\n"})}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-bash",metastring:'title="Terminal Output"',children:"> lerna run build --scope=header\n\n> header:build [existing outputs match the cache, left as is]\n\n> header@0.0.0 build\n> rimraf dist && rollup --config\n\n\nsrc/index.tsx \u2192 dist...\ncreated dist in 858ms\n\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\n\nLerna (powered by Nx) Successfully ran target test for project header (4ms)\n\n Nx read the output from the cache instead of running the command for 1 out of 1 tasks.\n"})}),"\n",(0,s.jsx)(t.h2,{id:"replaying-from-cache",children:"Replaying from Cache"}),"\n",(0,s.jsxs)(t.p,{children:["When Lerna determines that the inputs for a task have not changed, it recreates the outputs of that task as if it actually ran on your machine - but much faster. The outputs of a cached task include both the terminal output and the files created in the defined ",(0,s.jsx)(t.code,{children:"output"})," directories for that task."]}),"\n",(0,s.jsxs)(t.p,{children:["You can test this out by deleting the ",(0,s.jsx)(t.code,{children:"dist"})," folder that the ",(0,s.jsx)(t.code,{children:"header:build"})," task outputs to and then running ",(0,s.jsx)(t.code,{children:"lerna run build --scope=header"})," again. The cached task will replay instantly and the correct files will be present in the ",(0,s.jsx)(t.code,{children:"dist"})," folder."]}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-treeview",children:"header/\n\u2514\u2500\u2500 dist/ <-- this folder gets recreated\n"})}),"\n",(0,s.jsxs)(t.p,{children:["If your task creates output artifacts in a different location, you can ",(0,s.jsx)(t.a,{href:"https://nx.dev/reference/project-configuration#outputs",children:"change the output folder(s)"})," that are cached. You can also ",(0,s.jsx)(t.a,{href:"https://nx.dev/more-concepts/customizing-inputs",children:"customize which inputs"})," will invalidate the cache if they are changed."]}),"\n",(0,s.jsx)(t.h2,{id:"advanced-caching",children:"Advanced Caching"}),"\n",(0,s.jsxs)(t.p,{children:["For a more in-depth understanding of the caching implementation and to fine-tune the caching for your repo, read ",(0,s.jsx)(t.a,{href:"../concepts/how-caching-works",children:"How Caching Works"}),"."]}),"\n",(0,s.jsx)(t.h2,{id:"local-computation-caching",children:"Local Computation Caching"}),"\n",(0,s.jsxs)(t.p,{children:["By default, Lerna (via Nx) uses a local computation cache. Nx stores the cached values only for a week, after which they\nare deleted. To clear the cache run ",(0,s.jsx)(t.code,{children:"nx reset"}),", and Nx will create a new one the next time it tries to access it."]})]})}function l(e={}){const{wrapper:t}={...(0,c.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>r,x:()=>i});var a=n(6540);const s={},c=a.createContext(s);function r(e){const t=a.useContext(c);return a.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:r(e.components),a.createElement(c.Provider,{value:t},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/913.f65583d1.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[913],{8913:(e,s,b)=>{b.r(s)}}]);
--------------------------------------------------------------------------------
/assets/js/9b50cbb9.6e738715.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[769],{1371:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>t,default:()=>h,frontMatter:()=>o,metadata:()=>i,toc:()=>c});const i=JSON.parse('{"id":"features/version-and-publish","title":"Version and Publish","description":"Lerna can increment your package\'s versions as well as publish your packages to NPM, and it provides a variety of options to make sure any workflow can be accommodated.","source":"@site/docs/features/version-and-publish.md","sourceDirName":"features","slug":"/features/version-and-publish","permalink":"/docs/features/version-and-publish","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/features/version-and-publish.md","tags":[],"version":"current","frontMatter":{"id":"version-and-publish","title":"Version and Publish","type":"explainer"},"sidebar":"main","previous":{"title":"Distribute Task Execution","permalink":"/docs/features/distribute-tasks"},"next":{"title":"Editor Integrations","permalink":"/docs/features/editor-integrations"}}');var a=s(4848),r=s(8453);const o={id:"version-and-publish",title:"Version and Publish",type:"explainer"},t="Version and Publish",l={},c=[{value:"Versioning",id:"versioning",level:2},{value:"Publishing to NPM",id:"publishing-to-npm",level:2},{value:"from-package",id:"from-package",level:3},{value:"Versioning strategies",id:"versioning-strategies",level:2},{value:"Fixed/Locked mode (default)",id:"fixedlocked-mode-default",level:3},{value:"Synchronized Versions",id:"synchronized-versions",level:4},{value:"Independent mode",id:"independent-mode",level:3}];function d(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",h4:"h4",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,r.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.header,{children:(0,a.jsx)(n.h1,{id:"version-and-publish",children:"Version and Publish"})}),"\n",(0,a.jsx)(n.p,{children:"Lerna can increment your package's versions as well as publish your packages to NPM, and it provides a variety of options to make sure any workflow can be accommodated."}),"\n",(0,a.jsxs)(n.p,{children:["To show how Lerna does it, we will look at ",(0,a.jsx)(n.a,{href:"https://github.com/lerna/getting-started-example",children:"this repository"}),"."]}),"\n",(0,a.jsxs)(n.blockquote,{children:["\n",(0,a.jsx)(n.p,{children:"If you learn better by doing, clone the repo and follow along."}),"\n"]}),"\n",(0,a.jsx)(n.p,{children:"The repo contains three packages or projects:"}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"header"})," (a library of React components)"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"footer"})," (a library of React components)"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"remixapp"})," (an app written using the Remix framework which depends on both ",(0,a.jsx)(n.code,{children:"header"})," and ",(0,a.jsx)(n.code,{children:"footer"}),")"]}),"\n"]}),"\n",(0,a.jsxs)(n.p,{children:["We are going to publish the ",(0,a.jsx)(n.code,{children:"header"})," and the ",(0,a.jsx)(n.code,{children:"footer"})," packages."]}),"\n",(0,a.jsxs)(n.blockquote,{children:["\n",(0,a.jsxs)(n.p,{children:["It's common to publish only a subset of the projects. Some projects can be private (e.g., used only for tests), some\ncan be demo apps. In this repo, ",(0,a.jsx)(n.code,{children:"remixapp"}),' isn\'t "private" in the sense of not wanting people to see the source files, it is just using the ',(0,a.jsx)(n.code,{children:'"private": true'})," setting in order to not get published to NPM."]}),"\n"]}),"\n",(0,a.jsx)(n.h2,{id:"versioning",children:"Versioning"}),"\n",(0,a.jsxs)(n.p,{children:["Lerna comes with a ",(0,a.jsx)(n.code,{children:"version"})," command that allows you to increment your package's version number, commit the changes and tag them accordingly."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"lerna version --no-private\n"})}),"\n",(0,a.jsx)(n.p,{children:"you'll get the following output:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"lerna notice cli v5.1.2\nlerna info current version 1.0.0\nlerna info Assuming all packages changed\n? Select a new version (currently 1.0.0) (Use arrow keys)\n\u276f Patch (1.0.1)\n Minor (1.1.0)\n Major (2.0.0)\n Prepatch (1.0.1-alpha.0)\n Preminor (1.1.0-alpha.0)\n Premajor (2.0.0-alpha.0)\n Custom Prerelease\n Custom Version\n"})}),"\n",(0,a.jsx)(n.admonition,{type:"info",children:(0,a.jsxs)(n.p,{children:["Note that by passing ",(0,a.jsx)(n.code,{children:"--no-private"})," we exclude all packages that are marked ",(0,a.jsx)(n.code,{children:"private"})," in their ",(0,a.jsx)(n.code,{children:"package.json"})," file."]})}),"\n",(0,a.jsxs)(n.p,{children:["Lerna detects the current packages, identifies the current version and proposes the next one to choose. Note, you can also pass a semver bump directly like ",(0,a.jsx)(n.code,{children:"lerna version 1.0.0"}),". More on the ",(0,a.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/version#readme",children:"version docs details"}),". Once a given version is chosen, Lerna updates the ",(0,a.jsx)(n.code,{children:"package.json"})," with the version number, commits the change, adds a corresponding version tag (e.g. ",(0,a.jsx)(n.code,{children:"v1.0.0"}),") and pushes the commit and the tag to the remote repository."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-json",metastring:'title="packages/footer/package.json"',children:'{\n "name": "footer",\n "version": "1.0.1",\n "main": "dist/index.js",\n ...\n}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Note the above operation does not push the package to any NPM repository. If instead we also want Lerna to take care of the publishing process, we can use ",(0,a.jsx)(n.code,{children:"lerna publish"})," instead."]}),"\n",(0,a.jsx)(n.admonition,{type:"info",children:(0,a.jsxs)(n.p,{children:["Lerna uses the ",(0,a.jsx)(n.code,{children:"version"})," property in ",(0,a.jsx)(n.code,{children:"lerna.json"})," to determine the currently used version"]})}),"\n",(0,a.jsx)(n.h2,{id:"publishing-to-npm",children:"Publishing to NPM"}),"\n",(0,a.jsx)(n.p,{children:"If we run"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"lerna publish --no-private\n"})}),"\n",(0,a.jsxs)(n.p,{children:["Lerna executes the version incrementing workflow (same as ",(0,a.jsx)(n.code,{children:"lerna version"}),") and in addition also pushes the packages to NPM. You should get the following output:"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",metastring:'title="Terminal Output"',children:"lerna notice cli v5.1.2\nlerna info current version 1.0.0\nlerna info Assuming all packages changed\n? Select a new version (currently 1.0.0) Patch (1.0.1)\n\nChanges:\n - footer: 1.0.0 => 1.0.1\n - header: 1.0.0 => 1.0.1\n\n? Are you sure you want to publish these packages? Yes\nlerna info execute Skipping releases\nlerna info git Pushing tags...\nlerna info publish Publishing packages to npm...\n...\nlerna success published header 1.0.1\n...\nlerna success published footer 1.0.1\n...\nSuccessfully published:\n - footer@1.0.1\n - header@1.0.1\nlerna success published 2 packages\n"})}),"\n",(0,a.jsx)(n.h3,{id:"from-package",children:"from-package"}),"\n",(0,a.jsxs)(n.p,{children:["Another way Lerna can determine which packages to publish is with ",(0,a.jsx)(n.code,{children:"from-package"}),". Lerna will compare the version of every package in the repository with the version of it that is published to npm. For each package that has a version that is greater than the published version, Lerna will publish that package to npm."]}),"\n",(0,a.jsxs)(n.p,{children:["This mode does not explicitly require that the packages have been versioned with ",(0,a.jsx)(n.code,{children:"lerna version"}),", which makes it great for workspaces that have their own versioning scripts."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"lerna publish from-package\n"})}),"\n",(0,a.jsx)(n.admonition,{type:"info",children:(0,a.jsxs)(n.p,{children:["Lerna ",(0,a.jsx)(n.em,{children:"always"})," uses ",(0,a.jsx)(n.code,{children:"npm"})," to publish packages. If you use a package manager other than ",(0,a.jsx)(n.code,{children:"npm"}),", you will need to still add the appropriate publishing configuration to ",(0,a.jsx)(n.code,{children:".npmrc"}),", even if ",(0,a.jsx)(n.code,{children:"npmClient"})," is set to something other than ",(0,a.jsx)(n.code,{children:"npm"})," in ",(0,a.jsx)(n.code,{children:"lerna.json"}),"."]})}),"\n",(0,a.jsx)(n.h2,{id:"versioning-strategies",children:"Versioning strategies"}),"\n",(0,a.jsx)(n.p,{children:"Lerna allows you to manage your project using one of two modes: Fixed or Independent."}),"\n",(0,a.jsx)(n.h3,{id:"fixedlocked-mode-default",children:"Fixed/Locked mode (default)"}),"\n",(0,a.jsxs)(n.p,{children:["Fixed mode Lerna projects operate on a single version line. The version is kept in the ",(0,a.jsx)(n.code,{children:"lerna.json"})," file at the root of your project under the ",(0,a.jsx)(n.code,{children:"version"})," key. When you run ",(0,a.jsx)(n.code,{children:"lerna publish"}),", if a package has been updated since the last time a release was made, it will be updated to the new version you're releasing. This means that you only publish a new version of a package when you need to."]}),"\n",(0,a.jsxs)(n.blockquote,{children:["\n",(0,a.jsxs)(n.p,{children:["Note: If you have a major version zero, all updates are ",(0,a.jsx)(n.a,{href:"https://semver.org/#spec-item-4",children:"considered breaking"}),". Because of that, running ",(0,a.jsx)(n.code,{children:"lerna publish"})," with a major version zero and choosing any non-prerelease version number will cause new versions to be published for all packages, even if not all packages have changed since the last release."]}),"\n"]}),"\n",(0,a.jsx)(n.p,{children:"Use this if you want to automatically tie all package versions together. One issue with this approach is that a major change in any package will result in all packages having a new major version."}),"\n",(0,a.jsx)(n.h4,{id:"synchronized-versions",children:"Synchronized Versions"}),"\n",(0,a.jsxs)(n.p,{children:["Lerna will only version and publish packages that have changed since the previous release, causing package versions to drift apart over time. To prevent this, use the ",(0,a.jsx)(n.code,{children:"--force-publish"})," option with ",(0,a.jsx)(n.code,{children:"lerna version"}),". This will force Lerna to always version all packages, regardless of if they have changed since the previous release. Then they will all be published to the registry by ",(0,a.jsx)(n.code,{children:"lerna publish from-git"}),". As a result, all package versions will stay synchronized to the version in ",(0,a.jsx)(n.code,{children:"lerna.json"}),"."]}),"\n",(0,a.jsx)(n.h3,{id:"independent-mode",children:"Independent mode"}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.code,{children:"npx lerna init --independent"})}),"\n",(0,a.jsx)(n.p,{children:"Independent mode Lerna projects allows maintainers to increment package versions independently of each other. Each time you publish, you will get a prompt for each package that has changed to specify if it's a patch, minor, major or custom change."}),"\n",(0,a.jsxs)(n.p,{children:["Independent mode allows you to more specifically update versions for each package and makes sense for a group of components. Combining this mode with something like ",(0,a.jsx)(n.a,{href:"https://github.com/semantic-release/semantic-release",children:"semantic-release"})," would make it less painful. (There is work on this already at ",(0,a.jsx)(n.a,{href:"https://github.com/atlassian/lerna-semantic-release",children:"atlassian/lerna-semantic-release"}),")."]}),"\n",(0,a.jsxs)(n.blockquote,{children:["\n",(0,a.jsxs)(n.p,{children:["Set the ",(0,a.jsx)(n.code,{children:"version"})," key in ",(0,a.jsx)(n.code,{children:"lerna.json"})," to ",(0,a.jsx)(n.code,{children:"independent"})," to run in independent mode."]}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(d,{...e})}):d(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>t});var i=s(6540);const a={},r=i.createContext(a);function o(e){const n=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function t(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/9d9f8394.7408c5eb.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[13],{269:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>a,contentTitle:()=>l,default:()=>d,frontMatter:()=>r,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"troubleshooting","title":"Troubleshooting","description":"This document contains solutions for certain issues our users encountered","source":"@site/docs/troubleshooting.md","sourceDirName":".","slug":"/troubleshooting","permalink":"/docs/troubleshooting","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/troubleshooting.md","tags":[],"version":"current","frontMatter":{"id":"troubleshooting","title":"Troubleshooting","type":"recipe"},"sidebar":"main","previous":{"title":"Lerna 6: Obsolete Options","permalink":"/docs/lerna6-obsolete-options"}}');var s=i(4848),o=i(8453);const r={id:"troubleshooting",title:"Troubleshooting",type:"recipe"},l="Troubleshooting",a={},c=[{value:"Import Command",id:"import-command",level:2},{value:"Buffer problems during import",id:"buffer-problems-during-import",level:3},{value:"Solution:",id:"solution",level:4},{value:"Merge conflict commits cannot be imported",id:"merge-conflict-commits-cannot-be-imported",level:3},{value:"Solution",id:"solution-1",level:4},{value:"Failing when git tree has uncommitted changes",id:"failing-when-git-tree-has-uncommitted-changes",level:3},{value:"Solution",id:"solution-2",level:4},{value:"Publish Command",id:"publish-command",level:2},{value:"Publish does not detect manually created tags in fixed mode with Github/Github Enterprise",id:"publish-does-not-detect-manually-created-tags-in-fixed-mode-with-githubgithub-enterprise",level:3},{value:"Solution:",id:"solution-3",level:4},{value:"Publishing to a private npm registry (Artifactory, npm Enterprise, etc)",id:"publishing-to-a-private-npm-registry-artifactory-npm-enterprise-etc",level:3},{value:"Jest / Visual Studio Code Debugging",id:"jest--visual-studio-code-debugging",level:2}];function h(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",h4:"h4",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"troubleshooting",children:"Troubleshooting"})}),"\n",(0,s.jsx)(n.p,{children:"This document contains solutions for certain issues our users encountered\nin the past while using Lerna."}),"\n",(0,s.jsx)(n.h2,{id:"import-command",children:"Import Command"}),"\n",(0,s.jsx)(n.h3,{id:"buffer-problems-during-import",children:"Buffer problems during import"}),"\n",(0,s.jsx)(n.p,{children:"When you try to import a repository which has many commits in it there is a\nchance that you get an error such as:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"DeprecationWarning: Unhandled promise rejections are deprecated\n"})}),"\n",(0,s.jsx)(n.p,{children:"or"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"Error: spawnSync /bin/sh ENOBUFS during ImportCommand.execute\n"})}),"\n",(0,s.jsx)(n.h4,{id:"solution",children:"Solution:"}),"\n",(0,s.jsxs)(n.p,{children:["Run ",(0,s.jsx)(n.code,{children:"lerna import"})," with the ",(0,s.jsx)(n.code,{children:"--max-buffer"})," flag and provide a large enough\nnumber (in bytes). At the writing of this entry the underlying default is\n10MB, so you should keep this in mind."]}),"\n",(0,s.jsx)(n.h3,{id:"merge-conflict-commits-cannot-be-imported",children:"Merge conflict commits cannot be imported"}),"\n",(0,s.jsx)(n.p,{children:"When you try to import a repository that contains merge commits that needed\nconflict resolutions, the import command fails with an error:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"lerna ERR! execute Error: Command failed: git am -3\nlerna ERR! execute error: Failed to merge in the changes.\nlerna ERR! execute CONFLICT (content): Merge conflict in [file]\n"})}),"\n",(0,s.jsx)(n.h4,{id:"solution-1",children:"Solution"}),"\n",(0,s.jsxs)(n.p,{children:["Run ",(0,s.jsx)(n.code,{children:"lerna import"})," with the ",(0,s.jsx)(n.code,{children:"--flatten"}),' flag to import the history in "flat"\nmode, i.e. with each merge commit as a single change the merge introduced.']}),"\n",(0,s.jsx)(n.h3,{id:"failing-when-git-tree-has-uncommitted-changes",children:"Failing when git tree has uncommitted changes"}),"\n",(0,s.jsxs)(n.p,{children:["You will receive ",(0,s.jsx)(n.code,{children:"fatal: ambiguous argument 'HEAD':"})," error, when the current project has ",(0,s.jsx)(n.strong,{children:"uncommitted changes"}),"."]}),"\n",(0,s.jsx)(n.h4,{id:"solution-2",children:"Solution"}),"\n",(0,s.jsxs)(n.p,{children:["Make sure to commit all the changes you have in your lerna project, before importing any packages using ",(0,s.jsx)(n.code,{children:"lerna import"}),"."]}),"\n",(0,s.jsx)(n.h2,{id:"publish-command",children:"Publish Command"}),"\n",(0,s.jsx)(n.h3,{id:"publish-does-not-detect-manually-created-tags-in-fixed-mode-with-githubgithub-enterprise",children:"Publish does not detect manually created tags in fixed mode with Github/Github Enterprise"}),"\n",(0,s.jsxs)(n.p,{children:["Github and Github Enterprise use lightweight Git tags when a release is created through the ",(0,s.jsx)(n.a,{href:"https://help.github.com/articles/working-with-tags",children:"web ui"}),",\nwhile Lerna uses annotated tags."]}),"\n",(0,s.jsx)(n.p,{children:"This can cause an issue where Lerna will ignore previously published releases which have been manually performed and\ntagged with the Github web ui."}),"\n",(0,s.jsx)(n.p,{children:"For example if the publish history was as follows:"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["v1.1.0 was published and tagged with ",(0,s.jsx)(n.code,{children:"lerna publish"})]}),"\n",(0,s.jsx)(n.li,{children:"v1.2.0 was manually published and tagged with the Github web ui"}),"\n",(0,s.jsx)(n.li,{children:"v1.2.1 was manually published and tagged with the Github web ui"}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["Running ",(0,s.jsx)(n.code,{children:"lerna publish"})," now would detect v1.1.0 instead of v1.2.1 as the last released tag."]}),"\n",(0,s.jsxs)(n.p,{children:["The implications of this depends on your usage of ",(0,s.jsx)(n.code,{children:"lerna publish"}),":"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"The publish prompt would use v1.1.0 as the base for major/minor/patch suggestions."}),"\n",(0,s.jsxs)(n.li,{children:["When using the ",(0,s.jsx)(n.code,{children:"--conventional-commits"})," flag:","\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"would suggest a semver increment based on all the commits since v1.1.0 (including commits from v1.2.0, v1.2.1 etc)"}),"\n",(0,s.jsx)(n.li,{children:"The generated CHANGELOG.md files will repeat all the commits that have already been released in v1.2.0, v1.2.1 etc"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.h4,{id:"solution-3",children:"Solution:"}),"\n",(0,s.jsxs)(n.p,{children:["If possible, use ",(0,s.jsx)(n.code,{children:"lerna publish"})," over manual releases."]}),"\n",(0,s.jsxs)(n.p,{children:["For new manual releases, use ",(0,s.jsx)(n.code,{children:"git tag -a -m "})," instead of using the Github web ui."]}),"\n",(0,s.jsx)(n.p,{children:"For existing lightweight tags, they can be converted to an annotated tag using something like this:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-sh",children:'GIT_AUTHOR_NAME="$(git show $1 --format=%aN -s)"\nGIT_AUTHOR_EMAIL="$(git show $1 --format=%aE -s)"\nGIT_AUTHOR_DATE="$(git show $1 --format=%aD -s)"\nGIT_COMMITTER_NAME="$(git show $1 --format=%cN -s)"\nGIT_COMMITTER_EMAIL="$(git show $1 --format=%cE -s)"\nGIT_COMMITTER_DATE="$(git show $1 --format=%cD -s)"\n\ngit tag -a -m $1 -f $1 $1\n\ngit push --tags --force\n'})}),"\n",(0,s.jsxs)(n.p,{children:["See this ",(0,s.jsx)(n.a,{href:"https://stackoverflow.com/questions/5002555/can-a-lightweight-tag-be-converted-to-an-annotated-tag",children:"Stackoverflow post"})," for more details"]}),"\n",(0,s.jsx)(n.h3,{id:"publishing-to-a-private-npm-registry-artifactory-npm-enterprise-etc",children:"Publishing to a private npm registry (Artifactory, npm Enterprise, etc)"}),"\n",(0,s.jsxs)(n.p,{children:["If ",(0,s.jsx)(n.code,{children:"lerna publish"})," is failing ensure you have the following your ",(0,s.jsx)(n.code,{children:"package.json"}),":"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-javascript",children:'\t"publishConfig": {\n\t\t"registry": "https://[registry-url]"\n\t}\n'})}),"\n",(0,s.jsxs)(n.p,{children:["You may also need to add the following to your ",(0,s.jsx)(n.code,{children:".npmrc"})," file on the individual package(s):"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"registry = https://[registry-url]\n"})}),"\n",(0,s.jsx)(n.admonition,{type:"info",children:(0,s.jsxs)(n.p,{children:["Lerna always uses ",(0,s.jsx)(n.code,{children:"npm"})," tooling to publish packages, regardless of the ",(0,s.jsx)(n.code,{children:"npmClient"})," set in the ",(0,s.jsx)(n.code,{children:"lerna.json"})," file. This means that any ",(0,s.jsx)(n.code,{children:"yarn"})," or ",(0,s.jsx)(n.code,{children:"pnpm"})," configuration will not be detected. To ensure successful publishing to a private registry, make sure that ",(0,s.jsx)(n.code,{children:"npm"})," is configured properly with environment variables or a ",(0,s.jsx)(n.code,{children:".npmrc"})," file."]})}),"\n",(0,s.jsx)(n.h2,{id:"jest--visual-studio-code-debugging",children:"Jest / Visual Studio Code Debugging"}),"\n",(0,s.jsxs)(n.p,{children:["It is possible to debug ",(0,s.jsx)(n.a,{href:"https://facebook.github.io/jest/",children:"Jest"})," tests in a Lerna-managed package using ",(0,s.jsx)(n.a,{href:"https://code.visualstudio.com/",children:"Visual Studio Code"}),". Debugging with breakpoints works with the vscode launch configuration below in the monorepo's ",(0,s.jsx)(n.code,{children:"/.vscode/launch.json"})," file. This example launches Jest for a single package ",(0,s.jsx)(n.code,{children:"my-package"})," located in the monorepo."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-javascript",children:'{\n "name": "Jest my-package",\n "type": "node",\n "request": "launch",\n "address": "localhost",\n "protocol": "inspector",\n "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/lerna",\n "runtimeArgs": [\n "exec",\n "--scope",\n "my-package",\n "--",\n "node"\n ],\n "args": [\n "${workspaceRoot}/node_modules/jest/bin/jest.js",\n "--runInBand",\n "--no-cache",\n "packages/my-package"\n ]\n}\n'})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.a,{href:"https://facebook.github.io/jest/docs/en/cli.html#runinband",children:(0,s.jsx)(n.code,{children:"--runInBand"})})," avoids parallelizing tests across multiple processes"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.a,{href:"https://facebook.github.io/jest/docs/en/cli.html#cache",children:(0,s.jsx)(n.code,{children:"--no-cache"})})," helps avoid caching issues"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"Tested with Visual Studio Code v1.19.3 and Jest v22.1.4."})]})}function d(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(h,{...e})}):h(e)}},8453:(e,n,i)=>{i.d(n,{R:()=>r,x:()=>l});var t=i(6540);const s={},o=t.createContext(s);function r(e){const n=t.useContext(o);return t.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(s):e.components||s:r(e.components),t.createElement(o.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/a09c2993.df0289f5.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[899],{7974:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>a,default:()=>c,frontMatter:()=>i,metadata:()=>r,toc:()=>l});const r=JSON.parse('{"id":"introduction","title":"Introduction","description":"Lerna is the original monorepo tool for JavaScript/TypeScript. It has been around for many years and is used by tens of thousands of projects, including React and Jest.","source":"@site/docs/introduction.md","sourceDirName":".","slug":"/introduction","permalink":"/docs/introduction","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/introduction.md","tags":[],"version":"current","frontMatter":{"id":"introduction","title":"Introduction","type":"explainer"},"sidebar":"main","next":{"title":"Getting Started","permalink":"/docs/getting-started"}}');var s=t(4848),o=t(8453);const i={id:"introduction",title:"Introduction",type:"explainer"},a="Introduction",d={},l=[{value:"Why Lerna?",id:"why-lerna",level:2}];function h(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"introduction",children:"Introduction"})}),"\n",(0,s.jsxs)(n.p,{children:["Lerna is the original ",(0,s.jsx)(n.a,{href:"https://monorepo.tools",children:"monorepo tool"})," for JavaScript/TypeScript. It has been around for many years and is used by tens of thousands of projects, including React and Jest."]}),"\n",(0,s.jsx)(n.p,{children:"It solves two of the biggest problems of JavaScript/TypeScript monorepos:"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"Lerna runs a command against any number of projects, and it does it in the most efficient way, in the right order, and with the possibility to distribute that on multiple machines."}),"\n",(0,s.jsx)(n.li,{children:"Lerna manages your publishing process, from version management to publishing to NPM, and it provides a variety of options to make sure any workflow can be accommodated."}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["Nx (the company behind the open source build system of the same name) has taken over ",(0,s.jsx)(n.a,{href:"https://dev.to/nrwl/lerna-is-dead-long-live-lerna-3jal",children:"stewardship of Lerna"}),". ",(0,s.jsx)(n.a,{href:"https://nx.dev",children:"Nx"})," is a build system developed by ex-Googlers and utilizes many of the techniques used by internal Google tools. Lerna v5 was the first release under this new stewardship, updating outdated packages and starting to do some cleanup on the repository itself. Starting with v6+, Lerna delegates task scheduling work to Nx's battle tested, industry-leading task runner, meaning ",(0,s.jsx)(n.code,{children:"lerna run"})," gets the benefits of caching and command distribution for free!"]}),"\n",(0,s.jsx)(n.h2,{id:"why-lerna",children:"Why Lerna?"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"Super Fast!"})," Lerna is fast, even faster than most comparable solutions out there (",(0,s.jsx)(n.a,{href:"https://github.com/vsavkin/large-monorepo",children:"see this benchmark"})," to learn more). How? Under the hood, ",(0,s.jsx)(n.a,{href:"https://twitter.com/i/status/1529493314621145090",children:"Lerna v6+ uses Nx to run tasks"}),". Learn more about ",(0,s.jsx)(n.a,{href:"/docs/features/run-tasks",children:"running tasks here"}),"."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"Computation Caching"})," - Lerna knows when the task you are about to run has been executed in the past. Instead of running it, Lerna will restore the files and replay the terminal output instantly. Plus, this cache can be shared with your co-workers and CI. When using Lerna, your whole organization will never have to build or test the same thing twice. ",(0,s.jsx)(n.a,{href:"/docs/features/cache-tasks",children:"Read more \xbb"})]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"Configuration-Free Distributed Task Execution"})," Lerna can distribute any command across multiple machines without any configuration, while preserving the dev ergonomics of running it on a single machine. In other words, scaling your monorepo with Lerna is as simple as enabling a boolean flag. See the examples of how enabling DTE can make you CI 20 times faster. ",(0,s.jsx)(n.a,{href:"/docs/features/distribute-tasks",children:"Read more \xbb"})]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"Beautiful Terminal Output"})," Monorepos can have hundreds or thousands of projects. Printing everything on every command makes it hard to see what fails and why. Thankfully, Lerna does a much better job."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"Powerful Graph Visualizer"})," Lerna comes with a powerful interactive visualizer simplifying the understanding of your workspaces. ",(0,s.jsx)(n.a,{href:"/docs/features/project-graph",children:"Read more \xbb"})]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"Publishing to NPM"})," Lerna is the ultimate tool for publishing multiple packages to npm. Whether the packages have independent versions or not, Lerna has you covered. ",(0,s.jsx)(n.a,{href:"/docs/features/version-and-publish",children:"Read more \xbb"})]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.strong,{children:"Easy to Adopt"})," Even with all these capabilities, Lerna is very easy to adopt. It requires close-to-zero configurations. ",(0,s.jsx)(n.a,{href:"/docs/getting-started",children:"Want to see how?"})]}),"\n"]})]})}function c(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(h,{...e})}):h(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>a});var r=t(6540);const s={},o=r.createContext(s);function i(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/a5d4e17f.774a4dc3.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[180],{6431:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>d,frontMatter:()=>c,metadata:()=>o,toc:()=>u});const o=JSON.parse('{"id":"features/share-your-cache","title":"Share Your Cache","description":"The computation cache provided by Lerna can be distributed across multiple machines. You can either build an implementation","source":"@site/docs/features/share-your-cache.md","sourceDirName":"features","slug":"/features/share-your-cache","permalink":"/docs/features/share-your-cache","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/features/share-your-cache.md","tags":[],"version":"current","frontMatter":{"id":"share-your-cache","title":"Share Your Cache","type":"recipe"},"sidebar":"main","previous":{"title":"Cache Task Results","permalink":"/docs/features/cache-tasks"},"next":{"title":"Explore the Project Graph","permalink":"/docs/features/project-graph"}}');var r=t(4848),a=t(8453);const c={id:"share-your-cache",title:"Share Your Cache",type:"recipe"},s="Share Your Cache",i={},u=[{value:"Connecting Your Workspace to Your Nx Cloud Account",id:"connecting-your-workspace-to-your-nx-cloud-account",level:2},{value:"Skipping Cloud",id:"skipping-cloud",level:2}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"share-your-cache",children:"Share Your Cache"})}),"\n",(0,r.jsxs)(n.p,{children:["The computation cache provided by Lerna can be distributed across multiple machines. You can either build an implementation\nof the cache or use Nx Cloud. Nx Cloud is an app that provides a fast and zero-config implementation of distributed\ncaching. It's completely free for OSS projects and for most closed-sourced\nprojects (",(0,r.jsx)(n.a,{href:"https://dev.to/nrwl/more-time-saved-for-free-with-nx-cloud-4a2j",children:"read more here"}),")."]}),"\n",(0,r.jsx)(n.p,{children:"You can connect your workspace to Nx Cloud by running:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"npx nx connect-to-nx-cloud\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:'title="Terminal Output"',children:"\u2714 Enable distributed caching to make your CI faster \xb7 Yes\n\n> NX Generating @nrwl/nx-cloud:init\n\nUPDATE nx.json\n\n > NX Distributed caching via Nx Cloud has been enabled\n\n In addition to the caching, Nx Cloud provides config-free distributed execution,\n UI for viewing complex runs and GitHub integration. Learn more at https://nx.app\n\n Your workspace is currently unclaimed. Run details from unclaimed workspaces can be viewed on cloud.nx.app by anyone\n with the link. Claim your workspace at the following link to restrict access.\n\n https://cloud.nx.app/orgs/workspace-setup?accessToken=YOURACCESSTOKEN\n"})}),"\n",(0,r.jsx)(n.p,{children:"To see the remote cache in action, run:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"lerna run build --scope=header && nx reset && lerna run build --scope=header\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:'title="Terminal Output"',children:"> lerna run build --scope=header\n\n> header@0.0.0 build\n> rimraf dist && rollup --config\n\nsrc/index.tsx \u2192 dist...\ncreated dist in 786ms\n\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\n\n Lerna (powered by Nx) Successfully ran target build for project header (2s)\n\n See logs and investigate cache misses at https://cloud.nx.app/runs/k0HDHACpL8\n\n\n > NX Resetting the Nx workspace cache and stopping the Nx Daemon.\n\n This might take a few minutes.\n\n\n > NX Daemon Server - Stopped\n\n\n > NX Successfully reset the Nx workspace.\n\n\n> lerna run build --scope=header [remote cache]\n\n\n> header@0.0.0 build\n> rimraf dist && rollup --config\n\n\nsrc/index.tsx \u2192 dist...\ncreated dist in 786ms\n\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\n\n Lerna (powered by Nx) Successfully ran target build for project header (664ms)\n\n Nx read the output from the cache instead of running the command for 1 out of 1 tasks.\n\n Nx Cloud made it possible to reuse header: https://nx.app/runs/P0X6ZGTkqZ\n"})}),"\n",(0,r.jsx)(n.h2,{id:"connecting-your-workspace-to-your-nx-cloud-account",children:"Connecting Your Workspace to Your Nx Cloud Account"}),"\n",(0,r.jsx)(n.p,{children:"After you have enabled Nx Cloud in your workspace, you will see the following:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"> NX NOTE Nx Cloud has been enabled\n\n Your workspace is currently public. Anybody with code access\n can view the workspace on nx.app.\n\n You can connect the workspace to your Nx Cloud account at\n https://nx.app/orgs/workspace-setup?accessToken=N2Y3NzcyO...\n (You can do this later.)\n"})}),"\n",(0,r.jsx)(n.p,{children:"Click on this link to associate the workspace with your Nx Cloud account. If you don't have an Nx Cloud account, you can\ncreate one on the spot."}),"\n",(0,r.jsx)(n.p,{children:"After you claim your workspace, you will be able to manage permissions, create access tokens, set up billing, and so\nforth."}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"You will also see an interactive tutorial helping you explore distributed caching and the Nx Cloud user interface."})}),"\n",(0,r.jsxs)(n.p,{children:["If you lose this link, you can still connect your workspace to Nx Cloud. Go to ",(0,r.jsx)(n.a,{href:"https://nx.app",children:"nx.app"}),", create an\naccount, and connect your workspace using the access token from ",(0,r.jsx)(n.code,{children:"nx.json"}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"skipping-cloud",children:"Skipping Cloud"}),"\n",(0,r.jsxs)(n.p,{children:["Similar to how ",(0,r.jsx)(n.code,{children:"--skip-nx-cache"})," will instruct Nx not to use the cache, passing ",(0,r.jsx)(n.code,{children:"--no-cloud"})," will tell Nx not to use Nx\nCloud."]})]})}function d(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>s});var o=t(6540);const r={},a=o.createContext(r);function c(e){const n=o.useContext(a);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),o.createElement(a.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/a7456010.dee63f34.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[235],{8552:e=>{e.exports=JSON.parse('{"name":"docusaurus-plugin-content-pages","id":"default"}')}}]);
--------------------------------------------------------------------------------
/assets/js/a7bd4aaa.e8a160ba.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[98],{5047:(e,n,s)=>{s.r(n),s.d(n,{default:()=>x});s(6540);var r=s(1769),t=s(3716),o=s(1858),i=s(2831),c=s(7220),u=s(4848);function a(e){const{version:n}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(c.A,{version:n.version,tag:(0,t.k)(n.pluginId,n.version)}),(0,u.jsx)(r.be,{children:n.noIndex&&(0,u.jsx)("meta",{name:"robots",content:"noindex, nofollow"})})]})}function l(e){const{version:n,route:s}=e;return(0,u.jsx)(r.e3,{className:n.className,children:(0,u.jsx)(o.n,{version:n,children:(0,i.v)(s.routes)})})}function x(e){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a,{...e}),(0,u.jsx)(l,{...e})]})}}}]);
--------------------------------------------------------------------------------
/assets/js/a94703ab.01908dc4.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[48],{1841:(e,t,n)=>{n.r(t),n.d(t,{default:()=>be});var a=n(6540),o=n(4164),i=n(1769),s=n(204),l=n(102),r=n(2306),c=n(539),d=n(5627),u=n(7685);const m={backToTopButton:"backToTopButton_sjWU",backToTopButtonShow:"backToTopButtonShow_xfvO"};var b=n(4848);function h(){const{shown:e,scrollToTop:t}=function(e){let{threshold:t}=e;const[n,o]=(0,a.useState)(!1),i=(0,a.useRef)(!1),{startScroll:s,cancelScroll:l}=(0,d.gk)();return(0,d.Mq)(((e,n)=>{let{scrollY:a}=e;const s=n?.scrollY;s&&(i.current?i.current=!1:a>=s?(l(),o(!1)):a{e.location.hash&&(i.current=!0,o(!1))})),{shown:n,scrollToTop:()=>s(0)}}({threshold:300});return(0,b.jsx)("button",{"aria-label":(0,c.T)({id:"theme.BackToTopButton.buttonAriaLabel",message:"Scroll back to top",description:"The ARIA label for the back to top button"}),className:(0,o.A)("clean-btn",s.G.common.backToTopButton,m.backToTopButton,e&&m.backToTopButtonShow),type:"button",onClick:t})}var p=n(4924),x=n(6347),f=n(6682),j=n(3115),v=n(2862);function _(e){return(0,b.jsx)("svg",{width:"20",height:"20","aria-hidden":"true",...e,children:(0,b.jsxs)("g",{fill:"#7a7a7a",children:[(0,b.jsx)("path",{d:"M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"}),(0,b.jsx)("path",{d:"M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"})]})})}const A={collapseSidebarButton:"collapseSidebarButton_PEFL",collapseSidebarButtonIcon:"collapseSidebarButtonIcon_kv0_"};function g(e){let{onClick:t}=e;return(0,b.jsx)("button",{type:"button",title:(0,c.T)({id:"theme.docs.sidebar.collapseButtonTitle",message:"Collapse sidebar",description:"The title attribute for collapse button of doc sidebar"}),"aria-label":(0,c.T)({id:"theme.docs.sidebar.collapseButtonAriaLabel",message:"Collapse sidebar",description:"The title attribute for collapse button of doc sidebar"}),className:(0,o.A)("button button--secondary button--outline",A.collapseSidebarButton),onClick:t,children:(0,b.jsx)(_,{className:A.collapseSidebarButtonIcon})})}var k=n(3380),C=n(6849);const S=Symbol("EmptyContext"),T=a.createContext(S);function N(e){let{children:t}=e;const[n,o]=(0,a.useState)(null),i=(0,a.useMemo)((()=>({expandedItem:n,setExpandedItem:o})),[n]);return(0,b.jsx)(T.Provider,{value:i,children:t})}var I=n(3535),B=n(214),y=n(6289),w=n(9136);function L(e){let{collapsed:t,categoryLabel:n,onClick:a}=e;return(0,b.jsx)("button",{"aria-label":t?(0,c.T)({id:"theme.DocSidebarItem.expandCategoryAriaLabel",message:"Expand sidebar category '{label}'",description:"The ARIA label to expand the sidebar category"},{label:n}):(0,c.T)({id:"theme.DocSidebarItem.collapseCategoryAriaLabel",message:"Collapse sidebar category '{label}'",description:"The ARIA label to collapse the sidebar category"},{label:n}),"aria-expanded":!t,type:"button",className:"clean-btn menu__caret",onClick:a})}function E(e){let{item:t,onItemClick:n,activePath:i,level:r,index:c,...d}=e;const{items:u,label:m,collapsible:h,className:p,href:x}=t,{docs:{sidebar:{autoCollapseCategories:f}}}=(0,j.p)(),v=function(e){const t=(0,w.A)();return(0,a.useMemo)((()=>e.href&&!e.linkUnlisted?e.href:!t&&e.collapsible?(0,l.Nr)(e):void 0),[e,t])}(t),_=(0,l.w8)(t,i),A=(0,B.ys)(x,i),{collapsed:g,setCollapsed:k}=(0,I.u)({initialState:()=>!!h&&(!_&&t.collapsed)}),{expandedItem:N,setExpandedItem:E}=function(){const e=(0,a.useContext)(T);if(e===S)throw new C.dV("DocSidebarItemsExpandedStateProvider");return e}(),M=function(e){void 0===e&&(e=!g),E(e?null:c),k(e)};return function(e){let{isActive:t,collapsed:n,updateCollapsed:o}=e;const i=(0,C.ZC)(t);(0,a.useEffect)((()=>{t&&!i&&n&&o(!1)}),[t,i,n,o])}({isActive:_,collapsed:g,updateCollapsed:M}),(0,a.useEffect)((()=>{h&&null!=N&&N!==c&&f&&k(!0)}),[h,N,c,k,f]),(0,b.jsxs)("li",{className:(0,o.A)(s.G.docs.docSidebarItemCategory,s.G.docs.docSidebarItemCategoryLevel(r),"menu__list-item",{"menu__list-item--collapsed":g},p),children:[(0,b.jsxs)("div",{className:(0,o.A)("menu__list-item-collapsible",{"menu__list-item-collapsible--active":A}),children:[(0,b.jsx)(y.A,{className:(0,o.A)("menu__link",{"menu__link--sublist":h,"menu__link--sublist-caret":!x&&h,"menu__link--active":_}),onClick:h?e=>{n?.(t),x?M(!1):(e.preventDefault(),M())}:()=>{n?.(t)},"aria-current":A?"page":void 0,role:h&&!x?"button":void 0,"aria-expanded":h&&!x?!g:void 0,href:h?v??"#":v,...d,children:m}),x&&h&&(0,b.jsx)(L,{collapsed:g,categoryLabel:m,onClick:e=>{e.preventDefault(),M()}})]}),(0,b.jsx)(I.N,{lazy:!0,as:"ul",className:"menu__list",collapsed:g,children:(0,b.jsx)(U,{items:u,tabIndex:g?-1:0,onItemClick:n,activePath:i,level:r+1})})]})}var M=n(2887),H=n(5891);const G={menuExternalLink:"menuExternalLink_NmtK"};function W(e){let{item:t,onItemClick:n,activePath:a,level:i,index:r,...c}=e;const{href:d,label:u,className:m,autoAddBaseUrl:h}=t,p=(0,l.w8)(t,a),x=(0,M.A)(d);return(0,b.jsx)("li",{className:(0,o.A)(s.G.docs.docSidebarItemLink,s.G.docs.docSidebarItemLinkLevel(i),"menu__list-item",m),children:(0,b.jsxs)(y.A,{className:(0,o.A)("menu__link",!x&&G.menuExternalLink,{"menu__link--active":p}),autoAddBaseUrl:h,"aria-current":p?"page":void 0,to:d,...x&&{onClick:n?()=>n(t):void 0},...c,children:[u,!x&&(0,b.jsx)(H.A,{})]})},u)}const P={menuHtmlItem:"menuHtmlItem_M9Kj"};function R(e){let{item:t,level:n,index:a}=e;const{value:i,defaultStyle:l,className:r}=t;return(0,b.jsx)("li",{className:(0,o.A)(s.G.docs.docSidebarItemLink,s.G.docs.docSidebarItemLinkLevel(n),l&&[P.menuHtmlItem,"menu__list-item"],r),dangerouslySetInnerHTML:{__html:i}},a)}function D(e){let{item:t,...n}=e;switch(t.type){case"category":return(0,b.jsx)(E,{item:t,...n});case"html":return(0,b.jsx)(R,{item:t,...n});default:return(0,b.jsx)(W,{item:t,...n})}}function F(e){let{items:t,...n}=e;const a=(0,l.Y)(t,n.activePath);return(0,b.jsx)(N,{children:a.map(((e,t)=>(0,b.jsx)(D,{item:e,index:t,...n},t)))})}const U=(0,a.memo)(F),V={menu:"menu_SIkG",menuWithAnnouncementBar:"menuWithAnnouncementBar_GW3s"};function Y(e){let{path:t,sidebar:n,className:i}=e;const l=function(){const{isActive:e}=(0,k.M)(),[t,n]=(0,a.useState)(e);return(0,d.Mq)((t=>{let{scrollY:a}=t;e&&n(0===a)}),[e]),e&&t}();return(0,b.jsx)("nav",{"aria-label":(0,c.T)({id:"theme.docs.sidebar.navAriaLabel",message:"Docs sidebar",description:"The ARIA label for the sidebar navigation"}),className:(0,o.A)("menu thin-scrollbar",V.menu,l&&V.menuWithAnnouncementBar,i),children:(0,b.jsx)("ul",{className:(0,o.A)(s.G.docs.docSidebarMenu,"menu__list"),children:(0,b.jsx)(U,{items:n,activePath:t,level:1})})})}const K="sidebar_njMd",z="sidebarWithHideableNavbar_wUlq",q="sidebarHidden_VK0M",O="sidebarLogo_isFc";function J(e){let{path:t,sidebar:n,onCollapse:a,isHidden:i}=e;const{navbar:{hideOnScroll:s},docs:{sidebar:{hideable:l}}}=(0,j.p)();return(0,b.jsxs)("div",{className:(0,o.A)(K,s&&z,i&&q),children:[s&&(0,b.jsx)(v.A,{tabIndex:-1,className:O}),(0,b.jsx)(Y,{path:t,sidebar:n}),l&&(0,b.jsx)(g,{onClick:a})]})}const Q=a.memo(J);var X=n(3065),Z=n(4635);const $=e=>{let{sidebar:t,path:n}=e;const a=(0,Z.M)();return(0,b.jsx)("ul",{className:(0,o.A)(s.G.docs.docSidebarMenu,"menu__list"),children:(0,b.jsx)(U,{items:t,activePath:n,onItemClick:e=>{"category"===e.type&&e.href&&a.toggle(),"link"===e.type&&a.toggle()},level:1})})};function ee(e){return(0,b.jsx)(X.GX,{component:$,props:e})}const te=a.memo(ee);function ne(e){const t=(0,f.l)(),n="desktop"===t||"ssr"===t,a="mobile"===t;return(0,b.jsxs)(b.Fragment,{children:[n&&(0,b.jsx)(Q,{...e}),a&&(0,b.jsx)(te,{...e})]})}const ae={expandButton:"expandButton_TmdG",expandButtonIcon:"expandButtonIcon_i1dp"};function oe(e){let{toggleSidebar:t}=e;return(0,b.jsx)("div",{className:ae.expandButton,title:(0,c.T)({id:"theme.docs.sidebar.expandButtonTitle",message:"Expand sidebar",description:"The ARIA label and title attribute for expand button of doc sidebar"}),"aria-label":(0,c.T)({id:"theme.docs.sidebar.expandButtonAriaLabel",message:"Expand sidebar",description:"The ARIA label and title attribute for expand button of doc sidebar"}),tabIndex:0,role:"button",onKeyDown:t,onClick:t,children:(0,b.jsx)(_,{className:ae.expandButtonIcon})})}const ie={docSidebarContainer:"docSidebarContainer_YfHR",docSidebarContainerHidden:"docSidebarContainerHidden_DPk8",sidebarViewport:"sidebarViewport_aRkj"};function se(e){let{children:t}=e;const n=(0,r.t)();return(0,b.jsx)(a.Fragment,{children:t},n?.name??"noSidebar")}function le(e){let{sidebar:t,hiddenSidebarContainer:n,setHiddenSidebarContainer:i}=e;const{pathname:l}=(0,x.zy)(),[r,c]=(0,a.useState)(!1),d=(0,a.useCallback)((()=>{r&&c(!1),!r&&(0,p.O)()&&c(!0),i((e=>!e))}),[i,r]);return(0,b.jsx)("aside",{className:(0,o.A)(s.G.docs.docSidebarContainer,ie.docSidebarContainer,n&&ie.docSidebarContainerHidden),onTransitionEnd:e=>{e.currentTarget.classList.contains(ie.docSidebarContainer)&&n&&c(!0)},children:(0,b.jsx)(se,{children:(0,b.jsxs)("div",{className:(0,o.A)(ie.sidebarViewport,r&&ie.sidebarViewportHidden),children:[(0,b.jsx)(ne,{sidebar:t,path:l,onCollapse:d,isHidden:r}),r&&(0,b.jsx)(oe,{toggleSidebar:d})]})})})}const re={docMainContainer:"docMainContainer_TBSr",docMainContainerEnhanced:"docMainContainerEnhanced_lQrH",docItemWrapperEnhanced:"docItemWrapperEnhanced_JWYK"};function ce(e){let{hiddenSidebarContainer:t,children:n}=e;const a=(0,r.t)();return(0,b.jsx)("main",{className:(0,o.A)(re.docMainContainer,(t||!a)&&re.docMainContainerEnhanced),children:(0,b.jsx)("div",{className:(0,o.A)("container padding-top--md padding-bottom--lg",re.docItemWrapper,t&&re.docItemWrapperEnhanced),children:n})})}const de={docRoot:"docRoot_UBD9",docsWrapper:"docsWrapper_hBAB"};function ue(e){let{children:t}=e;const n=(0,r.t)(),[o,i]=(0,a.useState)(!1);return(0,b.jsxs)("div",{className:de.docsWrapper,children:[(0,b.jsx)(h,{}),(0,b.jsxs)("div",{className:de.docRoot,children:[n&&(0,b.jsx)(le,{sidebar:n.items,hiddenSidebarContainer:o,setHiddenSidebarContainer:i}),(0,b.jsx)(ce,{hiddenSidebarContainer:o,children:t})]})]})}var me=n(5932);function be(e){const t=(0,l.B5)(e);if(!t)return(0,b.jsx)(me.A,{});const{docElement:n,sidebarName:a,sidebarItems:c}=t;return(0,b.jsx)(i.e3,{className:(0,o.A)(s.G.page.docsDocPage),children:(0,b.jsx)(r.V,{name:a,items:c,children:(0,b.jsx)(ue,{children:n})})})}},5932:(e,t,n)=>{n.d(t,{A:()=>l});n(6540);var a=n(4164),o=n(539),i=n(9303),s=n(4848);function l(e){let{className:t}=e;return(0,s.jsx)("main",{className:(0,a.A)("container margin-vert--xl",t),children:(0,s.jsx)("div",{className:"row",children:(0,s.jsxs)("div",{className:"col col--6 col--offset-3",children:[(0,s.jsx)(i.A,{as:"h1",className:"hero__title",children:(0,s.jsx)(o.A,{id:"theme.NotFound.title",description:"The title of the 404 page",children:"Page Not Found"})}),(0,s.jsx)("p",{children:(0,s.jsx)(o.A,{id:"theme.NotFound.p1",description:"The first paragraph of the 404 page",children:"We could not find what you were looking for."})}),(0,s.jsx)("p",{children:(0,s.jsx)(o.A,{id:"theme.NotFound.p2",description:"The 2nd paragraph of the 404 page",children:"Please contact the owner of the site that linked you to the original URL and let them know their link is broken."})})]})})})}}}]);
--------------------------------------------------------------------------------
/assets/js/aba21aa0.7f4ce930.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[742],{7093:e=>{e.exports=JSON.parse('{"name":"docusaurus-plugin-content-docs","id":"default"}')}}]);
--------------------------------------------------------------------------------
/assets/js/b8844bda.8469d2f2.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[362],{1840:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>c});const i=JSON.parse('{"id":"concepts/task-pipeline-configuration","title":"Task Pipeline Configuration","description":"Lerna delegates the running of npm scripts (forking processes etc) to Nx. The nx.json file is the place where you can","source":"@site/docs/concepts/task-pipeline-configuration.md","sourceDirName":"concepts","slug":"/concepts/task-pipeline-configuration","permalink":"/docs/concepts/task-pipeline-configuration","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/concepts/task-pipeline-configuration.md","tags":[],"version":"current","frontMatter":{"id":"task-pipeline-configuration","title":"Task Pipeline Configuration","type":"explainer"},"sidebar":"main","previous":{"title":"Concepts","permalink":"/docs/concepts"},"next":{"title":"How Caching Works","permalink":"/docs/concepts/how-caching-works"}}');var t=s(4848),r=s(8453);const o={id:"task-pipeline-configuration",title:"Task Pipeline Configuration",type:"explainer"},a="Task Pipeline Configuration",l={},c=[{value:"Run Tasks in Parallel",id:"run-tasks-in-parallel",level:2},{value:"Define Task Dependencies (aka Task Pipelines)",id:"define-task-dependencies-aka-task-pipelines",level:2}];function d(e){const n={admonition:"admonition",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",header:"header",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.header,{children:(0,t.jsx)(n.h1,{id:"task-pipeline-configuration",children:"Task Pipeline Configuration"})}),"\n",(0,t.jsxs)(n.p,{children:["Lerna delegates the running of npm scripts (forking processes etc) to Nx. The ",(0,t.jsx)(n.code,{children:"nx.json"})," file is the place where you can\nconfigure how Nx does it."]}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["If you don't have ",(0,t.jsx)(n.code,{children:"nx.json"}),", run ",(0,t.jsx)(n.code,{children:"npx lerna add-caching"}),"."]})}),"\n",(0,t.jsx)(n.h2,{id:"run-tasks-in-parallel",children:"Run Tasks in Parallel"}),"\n",(0,t.jsx)(n.p,{children:"If you want to increase the number of processes running the scripts to, say, 5 (by default, it is 3), pass the\nfollowing:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"npx lerna run build --concurrency=5\n"})}),"\n",(0,t.jsx)(n.h2,{id:"define-task-dependencies-aka-task-pipelines",children:"Define Task Dependencies (aka Task Pipelines)"}),"\n",(0,t.jsxs)(n.p,{children:["Without our help Lerna cannot know what targets (scripts) have prerequisites and which ones don't. You can define task dependencies in the ",(0,t.jsx)(n.code,{children:"nx.json"})," file:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title="nx.json"',children:'{\n ...\n "targetDefaults": {\n "build": {\n "dependsOn": ["^build"]\n }\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"With this, Lerna knows that before it can build a project, it needs to build all of its dependencies first. There are,\nhowever, no constraints on tests."}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["Once you define the ",(0,t.jsx)(n.code,{children:"targetDefaults"})," property the sort flag is ignored."]}),"\n"]}),"\n",(0,t.jsx)(n.p,{children:"This mechanism is very flexible. Let's look at this example:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:'title="nx.json"',children:'{\n ...\n "targetDefaults": {\n "build": {\n "dependsOn": ["^build", "prebuild"]\n },\n "test": {\n "dependsOn": ["build"]\n }\n }\n}\n'})}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsx)(n.p,{children:"Note, older versions of Nx used targetDependencies instead of targetDefaults. Both still work, but targetDefaults is\nrecommended."}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"^"})," symbol (a.k.a the caret symbol) simply means dependencies. Therefore whereas ",(0,t.jsx)(n.code,{children:'"test": { "dependsOn": ["build"] }'}),' means a particular project\'s "test" target depends on its own "build" target to have already completed before running, ',(0,t.jsx)(n.code,{children:'"build": { "dependsOn": ["^build"] }'}),' means that a particular project\'s "build" target depends on the "build" target of all of the project\'s dependencies to have already completed before running.']}),"\n",(0,t.jsxs)(n.p,{children:["When running ",(0,t.jsx)(n.code,{children:"lerna run test --scope=myproj"}),", the above configuration would tell Lerna to"]}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsxs)(n.li,{children:["Run the ",(0,t.jsx)(n.code,{children:"test"})," command for ",(0,t.jsx)(n.code,{children:"myproj"})]}),"\n",(0,t.jsxs)(n.li,{children:["But since there's a dependency defined from ",(0,t.jsx)(n.code,{children:"test -> build"}),", Lerna runs ",(0,t.jsx)(n.code,{children:"build"})," for ",(0,t.jsx)(n.code,{children:"myproj"})," first."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"build"})," itself defines a dependency on ",(0,t.jsx)(n.code,{children:"prebuild"})," (on the same project) as well as ",(0,t.jsx)(n.code,{children:"build"})," of all the dependencies.\nTherefore, it will run the ",(0,t.jsx)(n.code,{children:"prebuild"})," script and will run the ",(0,t.jsx)(n.code,{children:"build"})," script for all the dependencies."]}),"\n"]}),"\n",(0,t.jsx)(n.p,{children:"Note, Lerna doesn't have to run all builds before it starts running tests. The task orchestrator will run as many tasks\nin parallel as possible as long as the constraints are met."}),"\n",(0,t.jsx)(n.p,{children:"Situations like this are pretty common:"}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.img,{alt:"Mixing Targets",src:s(5888).A+"",width:"730",height:"440"})}),"\n",(0,t.jsxs)(n.p,{children:["Because we described the rules in ",(0,t.jsx)(n.code,{children:"nx.json"}),", they will apply to all the projects in the repo. You can also define\nproject-specific rules by adding them the project's ",(0,t.jsx)(n.code,{children:"package.json"}),"."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n ...\n "nx": {\n "targets": {\n "test": {\n "dependsOn": [\n "build"\n ]\n }\n }\n }\n}\n'})})]})}function p(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},5888:(e,n,s)=>{s.d(n,{A:()=>i});const i=s.p+"assets/images/task-graph-execution-1729feab97c2a7f2879ba3783dd1f518.svg"},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>a});var i=s(6540);const t={},r=i.createContext(t);function o(e){const n=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:o(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/c0ae5a06.58f706a8.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[616],{9080:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>a,metadata:()=>i,toc:()=>t});const i=JSON.parse('{"id":"api-reference/commands","title":"Commands","description":"- lerna add-caching","source":"@site/docs/api-reference/commands.md","sourceDirName":"api-reference","slug":"/api-reference/commands","permalink":"/docs/api-reference/commands","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/api-reference/commands.md","tags":[],"version":"current","frontMatter":{"id":"commands","title":"Commands","type":"reference"},"sidebar":"main","previous":{"title":"Using pnpm with Lerna","permalink":"/docs/recipes/using-pnpm-with-lerna"},"next":{"title":"Configuration","permalink":"/docs/api-reference/configuration"}}');var c=s(4848),r=s(8453);const a={id:"commands",title:"Commands",type:"reference"},l="Commands",d={},t=[{value:"Filter Options",id:"filter-options",level:2},{value:"Options",id:"options",level:2},{value:"--scope <glob>
",id:"--scope-glob",level:3},{value:"Running with npx
",id:"running-with-npx",level:3},{value:"--ignore <glob>
",id:"--ignore-glob",level:3},{value:"--no-private
",id:"--no-private",level:3},{value:"--since [ref]
",id:"--since-ref",level:3},{value:"--exclude-dependents
",id:"--exclude-dependents",level:3},{value:"--include-dependents
",id:"--include-dependents",level:3},{value:"--include-dependencies
",id:"--include-dependencies",level:3},{value:"--include-merged-tags
",id:"--include-merged-tags",level:3},{value:"Limitations",id:"limitations",level:2}];function o(e){const n={a:"a",blockquote:"blockquote",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.header,{children:(0,c.jsx)(n.h1,{id:"commands",children:"Commands"})}),"\n",(0,c.jsxs)(n.ul,{children:["\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/packages/lerna/src/commands/add-caching#readme",children:(0,c.jsx)(n.code,{children:"lerna add-caching"})})}),"\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/changed#readme",children:(0,c.jsx)(n.code,{children:"lerna changed"})})}),"\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/clean#readme",children:(0,c.jsx)(n.code,{children:"lerna clean"})})}),"\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/create#readme",children:(0,c.jsx)(n.code,{children:"lerna create"})})}),"\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/diff#readme",children:(0,c.jsx)(n.code,{children:"lerna diff"})})}),"\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/exec#readme",children:(0,c.jsx)(n.code,{children:"lerna exec"})})}),"\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/import#readme",children:(0,c.jsx)(n.code,{children:"lerna import"})})}),"\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/info#readme",children:(0,c.jsx)(n.code,{children:"lerna info"})})}),"\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/init#readme",children:(0,c.jsx)(n.code,{children:"lerna init"})})}),"\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/list#readme",children:(0,c.jsx)(n.code,{children:"lerna list"})})}),"\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/publish#readme",children:(0,c.jsx)(n.code,{children:"lerna publish"})})}),"\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/packages/lerna/src/commands/repair#readme",children:(0,c.jsx)(n.code,{children:"lerna repair"})})}),"\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/run#readme",children:(0,c.jsx)(n.code,{children:"lerna run"})})}),"\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/libs/commands/version#readme",children:(0,c.jsx)(n.code,{children:"lerna version"})})}),"\n",(0,c.jsx)(n.li,{children:(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/tree/main/packages/lerna/src/commands/watch#readme",children:(0,c.jsx)(n.code,{children:"lerna watch"})})}),"\n"]}),"\n",(0,c.jsx)(n.h2,{id:"filter-options",children:"Filter Options"}),"\n",(0,c.jsx)(n.p,{children:"Lerna commands can have filter options applied to control which packages they operate on."}),"\n",(0,c.jsxs)(n.blockquote,{children:["\n",(0,c.jsx)(n.p,{children:"Options for lerna sub-commands that need filtering"}),"\n"]}),"\n",(0,c.jsxs)(n.p,{children:["Install ",(0,c.jsx)(n.a,{href:"https://www.npmjs.com/package/lerna",children:"lerna"})," for access to the ",(0,c.jsx)(n.code,{children:"lerna"})," CLI."]}),"\n",(0,c.jsx)(n.h2,{id:"options",children:"Options"}),"\n",(0,c.jsx)(n.h3,{id:"--scope-glob",children:(0,c.jsx)(n.code,{children:"--scope "})}),"\n",(0,c.jsx)(n.p,{children:"Include only packages with names matching the given glob."}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-sh",children:'$ lerna exec --scope my-component -- ls -la\n$ lerna run --scope "toolbar-*" test\n$ lerna run --scope package-1 --scope "*-2" lint\n'})}),"\n",(0,c.jsxs)(n.p,{children:[(0,c.jsx)(n.strong,{children:"Note:"})," For certain globs, it may be necessary to quote the option argument to avoid premature shell expansion."]}),"\n",(0,c.jsx)(n.h3,{id:"running-with-npx",children:(0,c.jsxs)(n.strong,{children:["Running with ",(0,c.jsx)(n.code,{children:"npx"})]})}),"\n",(0,c.jsxs)(n.p,{children:["When running ",(0,c.jsx)(n.code,{children:"lerna"})," with ",(0,c.jsx)(n.code,{children:"npx"}),', it is necessary to use an explicit "=" when passing glob arguments. This is to prevent ',(0,c.jsx)(n.code,{children:"npx"})," from prematurely expanding the arguments."]}),"\n",(0,c.jsx)(n.p,{children:"For example:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-sh",children:'$ npx lerna run --scope="toolbar-*" test\n$ npx lerna run --scope="package-{1,2,5}" test\n'})}),"\n",(0,c.jsx)(n.h3,{id:"--ignore-glob",children:(0,c.jsx)(n.code,{children:"--ignore "})}),"\n",(0,c.jsx)(n.p,{children:"Exclude packages with names matching the given glob."}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-sh",children:'$ lerna exec --ignore "package-{1,2,5}" -- ls -la\n$ lerna run --ignore package-1 test\n$ lerna run --ignore "package-@(1|2)" --ignore package-3 lint\n'})}),"\n",(0,c.jsxs)(n.p,{children:["More examples of filtering can be found ",(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/blob/c0a750e0f482c16dda2f922f235861283efbe94d/commands/list/__tests__/list-command.test.js#L305-L356",children:"here"}),"."]}),"\n",(0,c.jsx)(n.h3,{id:"--no-private",children:(0,c.jsx)(n.code,{children:"--no-private"})}),"\n",(0,c.jsx)(n.p,{children:"Exclude private packages. They are included by default."}),"\n",(0,c.jsx)(n.h3,{id:"--since-ref",children:(0,c.jsx)(n.code,{children:"--since [ref]"})}),"\n",(0,c.jsxs)(n.p,{children:["Only include packages that have been changed since the specified ",(0,c.jsx)(n.code,{children:"ref"}),". If no ref is passed, it defaults to the most-recent tag."]}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-sh",children:"# List the contents of packages that have changed since the latest tag\n$ lerna exec --since -- ls -la\n\n# Run the tests for all packages that have changed since `main`\n$ lerna run test --since main\n\n# List all packages that have changed since `some-branch`\n$ lerna ls --since some-branch\n"})}),"\n",(0,c.jsx)(n.p,{children:(0,c.jsxs)(n.em,{children:["This can be particularly useful when used in CI, if you can obtain the target branch a PR will be going into, because you can use that as the ",(0,c.jsx)(n.code,{children:"ref"})," to the ",(0,c.jsx)(n.code,{children:"--since"})," option. This works well for PRs going into the default branch as well as feature branches."]})}),"\n",(0,c.jsx)(n.h3,{id:"--exclude-dependents",children:(0,c.jsx)(n.code,{children:"--exclude-dependents"})}),"\n",(0,c.jsxs)(n.p,{children:["Exclude all transitive dependents when running a command with ",(0,c.jsx)(n.code,{children:"--since"}),', overriding the default "changed" algorithm.']}),"\n",(0,c.jsxs)(n.p,{children:["This flag has no effect without ",(0,c.jsx)(n.code,{children:"--since"}),", and will throw an error in that case."]}),"\n",(0,c.jsx)(n.h3,{id:"--include-dependents",children:(0,c.jsx)(n.code,{children:"--include-dependents"})}),"\n",(0,c.jsxs)(n.p,{children:["Include all transitive dependents when running a command regardless of ",(0,c.jsx)(n.code,{children:"--scope"}),", ",(0,c.jsx)(n.code,{children:"--ignore"}),", or ",(0,c.jsx)(n.code,{children:"--since"}),"."]}),"\n",(0,c.jsx)(n.h3,{id:"--include-dependencies",children:(0,c.jsx)(n.code,{children:"--include-dependencies"})}),"\n",(0,c.jsxs)(n.p,{children:["Include all transitive dependencies when running a command regardless of ",(0,c.jsx)(n.code,{children:"--scope"}),", ",(0,c.jsx)(n.code,{children:"--ignore"}),", or ",(0,c.jsx)(n.code,{children:"--since"}),"."]}),"\n",(0,c.jsxs)(n.p,{children:["Used in combination with any command that accepts ",(0,c.jsx)(n.code,{children:"--scope"})," (",(0,c.jsx)(n.code,{children:"bootstrap"}),", ",(0,c.jsx)(n.code,{children:"clean"}),", ",(0,c.jsx)(n.code,{children:"ls"}),", ",(0,c.jsx)(n.code,{children:"run"}),", ",(0,c.jsx)(n.code,{children:"exec"}),").\nEnsures that all dependencies (and dev dependencies) of any scoped packages (either through ",(0,c.jsx)(n.code,{children:"--scope"})," or ",(0,c.jsx)(n.code,{children:"--ignore"}),") are operated on as well."]}),"\n",(0,c.jsxs)(n.blockquote,{children:["\n",(0,c.jsxs)(n.p,{children:["Note: This will override the ",(0,c.jsx)(n.code,{children:"--scope"})," and ",(0,c.jsx)(n.code,{children:"--ignore"})," flags."]}),"\n",(0,c.jsxs)(n.blockquote,{children:["\n",(0,c.jsxs)(n.p,{children:["i.e. A package matched by the ",(0,c.jsx)(n.code,{children:"--ignore"})," flag will still be bootstrapped if it is depended on by another package that is being bootstrapped."]}),"\n"]}),"\n"]}),"\n",(0,c.jsx)(n.p,{children:'This is useful for situations where you want to "set up" a single package that relies on other packages being set up.'}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-sh",children:"$ lerna bootstrap --scope my-component --include-dependencies\n# my-component and all of its dependencies will be bootstrapped\n"})}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-sh",children:'$ lerna bootstrap --scope "package-*" --ignore "package-util-*" --include-dependencies\n# all packages matching "package-util-*" will be ignored unless they are\n# depended upon by a package whose name matches "package-*"\n'})}),"\n",(0,c.jsx)(n.h3,{id:"--include-merged-tags",children:(0,c.jsx)(n.code,{children:"--include-merged-tags"})}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-sh",children:"$ lerna exec --since --include-merged-tags -- ls -la\n"})}),"\n",(0,c.jsxs)(n.p,{children:["Include tags from merged branches when running a command with ",(0,c.jsx)(n.code,{children:"--since"}),". This is only useful if you do a lot of publishing from feature branches, which is not generally recommended."]}),"\n",(0,c.jsx)(n.h2,{id:"limitations",children:"Limitations"}),"\n",(0,c.jsxs)(n.p,{children:["Even though you can run Lerna without installing the project dependencies first, for instance with ",(0,c.jsx)(n.a,{href:"https://pnpm.io/cli/dlx",children:"pnpm dlx"})," or ",(0,c.jsx)(n.a,{href:"https://www.npmjs.com/package/npx",children:"npx"}),", it is not recommended. The command may work, but its output may not be 100% accurate. See ",(0,c.jsx)(n.a,{href:"https://github.com/lerna/lerna/issues/3807#issuecomment-1686841507",children:"this issue"})," for more details."]})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(o,{...e})}):o(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>a,x:()=>l});var i=s(6540);const c={},r=i.createContext(c);function a(e){const n=i.useContext(r);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(c):e.components||c:a(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/c44efb77.9aa012a7.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[629],{8468:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>l,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"lerna6-obsolete-options","title":"Lerna 6: Obsolete Options","description":"Nx and Lerna work together seamlessly in the same workspace.","source":"@site/docs/lerna6-obsolete-options.md","sourceDirName":".","slug":"/lerna6-obsolete-options","permalink":"/docs/lerna6-obsolete-options","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/lerna6-obsolete-options.md","tags":[],"version":"current","frontMatter":{},"sidebar":"main","previous":{"title":"FAQ","permalink":"/docs/faq"},"next":{"title":"Troubleshooting","permalink":"/docs/troubleshooting"}}');var o=t(4848),r=t(8453);const i={},l="Lerna 6: Obsolete Options",a={},d=[{value:"Obsolete Options",id:"obsolete-options",level:2},{value:"--sort
and --no-sort
",id:"--sort-and---no-sort",level:3},{value:"--parallel
",id:"--parallel",level:3},{value:"--include-dependencies
",id:"--include-dependencies",level:3},{value:"--ignore
",id:"--ignore",level:3}];function c(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",ol:"ol",p:"p",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"lerna-6-obsolete-options",children:"Lerna 6: Obsolete Options"})}),"\n",(0,o.jsx)(n.p,{children:"Nx and Lerna work together seamlessly in the same workspace."}),"\n",(0,o.jsxs)(n.p,{children:["When Lerna is running tasks with Nx and detects Nx target configuration, Lerna will respect this configuration during ",(0,o.jsx)(n.code,{children:"lerna run"}),"\nand delegate dependency detection to the Nx task runner."]}),"\n",(0,o.jsxs)(n.p,{children:["Nx will run tasks in an order and with a concurrency that it determines appropriate based on the task graph that it\ncreates. For more information,\nsee ",(0,o.jsx)(n.a,{href:"https://nx.dev/concepts/mental-model#the-task-graph",children:"Nx Mental Model: The Task Graph"}),"."]}),"\n",(0,o.jsxs)(n.p,{children:["**This behavior allows Nx to run tasks in the most efficient way possible, but it also means that some existing options\nfor ",(0,o.jsx)(n.code,{children:"lerna run"})," become obsolete.\n**"]}),"\n",(0,o.jsx)(n.h2,{id:"obsolete-options",children:"Obsolete Options"}),"\n",(0,o.jsxs)(n.h3,{id:"--sort-and---no-sort",children:[(0,o.jsx)(n.code,{children:"--sort"})," and ",(0,o.jsx)(n.code,{children:"--no-sort"})]}),"\n",(0,o.jsxs)(n.p,{children:["When Nx targets are configured, Lerna will always run tasks in the order it deems is correct based on its knowledge of\nproject and task dependencies, so ",(0,o.jsx)(n.code,{children:"--sort"})," and ",(0,o.jsx)(n.code,{children:"--no-sort"})," have no effect."]}),"\n",(0,o.jsx)(n.h3,{id:"--parallel",children:(0,o.jsx)(n.code,{children:"--parallel"})}),"\n",(0,o.jsxs)(n.p,{children:["Lerna will use the task graph to determine which tasks can be run in parallel and do so automatically, so ",(0,o.jsx)(n.code,{children:"--parallel"}),"\nhas no effect."]}),"\n",(0,o.jsx)(n.admonition,{type:"note",children:(0,o.jsxs)(n.p,{children:["If you want to limit the concurrency of tasks, you can still use\nthe ",(0,o.jsx)(n.a,{href:"https://github.com/lerna/lerna/blob/6cb8ab2d4af7ce25c812e8fb05cd04650105705f/core/global-options/README.md#--concurrency",children:"concurrency global option"}),"\nto accomplish this."]})}),"\n",(0,o.jsx)(n.h3,{id:"--include-dependencies",children:(0,o.jsx)(n.code,{children:"--include-dependencies"})}),"\n",(0,o.jsxs)(n.p,{children:["Lerna 6 will automatically run dependent tasks first when necessary, so ",(0,o.jsx)(n.code,{children:"--include-dependencies"})," is obsolete. However,\nthe flag can still be used to include tasks that are not required (e.g., running the tests of all the dependent\nprojects)."]}),"\n",(0,o.jsx)(n.h3,{id:"--ignore",children:(0,o.jsx)(n.code,{children:"--ignore"})}),"\n",(0,o.jsxs)(n.p,{children:["When used with Nx, ",(0,o.jsx)(n.code,{children:"--ignore"})," will never cause ",(0,o.jsx)(n.code,{children:"lerna run"})," to exclude any tasks that are deemed to be\nrequired ",(0,o.jsx)(n.a,{href:"https://nx.dev/concepts/mental-model#the-task-graph",children:"task graph"}),"."]}),"\n",(0,o.jsxs)(n.admonition,{type:"tip",children:[(0,o.jsx)(n.p,{children:"The effects on the options above will only apply if:"}),(0,o.jsxs)(n.ol,{children:["\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"nx.json"})," exists in the root with the ",(0,o.jsx)(n.code,{children:"targetDefaults"})," property\ndefined."]}),"\n",(0,o.jsxs)(n.li,{children:["The ",(0,o.jsx)(n.code,{children:'"nx"'})," property is found in the package.json of a target package."]}),"\n"]}),(0,o.jsxs)(n.p,{children:["Otherwise, they will behave just as they would with Lerna's legacy task runner (if ",(0,o.jsx)(n.code,{children:"useNx"})," is ",(0,o.jsx)(n.code,{children:"false"}),")."]})]})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(c,{...e})}):c(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>l});var s=t(6540);const o={},r=s.createContext(o);function i(e){const n=s.useContext(r);return s.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(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/d55206b1.8192417d.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[410],{9393:(e,U,t)=>{t.r(U),t.d(U,{assets:()=>r,contentTitle:()=>s,default:()=>a,frontMatter:()=>o,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"features/editor-integrations","title":"Editor Integrations","description":"Nx Console displays the npm scripts for all your projects in the VS Code sidebar and allows you to run them with a single click or open the script definition in your editor.","source":"@site/docs/features/editor-integrations.md","sourceDirName":"features","slug":"/features/editor-integrations","permalink":"/docs/features/editor-integrations","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/features/editor-integrations.md","tags":[],"version":"current","frontMatter":{"id":"editor-integrations","title":"Editor Integrations","type":"recipe"},"sidebar":"main","previous":{"title":"Version and Publish","permalink":"/docs/features/version-and-publish"},"next":{"title":"Workspace Watching","permalink":"/docs/features/workspace-watching"}}');var M=t(4848),i=t(8453);const o={id:"editor-integrations",title:"Editor Integrations",type:"recipe"},s="Editor Integrations",r={},l=[{value:"Download",id:"download",level:2},{value:"VSCode",id:"vscode",level:3},{value:"WebStorm",id:"webstorm",level:3},{value:"Nx Console for VSCode",id:"nx-console-for-vscode",level:2}];function F(e){const U={a:"a",h1:"h1",h2:"h2",h3:"h3",header:"header",img:"img",li:"li",p:"p",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(U.header,{children:(0,M.jsx)(U.h1,{id:"editor-integrations",children:"Editor Integrations"})}),"\n",(0,M.jsx)(U.p,{children:"Nx Console displays the npm scripts for all your projects in the VS Code sidebar and allows you to run them with a single click or open the script definition in your editor."}),"\n",(0,M.jsx)(U.h2,{id:"download",children:"Download"}),"\n",(0,M.jsx)(U.h3,{id:"vscode",children:"VSCode"}),"\n",(0,M.jsxs)(U.p,{children:["If you are using ",(0,M.jsx)(U.a,{href:"https://code.visualstudio.com/",children:"VSCode"}),", you can install the ",(0,M.jsx)(U.a,{href:"https://marketplace.visualstudio.com/items?itemName=nrwl.angular-console",children:"Nx Console VSCode Plugin"})," from Marketplace. The Nx Console VSCode Plugin is ",(0,M.jsx)(U.strong,{children:"built and maintained by the Nx team"}),"."]}),"\n",(0,M.jsx)(U.h3,{id:"webstorm",children:"WebStorm"}),"\n",(0,M.jsxs)(U.p,{children:["If you are using ",(0,M.jsx)(U.a,{href:"https://www.jetbrains.com/webstorm/",children:"WebStorm"}),", you can install one of the available plugins:"]}),"\n",(0,M.jsxs)(U.ul,{children:["\n",(0,M.jsx)(U.li,{children:(0,M.jsx)(U.a,{href:"https://plugins.jetbrains.com/plugin/15000-nx-webstorm",children:"nx-webstorm"})}),"\n",(0,M.jsx)(U.li,{children:(0,M.jsx)(U.a,{href:"https://plugins.jetbrains.com/plugin/15101-nx-console-idea",children:"Nx Console Idea"})}),"\n"]}),"\n",(0,M.jsxs)(U.p,{children:["These plugins are ",(0,M.jsx)(U.strong,{children:"NOT"})," built or maintained by the Nx team. They are maintained by independent community contributors."]}),"\n",(0,M.jsx)(U.h2,{id:"nx-console-for-vscode",children:"Nx Console for VSCode"}),"\n",(0,M.jsx)(U.p,{children:(0,M.jsx)(U.img,{alt:"Nx Console logo",src:t(1412).A+"",width:"536",height:"97"})}),"\n",(0,M.jsxs)(U.ul,{children:["\n",(0,M.jsx)(U.li,{children:(0,M.jsx)(U.a,{href:"https://marketplace.visualstudio.com/items?itemName=nrwl.angular-console",children:"Install from the VSCode Marketplace"})}),"\n",(0,M.jsx)(U.li,{children:(0,M.jsx)(U.a,{href:"https://github.com/nrwl/nx-console",children:"Contribute on GitHub"})}),"\n"]})]})}function a(e={}){const{wrapper:U}={...(0,i.R)(),...e.components};return U?(0,M.jsx)(U,{...e,children:(0,M.jsx)(F,{...e})}):F(e)}},1412:(e,U,t)=>{t.d(U,{A:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhgAAABhCAMAAACj6CgCAAAC/VBMVEUAAAAAAAAAAIAAVVUAQEAAM2YAK1UkJEkgQGAcOVUaM00XLl0VK1UUJ04SN1sRM1UQMFAPLVoOK1UNNlEaM1kYMVUXLlEWLFkVNVUUM1IUMVgTL1USLlISLFgRM1UQMVIYMFgXLlUXLVMWM1cVMlUVMFMUL1cULlUTM1MTMlcSMVUSL1MRLlcXLVUWMlMWMVcVMFUVL1MULlcUMlUUMVMTMFcTL1UTLlMSMlcSMVUWMFQWMFYVL1UVLlQVMVYUMVUUMFQUL1YTLlUTMVQTMVYSMFUSL1QWL1YVMlUVMVQVMFYUMFUUL1QULlYUMVUTMFQTMFYTL1UTL1QWMVYVMVUVMFQVL1YVL1UUMVQUMVYUMFUUMFQTL1YTMVUTMVQTMFYVMFUVL1QVL1YVMVUUMFQUMFYUMFUUL1QUMVYTMVUTMFQTMFYTL1UVMVQVMVYVMFUUMFQUL1YUL1UUMVQUMFYUMFUTMFQTL1YTMVUTMFQVMFYVMFUVL1QUMVYUMVUUMFQUMFYUL1UTMVYTMFUTMFQVMFYVL1UVMVQUMFYUMFUUMFQUL1YUMVUUMFQUMFYTMFUTL1QTL1YVMVUVMFQVMFYUMFUUL1QUMVYUMFUUMFQUMFYUL1UTMVQTMFYTMFUVMFQVMFYUL1UUMFQUMFYUMFUUMFQUL1YUMVUUMFQUMFYTMFUTL1UVMVUVMFUUMFUUMFUUMFUUMVUUMFUUMFUUMFUUMFUUL1UTMVUVMFUVMFUUMFUUL1UUMVUUMFUUMFUUMFUUMFUUMVUUMFUUMFUTMFUVMFUVL1UUMFUUMFUUMFUUMFUUMVUUMFUUMFUUMFUUMFUTMVUVMFUUMFUUMFUUMFUUL1UUMFUUMFUUMFUUMFUUMFUUMFUUMFUTMFUUMFUUMFUUMVUUMFUUMFUUMFUUMFUUL1UUMFUUMFUUMFUUMFUVMFUUMFUUMFUUMFUUMFUUMFUUMFUUMFUUMFUUMFUUMFUUL1UUMFUUMFUUMFUUMFUUMFUUMFUUMFUUMFX///8bH95IAAAA/XRSTlMAAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/QEFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaW1xdXl9gYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXp7fH1+f4CBg4SFhoeIiYqLjI2Oj5CRkpOUlZaXmJmam5ydnp+goaKjpKWmp6ipqqusra6vsLGys7S1tre4ubq7vL2+v8DBwsPExcbHyMrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+sLZwygAAAAFiS0dE/tIAwlMAAAxoSURBVHja7ZxpeFNVGoBPulL2IjuDthWHpYAsgqC4ICiiIwygguPCDgIqy4g4DIrgBrgWZliUbdwYRQQFlKkUEBS1VZQZsJSwy1b2QkvbNO/zzI+bpGlyt5A4D3nme3/lnnO/nJPk7dnuOVVKEARBEARBEARBEARBEARBEARBEARBEARBEARBEARBEARBEARBEARBEARBEARBEC4z8OF+wJc4A3+q+90es7FCFgXX/Ca1iu00at6azdnZ65dOuaOavZCWg1/7dEP295nLpvatY3135xEjRgwwzBlxi2lw/fteWrYxO3vTykVjb6pqr3ZNH561Kis7O/Oj6fc1sL67/ejRo0f3tPfOvxttREqExKCoo7UYKvVsRTO+jo28FtctOOZXQvGqPjFWEWmzdvtFuDaOqmwR8BrAY3o5rwMsNI6M6Z/l9iur9PNHqlv+ds/v9Iso+2acletTAFbZ+7LuwIheYYpR4nQ6nU7nMTjUoFyMI1qq82KAGGogkO/JdF6AZyKtRafMoI+4637TiCbvlQZGHJ9cyVqM0ltDF6PDT0G1Ozc5yayoxguLAyNOTa8aBWLkai+q/Qw5lX1i9Pbkfx8ohloGOQme13e6Ke0UUS1qzivT+5BrahtGxP+1UC9i122WYnAiNVQxhpfqlfWTSac47pxexP57okYMlXIcPnRYi1FzP7zgvZgLu6tF0ItmeeV/iHnZO076rvalG0TU3uS75/zu7G37XL4x02SHlRj8WDk0MQZ6epGinOVvzf9g/RFPUW8YllN9ja92hc7sH/eW+C5nxESLGKpLMUy2FkPdUkaZtxGuvBMWRM6LG057Rgmrh6Q5lFIqsXvGQS3paJpuRIrTo0HmyGtilFIq6frp3vHG4hgrMXg3JDGu1tqmDb28/VTa4HUucDczKqbevz3lbHq8eaxSSiW0f2aHJ2lFfOTEOFZPh8RIiaEGg/t+azHUq3Aw2fO6XTHcGykvWmgthHtpE7/EhPEnAT7U/R7r5mrf8vKW/s33n/Zqqa9bisGEUMR4B8A1qkJag1lFXxqVUuMHrZC17f0SHX/0DEWXOCImxpHfYrpaLoZ6EwpaW4uRuA3e8V5MhvwGkalLde33PBg4JqyVCe/G6fbgWwA42Tsgvep87bsfbimG6077YtQoApgUNLpsZ1CIQ+tHCh4MSK80Syt7UtSIEbsG9tW1FEO1KATvqkfMBljniEhd3gbgh4bB48tFC/V7hb8AsKdpcM54N8C5VCsxOHm1bTF6AhyLt/15RgJwuE1wzmAXwMVW0SKGqv4f+DrRUgw1Ds5c5Z2lnzJYEQiVLm6APN3lKX3zUosBjjfRy3sWgNWm01UAtlWxK8ZYgH/a/jx1zgGcvVYvbwwA30SNGCotH5ZYi+FYA195l7YegqJWEahKFsDFlqE2Me7bzdrxjiZivP8tAB87bIoxBWCe7drNBKC/yXCFO6NGDNW9FCZYiqEanoCnvBfvw/ZK4S9sATAlhIiGJWZTy8YFACtMxFjU4BAAT9sUYzxApt3a1TgP8IlB7hX5ABujRwz1GLi+txRD9YXitt6VjQMwM+yaZACcqBpCxDiAkquMsmcAFCebiKE6XwQou9ueGH0BStNt1u4RALdhUzoJwH1l9Iih5gLWYqiFsMO7FHyTi7LbwqyI41fwWzmzw2aA9w2zG7gAHjETQw3SlqivsSVG/TKAvOb2arcK4AvD7GoXAMZFkRjx622JUSUXZvt1p4dqhVeRFADahBARfxGgj/EN6wHmmoqh5gGws4atdYzPALgwqbqd6uUDDDXO/8h4KHt5iqFq5dkRQ11XgvsP3t/oO1geXkX6ApwOZd7bBsCdbHzDZIBvzcWI11bUV8bYEaNFkTbFPf3uoEZWtbsSgFTjGx4FyIsCMTr7noY1O2NHDPUcHKvned28EB4KqyJPmQzG9LkXYL/JDXcBnDAXQ9XTltyftSOGurf8GdqOjHtMHxLdBnDWYTHYLouJiBglW4OoETExuh5p7E3s4bIjRtw3sNZRPmY9kxJORV40HzDoMBxgq1WTUuowF0O1KwRw97Mjhurmv1OkdMuzxiPRfqDTGgc1KTUjIoYOtSMnhu+pu1JP2hFDLYPtCb5oXJ3DqchsCPF53ASr2WMqAFUsxFAPaw9z0+2IoWplXKjw/W+fZNCXDQLIMZvOAnBlNIjht9Tzlg0xBkJRa++n3BfijCKIWQBLQokYA7DJ5IYWAO44KzG0iTK5Ne2IoVStoesqbMo4M0a3TXoAYLvJ+9QHoE5UiMFUb3Li1ZZiNDkHY7wXi2FbQlgVeQbg01AiHgT42eSGGwEKlKUYcVkAfBFrSwylVHK/uXl+v8GHCUYDnEMmb9IcgMSIiFG4JIiqERXDHbRB1lCMuK1+I4zecLF1eBUZbjxIN+rvAYriLN5yl7UY6oo9AEy3K4ZSSqWOXOHb/rpcp81oC+A2GQL2AzgZBbOSrgCFHeyK8TIc9c5J6hyFiWFWpANAWSiLIVcA0Nb4hrfBaBZdUQzV5gJ4NqPYFUMpFXfz7POaGaOCMxOLAboZR88EyIoOMcrgYH17YnQro6y792IlfBUTZkUqFQMMDCVkL8Bzxr/bcfDuSbMQQ+uWKGgVkhhKqdqrtC0kOu1WDkCGcWgewCvRIcZ72yE7yY4YyQfgZe/FEDjfJOyarAXYEEpEBsBuw/MLfQBobUsM9SoAe2uHKIZyzAGgk+4yDxw13EB+CwC3RocYc1OPwz/siLESsr1DrpSzpku/dtEeW9wQQkQXAB40+slyAHYqe2LEfg5AZmyIYqjEQwCjgzPSAXjcKC4T4HBslIihupYE7DjTF2O03xm0mI3wWcV5bKYxxjWpmg+hzW0c2wB+NVhIGAXAWJtiqFraFuIZoYqhllZYOPVjA8CphvpR/QGYpqJFDDUEynpZidGiEAaVL4aRX3FgMg1jTKryNABvhlB5rbNYoTu8aVUAcCTJrhjq2vMA7l9CFWOO0TYSrbNYr7sVMC0f4Gxy9Iih5mhjMDMxErfBR/6S3KciIUbVvYZbZO/ood9kaCdpZ+vMFq86AMAwZVsM1bf86KGBGA0N+4QhejmfAPCOTndR9xfAb6tTNIgRlwl76piKMRv2etf4E34IHJUoNQ2eSNNjj6kY6lbtEFpG0N/YsJKL+qdnUrSlhA+C2oXrDmtbPh0hiKFeshAjNm9O8AGlJi6AFnr319UerKwO+gJbaIdhtsRGkxgqORc2J5qI0dNN6Y3eixfgUHKwGPonyXPNxVBTtZ9lW8WNmo2WAiX6h1f6agfPdlUc3Vd6Tjvx5aynQhEjZrW5GAPAOTDA2prfmZxR7KadWj1wd4XU+Ce1c0uHU1RUiaGanobFxmLUO+o31urswh3UzF+yGMpzHMS99i6fmS1f0BaRSpvqRjzq+Sk39PG1Go0mas0Fx4zn0LpiqORdZmJoY90D4xv7pfXQzpUNMChmgOcg7tb+vhXquk/s8zxjuVZFmRjq9tLy0XyQGDH/gs3eNrByrt7BzUsXI2aW79HUuhnjhj4+ffEe70nUCUazXO9Z8vOZr4wbMmLSghzvqejc36sQxVDNzpiI0dFbt7z5o/p0SW/fdegbnicmhj2W6ud9FluY9fqEocMnzvvWe7b2gMlmtSkAh5cH09FAjKLlesSHJ8bB7hp/Lt8GNxZcw7TU3EAxJkLZEE9I9yWwM0lPjOe763HQSgylhhTojlkLjI9B3rRff5j7mcneLiMxVO8yk65k5AX9ksw2xbTbpR+TVV9ZiKFHHwMx9KkUnhh++PZHzjP8xyntAv7ZQ6mOxJc4K/FMJ9boRK022SKnqmXo/G+Cow+YlmIkhqfuBrOStI/dOpVbVMWspKQXi4NDTg4z3cN4+YoRn2UgRpVfAgqfqiIshlKdVrgqhLjW3GwRkZoR0M7sGpWkLk0Mx3LTdYxWc88EfKCvu1p9nkYzA2L2jbf4zxGXgxjz/SlfXa7z9/JU//fvOb8ir+o99e413xhblao9aFmuR45DHz9m58h00j0Lcjw7dU+sn9bO8v6/Op1O5wy9nOpbnE7nyyZL4N1nZJ3yfPOnv5xq65RJQo+/fefphk5teul6yx3PI3cYoPOw9oYdhoS3QeZyJSmt7c3tm1cOISL2ypY3dmha739Ruerp7bu2T68ZSkhM4/TO1zdroARBEARBEARBEARBEARBEARBEARBEARBEARBEARBEARBEARBEARBEARBEARBEP4/+C8wLse8ytQxFwAAAABJRU5ErkJggg=="},8453:(e,U,t)=>{t.d(U,{R:()=>o,x:()=>s});var n=t(6540);const M={},i=n.createContext(M);function o(e){const U=n.useContext(i);return n.useMemo((function(){return"function"==typeof e?e(U):{...U,...e}}),[U,e])}function s(e){let U;return U=e.disableParentContext?"function"==typeof e.components?e.components(M):e.components||M:o(e.components),n.createElement(i.Provider,{value:U},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/d589d3a7.9208d0a3.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[924],{7161:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>h,frontMatter:()=>s,metadata:()=>a,toc:()=>d});const a=JSON.parse('{"id":"getting-started","title":"Getting Started","description":"Lerna comes with a dedicated init command to assist you with both adding lerna to an existing repo, or creating one from scratch.","source":"@site/docs/getting-started.md","sourceDirName":".","slug":"/getting-started","permalink":"/docs/getting-started","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/getting-started.md","tags":[],"version":"current","frontMatter":{"id":"getting-started","title":"Getting Started","type":"tutorial"},"sidebar":"main","previous":{"title":"Introduction","permalink":"/docs/introduction"},"next":{"title":"Lerna and Nx","permalink":"/docs/lerna-and-nx"}}');var r=t(4848),i=t(8453);const s={id:"getting-started",title:"Getting Started",type:"tutorial"},o="Getting Started",c={},d=[{value:"Starting from scratch",id:"starting-from-scratch",level:2},{value:"Adding lerna to an existing repo",id:"adding-lerna-to-an-existing-repo",level:2}];function l(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"getting-started",children:"Getting Started"})}),"\n",(0,r.jsx)("iframe",{width:"690",height:"400",src:"https://www.youtube.com/embed/hRe-_GCMfYQ",title:"YouTube video player",frameborder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",allowfullscreen:!0}),"\n",(0,r.jsxs)(n.p,{children:["Lerna comes with a dedicated ",(0,r.jsx)(n.code,{children:"init"})," command to assist you with both adding lerna to an existing repo, or creating one from scratch."]}),"\n",(0,r.jsx)(n.h2,{id:"starting-from-scratch",children:"Starting from scratch"}),"\n",(0,r.jsxs)(n.p,{children:["In the simplest case, ",(0,r.jsx)(n.code,{children:"lerna init"})," can be used to create a new repository in an empty directory. For that, we can run the following commands:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"# Create an empty directory\nmkdir ./new-lerna-workspace\n# Change into the new directory\ncd ./new-lerna-workspace\n# Initialize lerna (using --dryRun to preview the changes)\nnpx lerna init --dryRun\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Note that we have passed the ",(0,r.jsx)(n.code,{children:"--dryRun"})," flag here, this allows us to see a preview of the changes that ",(0,r.jsx)(n.code,{children:"lerna init"})," will make to our file system. This allows us to tweak the values of any other arguments we pass to ",(0,r.jsx)(n.code,{children:"lerna init"})," (such as ",(0,r.jsx)(n.code,{children:"--exact"})," or ",(0,r.jsx)(n.code,{children:"--independent"}),") without having to worry about undoing any mistakes."]}),"\n",(0,r.jsxs)(n.p,{children:["Once we are happy with the changes it will make, we can simply repeat the ",(0,r.jsx)(n.code,{children:"npx lerna init"})," command but leave off the ",(0,r.jsx)(n.code,{children:"--dryRun"})," flag."]}),"\n",(0,r.jsx)(n.p,{children:"You will now be up and running with a working git repository, including npm workspaces, with lerna available to create, version and publish any packages you wish to develop."}),"\n",(0,r.jsx)(n.h2,{id:"adding-lerna-to-an-existing-repo",children:"Adding lerna to an existing repo"}),"\n",(0,r.jsxs)(n.p,{children:["If you already have an existing repo, you can still add ",(0,r.jsx)(n.code,{children:"lerna"})," to it using ",(0,r.jsx)(n.code,{children:"lerna init"}),"."]}),"\n",(0,r.jsxs)(n.admonition,{type:"info",children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Lerna is not responsible for installing and linking your dependencies"})," in your repo, your package manager is much better suited to that task."]}),(0,r.jsxs)(n.p,{children:["Instead, we strongly recommend configuring your package manager of choice to use its ",(0,r.jsx)(n.code,{children:"workspaces"})," feature:"]}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"npm"})," (",(0,r.jsx)(n.a,{href:"https://docs.npmjs.com/cli/using-npm/workspaces",children:"https://docs.npmjs.com/cli/using-npm/workspaces"}),")"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"yarn"})," (",(0,r.jsx)(n.a,{href:"https://yarnpkg.com/features/workspaces",children:"https://yarnpkg.com/features/workspaces"}),")"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"pnpm"})," (",(0,r.jsx)(n.a,{href:"https://pnpm.io/workspaces",children:"https://pnpm.io/workspaces"}),")"]}),"\n"]})]}),"\n",(0,r.jsxs)(n.p,{children:["When initializing lerna on an existing repo, it will need a way to know what packages it should operate on. If you are using your package manager's ",(0,r.jsx)(n.code,{children:"workspaces"})," feature (see note above), then lerna will default to using the ",(0,r.jsx)(n.code,{children:"workspaces"})," patterns you have already configured. No extra arguments are required."]}),"\n",(0,r.jsxs)(n.p,{children:["Alternatively, you can manually specify a set of patterns to match against instead by using the ",(0,r.jsx)(n.code,{children:"--packages"})," flag for ",(0,r.jsx)(n.code,{children:"lerna init"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:'# Passing a single pattern\nnpx lerna init --packages="packages/*"\n# Passing multiple patterns\nnpx lerna init --packages="foo/*" --packages="bar/*"\n'})})]})}function h(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>o});var a=t(6540);const r={},i=a.createContext(r);function s(e){const n=a.useContext(i);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),a.createElement(i.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/df0717d9.ae8eda22.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[727],{3255:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>d,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});const i=JSON.parse('{"id":"concepts/dte-guide","title":"Distributed Task Execution Guide","description":"The illustrations in this guide are created by Nrwlian Nicole Oliver","source":"@site/docs/concepts/dte-guide.md","sourceDirName":"concepts","slug":"/concepts/dte-guide","permalink":"/docs/concepts/dte-guide","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/concepts/dte-guide.md","tags":[],"version":"current","frontMatter":{"id":"dte-guide","title":"Distributed Task Execution Guide","type":"explainer"},"sidebar":"main","previous":{"title":"How Caching Works","permalink":"/docs/concepts/how-caching-works"},"next":{"title":"Configuring Published Files","permalink":"/docs/concepts/configuring-published-files"}}');var a=s(4848),n=s(8453);const o={id:"dte-guide",title:"Distributed Task Execution Guide",type:"explainer"},r="Distributed Task Execution Guide",d={},c=[{value:"What's a Task?",id:"whats-a-task",level:2},{value:"Nx Cloud Schedules Your CI Tasks Automatically",id:"nx-cloud-schedules-your-ci-tasks-automatically",level:2},{value:"Nx Cloud Efficiently Orchestrates Agents",id:"nx-cloud-efficiently-orchestrates-agents",level:2},{value:"Task Execution Order Matters",id:"task-execution-order-matters",level:2},{value:"Why Distribute Tasks?",id:"why-distribute-tasks",level:2},{value:"What Does It Cost?",id:"what-does-it-cost",level:2},{value:"Security",id:"security",level:2},{value:"Example",id:"example",level:2},{value:"Illustration",id:"illustration",level:2}];function l(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",img:"img",p:"p",...(0,n.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.header,{children:(0,a.jsx)(t.h1,{id:"distributed-task-execution-guide",children:"Distributed Task Execution Guide"})}),"\n",(0,a.jsxs)(t.p,{children:["The illustrations in this guide are created by Nrwlian ",(0,a.jsx)(t.a,{href:"https://twitter.com/nixcodes",children:"Nicole Oliver"})]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.img,{alt:"how does distributed task execution work in Nx Cloud?",src:s(6114).A+"",width:"900",height:"343"})}),"\n",(0,a.jsx)(t.h2,{id:"whats-a-task",children:"What's a Task?"}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.img,{alt:"what's a task? project + target (i.e. shared-product-ui + test). each run contains many tasks. affected contains shared-product-ui, product-page, shared-e2e-util and shared-ui",src:s(3935).A+"",width:"680",height:"508"})}),"\n",(0,a.jsxs)(t.p,{children:["A task, from Lerna's perspective, is a target running on a project. i.e. The target ",(0,a.jsx)(t.code,{children:"test"})," running on the project ",(0,a.jsx)(t.code,{children:"shared-product-ui"})," is a task. For more information about tasks, see the ",(0,a.jsx)(t.a,{href:"../features/run-tasks",children:"Run Tasks article"}),"."]}),"\n",(0,a.jsx)(t.h2,{id:"nx-cloud-schedules-your-ci-tasks-automatically",children:"Nx Cloud Schedules Your CI Tasks Automatically"}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.img,{alt:"when you turn on DTE, Nx will schedule your commands' tasks in CI. for example, say you want to run these 3 commands to verify your code: nx affected --target=lint, nx affected --target=test and nx affected --target=build",src:s(7520).A+"",width:"680",height:"526"})}),"\n",(0,a.jsx)(t.p,{children:"Let's imagine for every PR in CI, you want to lint, test and build all affected projects. When you write your CI workflow, you have no way of knowing how many projects will be affected by each PR or how long each task will take. No matter how carefully you set things up, there will be wasted time if you manually assign a static number of agent machines for linting, testing and building. This approach is called binning."}),"\n",(0,a.jsx)(t.p,{children:"Luckily, with distributed task execution, Nx Cloud can dynamically assign tasks to agents as they become available."}),"\n",(0,a.jsx)(t.h2,{id:"nx-cloud-efficiently-orchestrates-agents",children:"Nx Cloud Efficiently Orchestrates Agents"}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.img,{alt:"Nx will automatically schedule tasks w/agents you assign in CI.",src:s(2210).A+"",width:"680",height:"310"})}),"\n",(0,a.jsx)(t.p,{children:"When you set up DTE, you define (1) the tasks that you want to run and (2) the number of agents that are available for Nx Cloud to use. Then the Nx Cloud orchestrator distributes tasks to agents efficiently - so that all the agents are being fully utilized and your CI process finishes as soon as possible."}),"\n",(0,a.jsx)(t.h2,{id:"task-execution-order-matters",children:"Task Execution Order Matters"}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.img,{alt:"but don't some tasks depend on others' results? Yep! Nx knows about your dependency tree, so it will execute tasks in the right order and make sure the results are available where they're needed.",src:s(2871).A+"",width:"680",height:"557"})}),"\n",(0,a.jsxs)(t.p,{children:["There are some tasks that need to be executed before other tasks, but Nx Cloud takes that into account when it assigns tasks to agents. For a more detailed look at defining those dependencies, read the ",(0,a.jsx)(t.a,{href:"../features/run-tasks",children:"Run Tasks article"}),"."]}),"\n",(0,a.jsx)(t.h2,{id:"why-distribute-tasks",children:"Why Distribute Tasks?"}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.img,{alt:"Result: Faster Builds!",src:s(4339).A+"",width:"680",height:"440"})}),"\n",(0,a.jsx)(t.p,{children:"Efficiently parallelizing your CI process across many agents can dramatically speed up your CI, which helps developers identify problems faster and get more work done."}),"\n",(0,a.jsx)(t.h2,{id:"what-does-it-cost",children:"What Does It Cost?"}),"\n",(0,a.jsxs)(t.p,{children:["Nx Cloud is FREE for open source projects. Contact ",(0,a.jsx)(t.a,{href:"mailto:cloud-support@nrwl.io",children:"cloud-support@nrwl.io"})," to get set up."]}),"\n",(0,a.jsx)(t.p,{children:"For closed source projects, the first 500 computation hours per month are free. Most workspaces don't exceed this amount. No credit card is required. After 500 hours, the cost is $1 per computation hour."}),"\n",(0,a.jsxs)(t.p,{children:["For more details, see the ",(0,a.jsx)(t.a,{href:"https://nx.app/pricing",children:"Nx Cloud pricing page"}),"."]}),"\n",(0,a.jsx)(t.h2,{id:"security",children:"Security"}),"\n",(0,a.jsx)(t.p,{children:"Your actual code is not stored in the cloud, but the hashed inputs and cached results of your tasks are. It is possible to enable end to end encryption of that data so that no one can view that information without your key. Also, if you want to host Nx Cloud on your own servers, you can sign up for Nx Private Cloud."}),"\n",(0,a.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.a,{href:"https://github.com/vsavkin/lerna-dte",children:"This is an example repo"})," showing how easy it is to set up distributed task\nexecution, showing the performance gains, and comparing to sharding/binning."]}),"\n",(0,a.jsx)(t.h2,{id:"illustration",children:"Illustration"}),"\n",(0,a.jsxs)(t.p,{children:["Here is the full illustrated explanation page that ",(0,a.jsx)(t.a,{href:"https://twitter.com/nixcodes",children:"Nicole Oliver"})," made:"]}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.img,{alt:"How Does DTE Work Explainer",src:s(9924).A+"",width:"1668",height:"2388"})})]})}function u(e={}){const{wrapper:t}={...(0,n.R)(),...e.components};return t?(0,a.jsx)(t,{...e,children:(0,a.jsx)(l,{...e})}):l(e)}},4339:(e,t,s)=>{s.d(t,{A:()=>i});const i=s.p+"assets/images/faster-builds-59a232e5f98a04d44a5e2bc82eaff792.jpeg"},6114:(e,t,s)=>{s.d(t,{A:()=>i});const i=s.p+"assets/images/how-does-dte-work-577993a1c7e19ef801bc76623f3c58f0.jpeg"},9924:(e,t,s)=>{s.d(t,{A:()=>i});const i=s.p+"assets/images/nx-cloud-how-does-dte-work-65244729488886b3b40e4072491a3393.png"},7520:(e,t,s)=>{s.d(t,{A:()=>i});const i=s.p+"assets/images/schedule-tasks-71d06587de8f289c9955a1052051d2de.jpeg"},2871:(e,t,s)=>{s.d(t,{A:()=>i});const i=s.p+"assets/images/task-dependencies-ba3f69e12b4a12cac2454ce509aa58c3.jpeg"},2210:(e,t,s)=>{s.d(t,{A:()=>i});const i=s.p+"assets/images/use-agents-d6bc7fdc5c63f4a871171cf0cf63e114.jpeg"},3935:(e,t,s)=>{s.d(t,{A:()=>i});const i=s.p+"assets/images/whats-a-task-7552def96ccf59b70629c3afe745b61a.jpeg"},8453:(e,t,s)=>{s.d(t,{R:()=>o,x:()=>r});var i=s(6540);const a={},n=i.createContext(a);function o(e){const t=i.useContext(n);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function r(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),i.createElement(n.Provider,{value:t},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/e5379f2c.2760bb5f.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[473],{3409:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>d});const i=JSON.parse('{"id":"api-reference/utilities","title":"Utilities","description":"Lerna ships some utility functions that can be used in creating your own tools within a Lerna monorepo.","source":"@site/docs/api-reference/utilities.md","sourceDirName":"api-reference","slug":"/api-reference/utilities","permalink":"/docs/api-reference/utilities","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/api-reference/utilities.md","tags":[],"version":"current","frontMatter":{"id":"utilities","title":"Utilities","type":"reference"},"sidebar":"main","previous":{"title":"Configuration","permalink":"/docs/api-reference/configuration"},"next":{"title":"Lerna and Nx Version Matrix","permalink":"/docs/lerna-and-nx-version-matrix"}}');var r=n(4848),s=n(8453);const o={id:"utilities",title:"Utilities",type:"reference"},c="Utilities",a={},d=[{value:"detectProjects()
",id:"detectprojects",level:2}];function l(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.header,{children:(0,r.jsx)(t.h1,{id:"utilities",children:"Utilities"})}),"\n",(0,r.jsx)(t.p,{children:"Lerna ships some utility functions that can be used in creating your own tools within a Lerna monorepo."}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:'const utils = require("lerna/utils");\n'})}),"\n",(0,r.jsx)(t.h2,{id:"detectprojects",children:(0,r.jsx)(t.code,{children:"detectProjects()"})}),"\n",(0,r.jsxs)(t.p,{children:["The ",(0,r.jsx)(t.code,{children:"detectProjects()"})," function creates the same project graph file mapping that Lerna uses under the covers to execute its commands. This is useful for writing your own scripts that need to operate on the same set of packages that Lerna would. You may pass a parameter for a custom working directory to the function if you need to use a different workspace root."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",children:'const path = require("path");\nconst { detectProjects } = require("lerna/utils");\n\nconst { projectGraph, projectFileMap } = await detectProjects();\nconst { projectGraph, projectFileMap } = await detectProjects(path.resolve("./custom-workspace-root"));\n'})}),"\n",(0,r.jsxs)(t.p,{children:["The ",(0,r.jsx)(t.code,{children:"projectGraph"})," that is returned will be a ",(0,r.jsx)(t.code,{children:"ProjectGraphWithPackages"}),", which is an extension of the ",(0,r.jsx)(t.code,{children:"ProjectGraph"})," type from ",(0,r.jsx)(t.code,{children:"@nx/devkit"}),". It contains additional metadata about projects that have ",(0,r.jsx)(t.code,{children:"package.json"})," files. It also has a ",(0,r.jsx)(t.code,{children:"localPackageDependencies"})," property that tracks internal npm dependencies between projects (as opposed to external npm dependencies that are downloaded from the registry)."]}),"\n",(0,r.jsxs)(t.p,{children:["The ",(0,r.jsx)(t.code,{children:"projectFileMap"})," is a mapping of project names to the files within them. This is used to determine which project needs to be versioned when a file changes."]}),"\n",(0,r.jsxs)(t.p,{children:["See ",(0,r.jsx)(t.a,{href:"https://github.com/lerna/lerna/blob/main/libs/core/src/lib/project-graph-with-packages.ts",children:"Lerna's TypeScript source code"})," for specific type details."]})]})}function p(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>c});var i=n(6540);const r={},s=i.createContext(r);function o(e){const t=i.useContext(s);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),i.createElement(s.Provider,{value:t},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/ead156ee.88dacb36.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[763],{1144:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>r,default:()=>h,frontMatter:()=>o,metadata:()=>i,toc:()=>c});const i=JSON.parse('{"id":"features/distribute-tasks","title":"Distribute Task Execution","description":"Lerna speeds up your average CI time with caching and the --since flag. But neither of these features help with the worst case scenario. When something at the core of your repo has been modified and every task needs to be run in CI, the only way to improve the performance is by adding more agent jobs and efficiently parallelizing the tasks.","source":"@site/docs/features/distribute-tasks.md","sourceDirName":"features","slug":"/features/distribute-tasks","permalink":"/docs/features/distribute-tasks","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/features/distribute-tasks.md","tags":[],"version":"current","frontMatter":{"id":"distribute-tasks","title":"Distribute Task Execution","type":"recipe"},"sidebar":"main","previous":{"title":"Explore the Project Graph","permalink":"/docs/features/project-graph"},"next":{"title":"Version and Publish","permalink":"/docs/features/version-and-publish"}}');var s=t(4848),a=t(8453);const o={id:"distribute-tasks",title:"Distribute Task Execution",type:"recipe"},r="Distribute Task Execution (DTE)",l={},c=[{value:"Set up",id:"set-up",level:2},{value:"CI Execution Flow",id:"ci-execution-flow",level:2},{value:"Running Things in Parallel",id:"running-things-in-parallel",level:2},{value:"CI/CD Examples",id:"cicd-examples",level:2},{value:"Relevant Repositories and Examples",id:"relevant-repositories-and-examples",level:2}];function d(e){const n={a:"a",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",header:"header",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"distribute-task-execution-dte",children:"Distribute Task Execution (DTE)"})}),"\n",(0,s.jsxs)(n.p,{children:["Lerna speeds up your average CI time with ",(0,s.jsx)(n.a,{href:"/docs/features/cache-tasks",children:"caching"})," and the ",(0,s.jsx)(n.code,{children:"--since"})," flag. But neither of these features help with the worst case scenario. When something at the core of your repo has been modified and every task needs to be run in CI, the only way to improve the performance is by adding more agent jobs and efficiently parallelizing the tasks."]}),"\n",(0,s.jsx)(n.p,{children:"The most obvious way to parallelize tasks is to split tasks up by type: running all tests on one job, all builds on another and all lint tasks on a third. This strategy is called binning. This can be made difficult if some test tasks have build tasks as prerequisites, but assuming you figure out some way to handle that, a typical set up can look like the diagram below. Here the test tasks are delayed until all necessary build artifacts are ready, but the build and lint tasks can start right away."}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"CI using binning",src:t(2039).A+"",width:"730",height:"440"})}),"\n",(0,s.jsx)(n.p,{children:"The problem with the binning approach is you'll end up with some idle time on one or more jobs. Nx's distributed task execution reduces that idle time to the minimum possible by assigning each individual task to agent jobs based on the task's average run time. Nx also guarantees that tasks are executed in the correct order and uses distributed caching to make sure that build artifacts from previous tasks are present on every agent job that needs them."}),"\n",(0,s.jsx)(n.p,{children:"When you set up Nx's distributed task execution, your task graph will look more like this:"}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"CI using DTE",src:t(2507).A+"",width:"730",height:"440"})}),"\n",(0,s.jsx)(n.p,{children:"And not only will CI finish faster, but the debugging experience is the same as if you ran all of your CI on a single job. That's because Nx uses distributed caching to recreate all of the logs and build artifacts on the main job."}),"\n",(0,s.jsxs)(n.p,{children:["Find more information in this ",(0,s.jsx)(n.a,{href:"https://nx.dev/concepts/dte",children:"detailed guide to improve your worst case CI times"}),"."]}),"\n",(0,s.jsx)(n.h2,{id:"set-up",children:"Set up"}),"\n",(0,s.jsx)(n.p,{children:"To distribute your task execution, you need to (1) connect to Nx Cloud and (2) enable DTE in your CI workflow. Each of these steps can be enabled with a single command:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-shell",metastring:'title="1. Connect to Nx Cloud"',children:"nx connect-to-nx-cloud\n"})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-shell",metastring:'title="2. Enable DTE in CI"',children:"nx generate @nrwl/workspace:ci-workflow --ci=github\n"})}),"\n",(0,s.jsxs)(n.p,{children:["The ",(0,s.jsx)(n.code,{children:"--ci"})," flag can be ",(0,s.jsx)(n.code,{children:"github"}),", ",(0,s.jsx)(n.code,{children:"circleci"})," or ",(0,s.jsx)(n.code,{children:"azure"}),". For more details on setting up DTE, read ",(0,s.jsx)(n.a,{href:"https://nx.dev/nx-cloud/set-up/set-up-dte",children:"this guide"}),"."]}),"\n",(0,s.jsx)(n.h2,{id:"ci-execution-flow",children:"CI Execution Flow"}),"\n",(0,s.jsx)(n.p,{children:"Distributed task execution can work on any CI provider. You are responsible for launching jobs in your CI system. Nx Cloud then coordinates the way those jobs work together. There are two different kinds of jobs that you'll need to create in your CI system."}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsx)(n.li,{children:"One main job that controls what is going to be executed"}),"\n",(0,s.jsx)(n.li,{children:"Multiple agent jobs that actually execute the tasks"}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"The main job execution flow looks like this:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-yaml",children:"# Coordinate the agents to run the tasks\n- npx nx-cloud start-ci-run\n# Run any commands you want here\n- lerna run lint --since=main & lerna run test --since=main & lerna run build --since=main\n# Stop any run away agents\n- npx nx-cloud stop-all-agents\n"})}),"\n",(0,s.jsx)(n.p,{children:"The agent job execution flow is very simple:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-yaml",children:"# Wait for tasks to execute\n- npx nx-cloud start-agent\n"})}),"\n",(0,s.jsxs)(n.p,{children:["The main job looks more or less the same way as if you haven't used any distribution. The only thing you need to do is\nto invoke ",(0,s.jsx)(n.code,{children:"npx nx-cloud start-ci-run"})," at the beginning and optionally invoke ",(0,s.jsx)(n.code,{children:"npx nx-cloud stop-all-agents"})," at the end."]}),"\n",(0,s.jsxs)(n.p,{children:["The agent jobs run long-running ",(0,s.jsx)(n.code,{children:"start-agent"})," processes that execute all the tasks associated with a given CI run. The\nonly thing you need to do to set them up is to invoke ",(0,s.jsx)(n.code,{children:"npx nx-cloud start-agent"}),". This process will keep running until\nNx Cloud tells it to terminate."]}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:"Note it's important that the main job and the agent jobs have the same environment and the same source code. They start\naround the same time. And, once the main job completes, all the agents\nwill be stopped."}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"It's also important to note that an Nx Cloud agent isn't a machine but rather a long-running process that runs on a\nmachine. I.e., Nx Cloud doesn't manage your agents--you need to do it in your CI config (check out CI examples below)."}),"\n",(0,s.jsx)(n.p,{children:"Nx Cloud is an orchestrator. The main job tells Nx Cloud what you want to run, and Nx Cloud will distribute those tasks\nacross the agents. Nx Cloud will automatically move files from one agent to another, from the agents to the main job."}),"\n",(0,s.jsxs)(n.p,{children:["The end result is that when say ",(0,s.jsx)(n.code,{children:"lerna run build --since=main"})," completes on the main job, all the file artifacts created\non agents are copied over to the main job, as if the main job had built everything locally."]}),"\n",(0,s.jsx)(n.h2,{id:"running-things-in-parallel",children:"Running Things in Parallel"}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"--concurrency"})," is propagated to the agents. E.g., ",(0,s.jsx)(n.code,{children:"npx lerna run build --since=main --concurrency=3 --dte"})," tells Nx Cloud to run\nup to 3 build targets in parallel on each agent. So if you have say 10 agents, you will run up to 30 builds in parallel\nacross all of them."]}),"\n",(0,s.jsx)(n.p,{children:"You also want to run as many commands in parallel as you can. For instance,"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-yaml",children:"- lerna run lint --since=main\n- lerna run test --since=main\n- lerna run build --since=main\n"})}),"\n",(0,s.jsx)(n.p,{children:"is worse than"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-yaml",children:"- lerna run lint --since=main & lerna run test --since=main & lerna run build --since=main\n"})}),"\n",(0,s.jsx)(n.p,{children:"The latter is going to schedule all the three commands at the same time, so if an agent cannot find anything to build, it will start running tests and lints. The result is better agent utilization and shorter CI time."}),"\n",(0,s.jsx)(n.h2,{id:"cicd-examples",children:"CI/CD Examples"}),"\n",(0,s.jsx)(n.p,{children:"The examples below show how to set up CI using Nx and Nx Cloud using distributed task execution and distributed caching."}),"\n",(0,s.jsx)(n.p,{children:"Every organization manages their CI/CD pipelines differently, so the examples don't cover org-specific aspects of\nCI/CD (e.g., deployment). They mainly focus on configuring Nx correctly."}),"\n",(0,s.jsx)(n.p,{children:"Read the guides for more information on how to configure them in CI."}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://nx.dev/ci/recipes/set-up",children:"Overview"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://nx.dev/ci/recipes/set-up/monorepo-ci-azure",children:"Azure Pipelines"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://nx.dev/ci/recipes/set-up/monorepo-ci-circle-ci",children:"Circle CI"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://nx.dev/ci/recipes/set-up/monorepo-ci-github-actions",children:"GitHub Actions"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://nx.dev/ci/recipes/set-up/monorepo-ci-jenkins",children:"Jenkins"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://nx.dev/ci/recipes/set-up/monorepo-ci-gitlab",children:"GitLab"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://nx.dev/ci/recipes/set-up/monorepo-ci-bitbucket-pipelines",children:"Bitbucket"})}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"Note that only cacheable operations can be distributed because they have to be replayed on the main job."}),"\n",(0,s.jsx)(n.h2,{id:"relevant-repositories-and-examples",children:"Relevant Repositories and Examples"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/vsavkin/interstellar",children:"Nx: On how to make your CI 16 times faster with a small config change"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/vsavkin/lerna-dte",children:'"Lerna & Distributed Task Execution" Example'})}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},2507:(e,n,t)=>{t.d(n,{A:()=>i});const i=t.p+"assets/images/3agents-b4eed3c22ef0fe31ac45d1f0ce854b2b.svg"},2039:(e,n,t)=>{t.d(n,{A:()=>i});const i=t.p+"assets/images/binning-2266f5ba9543a1974a7864232a37a389.svg"},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>r});var i=t(6540);const s={},a=i.createContext(s);function o(e){const n=i.useContext(a);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function r(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),i.createElement(a.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/f2c7bef6.a961b5ea.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[18],{4459:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>h});const n=JSON.parse('{"id":"features/project-graph","title":"Explore the Project Graph","description":"For Lerna (and Nx) to run tasks quickly and correctly, it creates a graph of the dependencies between all the projects in the repository. Exploring this graph visually can be useful to understand why Lerna is behaving in a certain way and to get a high level view of your code architecture.","source":"@site/docs/features/project-graph.md","sourceDirName":"features","slug":"/features/project-graph","permalink":"/docs/features/project-graph","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/features/project-graph.md","tags":[],"version":"current","frontMatter":{"id":"project-graph","title":"Explore the Project Graph","type":"recipe"},"sidebar":"main","previous":{"title":"Share Your Cache","permalink":"/docs/features/share-your-cache"},"next":{"title":"Distribute Task Execution","permalink":"/docs/features/distribute-tasks"}}');var a=r(4848),o=r(8453);const i={id:"project-graph",title:"Explore the Project Graph",type:"recipe"},s="Explore the Project Graph",c={},h=[{value:"JSON Project Graph",id:"json-project-graph",level:2}];function l(e){const t={code:"code",h1:"h1",h2:"h2",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.header,{children:(0,a.jsx)(t.h1,{id:"explore-the-project-graph",children:"Explore the Project Graph"})}),"\n",(0,a.jsx)(t.p,{children:"For Lerna (and Nx) to run tasks quickly and correctly, it creates a graph of the dependencies between all the projects in the repository. Exploring this graph visually can be useful to understand why Lerna is behaving in a certain way and to get a high level view of your code architecture."}),"\n",(0,a.jsx)(t.p,{children:"To launch the project graph visualization run:"}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{className:"language-bash",children:"nx graph\n"})}),"\n",(0,a.jsx)(t.p,{children:"This will open a browser window with an interactive representation of the project graph of your current codebase. Viewing the entire graph can be unmanageable even for smaller repositories, so there are several ways to narrow the focus of the visualization down to the most useful part of the graph at the moment."}),"\n",(0,a.jsxs)(t.ol,{children:["\n",(0,a.jsx)(t.li,{children:"Focus on a specific project and then use the proximity and group by folder controls to modify the graph around that project."}),"\n",(0,a.jsx)(t.li,{children:"Use the search bar to find all projects with names that contain a certain string."}),"\n",(0,a.jsx)(t.li,{children:"Manually hide or show projects in the sidebar"}),"\n"]}),"\n",(0,a.jsx)(t.p,{children:"Once the graph is displayed, you can click on an individual dependency link to find out what specific file(s) created that dependency."}),"\n",(0,a.jsx)(t.h2,{id:"json-project-graph",children:"JSON Project Graph"}),"\n",(0,a.jsx)(t.p,{children:"If you prefer to analyze the underlying data of the project graph with a script or some other tool, you can run:"}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{className:"language-bash",children:"nx graph --file=output.json\n"})}),"\n",(0,a.jsx)(t.p,{children:"This will give you all the information that is used to create the project graph visualization."})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,a.jsx)(t,{...e,children:(0,a.jsx)(l,{...e})}):l(e)}},8453:(e,t,r)=>{r.d(t,{R:()=>i,x:()=>s});var n=r(6540);const a={},o=n.createContext(a);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function s(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/fdfb3855.83360ae9.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[210],{470:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>l,contentTitle:()=>c,default:()=>x,frontMatter:()=>s,metadata:()=>t,toc:()=>o});const t=JSON.parse('{"id":"lerna-and-nx-version-matrix","title":"Lerna and Nx Version Matrix","description":"The latest version of Lerna is kept up to date with the latest major version of Nx in order to support the latest features. If you have an older version of Lerna or Nx, you can use the table below to ensure compatibility between the two.","source":"@site/docs/lerna-and-nx-version-matrix.md","sourceDirName":".","slug":"/lerna-and-nx-version-matrix","permalink":"/docs/lerna-and-nx-version-matrix","draft":false,"unlisted":false,"editUrl":"https://github.com/lerna/lerna/tree/main/website/docs/lerna-and-nx-version-matrix.md","tags":[],"version":"current","frontMatter":{"id":"lerna-and-nx-version-matrix","title":"Lerna and Nx Version Matrix","type":"explainer"},"sidebar":"main","previous":{"title":"Utilities","permalink":"/docs/api-reference/utilities"},"next":{"title":"Legacy Package Management","permalink":"/docs/legacy-package-management"}}');var d=r(4848),i=r(8453);const s={id:"lerna-and-nx-version-matrix",title:"Lerna and Nx Version Matrix",type:"explainer"},c="Lerna and Nx Versions",l={},o=[{value:"Lerna and Nx Version Compatibility Matrix",id:"lerna-and-nx-version-compatibility-matrix",level:2}];function a(e){const n={code:"code",em:"em",h1:"h1",h2:"h2",header:"header",p:"p",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,i.R)(),...e.components};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(n.header,{children:(0,d.jsx)(n.h1,{id:"lerna-and-nx-versions",children:"Lerna and Nx Versions"})}),"\n",(0,d.jsx)(n.p,{children:"The latest version of Lerna is kept up to date with the latest major version of Nx in order to support the latest features. If you have an older version of Lerna or Nx, you can use the table below to ensure compatibility between the two."}),"\n",(0,d.jsx)(n.h2,{id:"lerna-and-nx-version-compatibility-matrix",children:"Lerna and Nx Version Compatibility Matrix"}),"\n",(0,d.jsx)(n.p,{children:"Below is a reference table that matches versions of Lerna to the version of Nx that is compatible with it."}),"\n",(0,d.jsx)(n.p,{children:"We provide a recommended version, and it is usually the latest minor version of Nx in the range provided because there will have been bug fixes added since the first release in the range."}),"\n",(0,d.jsxs)(n.table,{children:[(0,d.jsx)(n.thead,{children:(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.th,{children:"Lerna Version"}),(0,d.jsx)(n.th,{children:(0,d.jsxs)(n.strong,{children:["Nx Version ",(0,d.jsx)(n.em,{children:"(recommended)"})]})}),(0,d.jsxs)(n.th,{children:["Nx Version ",(0,d.jsx)(n.em,{children:"(range)"})]})]})}),(0,d.jsxs)(n.tbody,{children:[(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">=8.0.0 <= latest"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.strong,{children:"latest"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">=17.1.2 < 21"})})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">=7.1.4 < 8.0.0"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"16.10.0"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">=16.5.1 < 17"})})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">= 7.0.0 < 7.1.4"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"16.10.0"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">=16.3.1 < 17"})})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">= 6.5.0 < 7.0.0"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"15.9.4"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">=15.5.2 < 16"})})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">= 6.4.0 < 6.5.0"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"15.9.4"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">=15.4.2 < 16"})})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">= 6.0.1 < 6.4.0"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"15.9.4"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">=14.8.6 < 16"})})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">= 5.6.0 < 6.0.1"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"15.9.4"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">=14.8.1 < 16"})})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">=5.5.0 < 5.6.0"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"15.9.4"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">=14.6.1 < 16"})})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">=5.4.0 < 5.5.0"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"15.9.4"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">=14.5.4 < 16"})})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">= 5.2.0 < 5.4.0"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"15.9.4"})}),(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:">=14.4.3 < 16"})})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.code,{children:"< 5.2.0"})}),(0,d.jsx)(n.td,{children:"N/A*"}),(0,d.jsx)(n.td,{children:"N/A*"})]})]})]}),"\n",(0,d.jsx)(n.p,{children:"*Lerna does not depend on Nx before version 5.2.0"})]})}function x(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,d.jsx)(n,{...e,children:(0,d.jsx)(a,{...e})}):a(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>c});var t=r(6540);const d={},i=t.createContext(d);function s(e){const n=t.useContext(i);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(d):e.components||d:s(e.components),t.createElement(i.Provider,{value:n},e.children)}}}]);
--------------------------------------------------------------------------------
/assets/js/main.55e4c2d9.js.LICENSE.txt:
--------------------------------------------------------------------------------
1 | /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
2 | * @license MIT */
3 |
4 | /*! Bundled license information:
5 |
6 | prismjs/prism.js:
7 | (**
8 | * Prism: Lightweight, robust, elegant syntax highlighting
9 | *
10 | * @license MIT
11 | * @author Lea Verou
12 | * @namespace
13 | * @public
14 | *)
15 | */
16 |
17 | /**
18 | * @license React
19 | * react-dom.production.min.js
20 | *
21 | * Copyright (c) Facebook, Inc. and its affiliates.
22 | *
23 | * This source code is licensed under the MIT license found in the
24 | * LICENSE file in the root directory of this source tree.
25 | */
26 |
27 | /**
28 | * @license React
29 | * react-jsx-runtime.production.min.js
30 | *
31 | * Copyright (c) Facebook, Inc. and its affiliates.
32 | *
33 | * This source code is licensed under the MIT license found in the
34 | * LICENSE file in the root directory of this source tree.
35 | */
36 |
37 | /**
38 | * @license React
39 | * react.production.min.js
40 | *
41 | * Copyright (c) Facebook, Inc. and its affiliates.
42 | *
43 | * This source code is licensed under the MIT license found in the
44 | * LICENSE file in the root directory of this source tree.
45 | */
46 |
47 | /**
48 | * @license React
49 | * scheduler.production.min.js
50 | *
51 | * Copyright (c) Facebook, Inc. and its affiliates.
52 | *
53 | * This source code is licensed under the MIT license found in the
54 | * LICENSE file in the root directory of this source tree.
55 | */
56 |
57 | /** @license React v16.13.1
58 | * react-is.production.min.js
59 | *
60 | * Copyright (c) Facebook, Inc. and its affiliates.
61 | *
62 | * This source code is licensed under the MIT license found in the
63 | * LICENSE file in the root directory of this source tree.
64 | */
65 |
--------------------------------------------------------------------------------
/assets/js/runtime~main.af94e216.js:
--------------------------------------------------------------------------------
1 | (()=>{"use strict";var e,a,t,r,d,f={},b={};function o(e){var a=b[e];if(void 0!==a)return a.exports;var t=b[e]={id:e,loaded:!1,exports:{}};return f[e].call(t.exports,t,t.exports,o),t.loaded=!0,t.exports}o.m=f,o.c=b,e=[],o.O=(a,t,r,d)=>{if(!t){var f=1/0;for(i=0;i=d)&&Object.keys(o.O).every((e=>o.O[e](t[c])))?t.splice(c--,1):(b=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[t,r,d]},o.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return o.d(a,{a:a}),a},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var d=Object.create(null);o.r(d);var f={};a=a||[null,t({}),t([]),t(t)];for(var b=2&r&&e;"object"==typeof b&&!~a.indexOf(b);b=t(b))Object.getOwnPropertyNames(b).forEach((a=>f[a]=()=>e[a]));return f.default=()=>e,o.d(d,f),d},o.d=(e,a)=>{for(var t in a)o.o(a,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:a[t]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((a,t)=>(o.f[t](e,a),a)),[])),o.u=e=>"assets/js/"+({13:"9d9f8394",18:"f2c7bef6",19:"d7954a39",48:"a94703ab",70:"0480b142",98:"a7bd4aaa",147:"714aece2",148:"85d9af9a",180:"a5d4e17f",210:"fdfb3855",234:"4b30c9f8",235:"a7456010",351:"35dd6042",362:"b8844bda",377:"3d3845f1",401:"17896441",410:"d55206b1",446:"004b9cd7",473:"e5379f2c",583:"1df93b7f",616:"c0ae5a06",629:"c44efb77",647:"5e95c892",726:"4f271799",727:"df0717d9",742:"aba21aa0",760:"623bb9fe",763:"ead156ee",769:"9b50cbb9",849:"0058b4c6",868:"517cf5ca",899:"a09c2993",923:"2fb89d45",924:"d589d3a7",969:"14eb3368",980:"2e9a6f4f"}[e]||e)+"."+{13:"7408c5eb",18:"a961b5ea",19:"c3808589",42:"07919f24",48:"01908dc4",70:"1a65481d",98:"e8a160ba",147:"fb172a94",148:"d977e4ad",158:"b69d5ad9",180:"774a4dc3",210:"83360ae9",234:"8344c8bf",235:"dee63f34",351:"94e12006",362:"8469d2f2",377:"996b56cc",401:"7f93ddb1",410:"8192417d",446:"b1483e35",473:"2760bb5f",583:"9151e514",616:"58f706a8",627:"fc178e33",629:"9aa012a7",647:"b114d62c",726:"2ede6fa8",727:"ae8eda22",742:"7f4ce930",760:"d8387f7a",763:"88dacb36",769:"6e738715",809:"65d2179a",849:"14eab1f3",868:"f46010f9",899:"df0289f5",913:"f65583d1",923:"85d9eee7",924:"9208d0a3",969:"b3f4fe9b",980:"a3ab3bb4"}[e]+".js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),r={},d="website:",o.l=(e,a,t,f)=>{if(r[e])r[e].push(a);else{var b,c;if(void 0!==t)for(var n=document.getElementsByTagName("script"),i=0;i{b.onerror=b.onload=null,clearTimeout(s);var d=r[e];if(delete r[e],b.parentNode&&b.parentNode.removeChild(b),d&&d.forEach((e=>e(t))),a)return a(t)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:b}),12e4);b.onerror=l.bind(null,b.onerror),b.onload=l.bind(null,b.onload),c&&document.head.appendChild(b)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.p="/",o.gca=function(e){return e={17896441:"401","9d9f8394":"13",f2c7bef6:"18",d7954a39:"19",a94703ab:"48","0480b142":"70",a7bd4aaa:"98","714aece2":"147","85d9af9a":"148",a5d4e17f:"180",fdfb3855:"210","4b30c9f8":"234",a7456010:"235","35dd6042":"351",b8844bda:"362","3d3845f1":"377",d55206b1:"410","004b9cd7":"446",e5379f2c:"473","1df93b7f":"583",c0ae5a06:"616",c44efb77:"629","5e95c892":"647","4f271799":"726",df0717d9:"727",aba21aa0:"742","623bb9fe":"760",ead156ee:"763","9b50cbb9":"769","0058b4c6":"849","517cf5ca":"868",a09c2993:"899","2fb89d45":"923",d589d3a7:"924","14eb3368":"969","2e9a6f4f":"980"}[e]||e,o.p+o.u(e)},(()=>{var e={354:0,869:0};o.f.j=(a,t)=>{var r=o.o(e,a)?e[a]:void 0;if(0!==r)if(r)t.push(r[2]);else if(/^(354|869)$/.test(a))e[a]=0;else{var d=new Promise(((t,d)=>r=e[a]=[t,d]));t.push(r[2]=d);var f=o.p+o.u(a),b=new Error;o.l(f,(t=>{if(o.o(e,a)&&(0!==(r=e[a])&&(e[a]=void 0),r)){var d=t&&("load"===t.type?"missing":t.type),f=t&&t.target&&t.target.src;b.message="Loading chunk "+a+" failed.\n("+d+": "+f+")",b.name="ChunkLoadError",b.type=d,b.request=f,r[1](b)}}),"chunk-"+a,a)}},o.O.j=a=>0===e[a];var a=(a,t)=>{var r,d,f=t[0],b=t[1],c=t[2],n=0;if(f.some((a=>0!==e[a]))){for(r in b)o.o(b,r)&&(o.m[r]=b[r]);if(c)var i=c(o)}for(a&&a(t);n
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/images/background/parcel.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/images/background/parcel.avif
--------------------------------------------------------------------------------
/images/background/rocket.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/images/background/rocket.avif
--------------------------------------------------------------------------------
/images/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/images/favicon-16x16.png
--------------------------------------------------------------------------------
/images/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/images/favicon-32x32.png
--------------------------------------------------------------------------------
/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/images/favicon.ico
--------------------------------------------------------------------------------
/images/og-image-lerna-upgrade.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/images/og-image-lerna-upgrade.jpg
--------------------------------------------------------------------------------
/images/og-image-lerna.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lerna/website/f01ef2a2a06bd6a5ac10089aa81ad1b04ad69ba7/images/og-image-lerna.png
--------------------------------------------------------------------------------
/site.webmanifest:
--------------------------------------------------------------------------------
1 | {
2 | "name": "",
3 | "short_name": "",
4 | "icons": [
5 | { "src": "/images/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" },
6 | { "src": "/images/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" }
7 | ],
8 | "theme_color": "#9333EA",
9 | "background_color": "#F8FAFC",
10 | "display": "standalone"
11 | }
12 |
--------------------------------------------------------------------------------
/sitemap.xml:
--------------------------------------------------------------------------------
1 | https://lerna.js.org/upgradeweekly0.5https://lerna.js.org/docs/api-reference/commandsweekly0.5https://lerna.js.org/docs/api-reference/configurationweekly0.5https://lerna.js.org/docs/api-reference/utilitiesweekly0.5https://lerna.js.org/docs/conceptsweekly0.5https://lerna.js.org/docs/concepts/configuring-published-filesweekly0.5https://lerna.js.org/docs/concepts/dte-guideweekly0.5https://lerna.js.org/docs/concepts/how-caching-worksweekly0.5https://lerna.js.org/docs/concepts/task-pipeline-configurationweekly0.5https://lerna.js.org/docs/faqweekly0.5https://lerna.js.org/docs/featuresweekly0.5https://lerna.js.org/docs/features/cache-tasksweekly0.5https://lerna.js.org/docs/features/distribute-tasksweekly0.5https://lerna.js.org/docs/features/editor-integrationsweekly0.5https://lerna.js.org/docs/features/project-graphweekly0.5https://lerna.js.org/docs/features/run-tasksweekly0.5https://lerna.js.org/docs/features/share-your-cacheweekly0.5https://lerna.js.org/docs/features/version-and-publishweekly0.5https://lerna.js.org/docs/features/workspace-watchingweekly0.5https://lerna.js.org/docs/getting-startedweekly0.5https://lerna.js.org/docs/introductionweekly0.5https://lerna.js.org/docs/legacy-package-managementweekly0.5https://lerna.js.org/docs/lerna-and-nxweekly0.5https://lerna.js.org/docs/lerna-and-nx-version-matrixweekly0.5https://lerna.js.org/docs/lerna6-obsolete-optionsweekly0.5https://lerna.js.org/docs/recipes/using-pnpm-with-lernaweekly0.5https://lerna.js.org/docs/troubleshootingweekly0.5https://lerna.js.org/weekly0.5
--------------------------------------------------------------------------------