Skip to content

Commit

Permalink
feat: Enable override to NPM_CONCURRENCY defaults through env variable (
Browse files Browse the repository at this point in the history
  • Loading branch information
nickymunga authored Aug 23, 2024
1 parent c72e93f commit c2cec80
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ show help message

skips the prompts for publish

## Overriding Concurrency

In large monorepos, the Beachball sync process can be time-consuming due to the high number of packages. To optimize performance, you can override the default concurrency (typically set to 2 or 5) by setting the NPM_CONCURRENCY environment variable to a value that best suits your needs

## Examples

```
Expand Down
7 changes: 7 additions & 0 deletions change/beachball-3a1535e5-d3c6-4f91-a673-17f6e527edb3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "override NPM_CONCURRENCY defaults through env variable",
"packageName": "beachball",
"email": "[email protected]",
"dependentChangeType": "patch"
}
2 changes: 2 additions & 0 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ export const env = Object.freeze({
// These are borrowed from workspace-tools
workspaceToolsGitDebug: !!process.env.GIT_DEBUG,
workspaceToolsGitMaxBuffer: (process.env.GIT_MAX_BUFFER && parseInt(process.env.GIT_MAX_BUFFER, 10)) || undefined,
// Override default NPM_CONCURRENCY
npmConcurrency: (process.env.NPM_CONCURRENCY && parseInt(process.env.NPM_CONCURRENCY)) || undefined
});
2 changes: 1 addition & 1 deletion src/packageManager/listPackageVersions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type NpmShowResult = PackageJson & {

let packageVersionsCache: { [pkgName: string]: NpmShowResult | false } = {};

const NPM_CONCURRENCY = env.isJest ? 2 : 5;
const NPM_CONCURRENCY = env.npmConcurrency ?? (env.isJest ? 2 : 5);

export function _clearPackageVersionsCache(): void {
packageVersionsCache = {};
Expand Down

0 comments on commit c2cec80

Please sign in to comment.