Skip to content

Commit ea9f0b0

Browse files
authored
Fetch packages from registry directly, not with npm CLI (#1114)
1 parent 48eaddc commit ea9f0b0

26 files changed

Lines changed: 1228 additions & 700 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ $ beachball publish -r http://localhost:4873 -t beta
9393

9494
### Overriding concurrency
9595

96-
In large monorepos, the process of fetching versions for sync or before publishing can be time-consuming due to the high number of packages. To optimize performance, you can override the concurrency for npm read operations by setting `options.npmReadConcurrency` (default: 5). You can also increase concurrency for hook calls and publish operations via `options.concurrency` (default: 1; respects topological order).
96+
In large monorepos, the process of fetching versions for sync or before publishing can be time-consuming due to the high number of packages. To optimize performance, you can override the concurrency for fetching from the registry by setting `options.npmReadConcurrency` (default: 10). You can also increase concurrency for hook calls and publish operations via `options.concurrency` (default: 1; respects topological order).
9797

9898
### API surface
9999

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "minor",
3+
"comment": "Fetch package info directly from the registry, not with npm CLI. This should be a significant performance improvement when publishing or syncing many packages. The default `npmReadConcurrency` has been increased to 10 since this is a lighter-weight operation.",
4+
"packageName": "beachball",
5+
"email": "elcraig@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

docs/overview/configuration.md

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,32 +74,34 @@ For the latest full list of supported options, see `RepoOptions` [in this file](
7474
<!-- prettier-ignore -->
7575
| Option | Type | Default | Applies to | Description |
7676
| ------ | ---- | ------- | ---------- | ----------- |
77-
| `access` | `'public'` or `'restricted'` | `'restricted'` | repo | publish access level for scoped package names (e.g. `@foo/bar`) |
78-
| `branch` | `string` | [see notes][5] | repo | target branch; [see notes][5] |
79-
| `bumpDeps` | `boolean` | `true` | repo | bump dependent packages during publish (if B is bumped, and A depends on B, also bump A) |
80-
| `changeFilePrompt` | [`ChangeFilePromptOptions`][1] | | repo | customize the prompt for change files (can be used to add custom fields) |
81-
| `changehint` | `string` | | repo | hint message for when change files are not detected but required |
82-
| `changeDir` | `string` | `change` | repo | directory where change files are stored (relative to repo root) |
83-
| `changelog` | [`ChangelogOptions`][2] | | repo | changelog rendering and grouping options |
84-
| `defaultNpmTag` | `string` | `'latest'` | repo, package | the default dist-tag used for NPM publish |
85-
| `disallowedChangeTypes` | `string[]` | | repo, package | what change types are disallowed |
86-
| `fetch` | `boolean` | `true` | repo | fetch from remote before doing diff comparisons |
87-
| `generateChangelog` | `boolean \| 'md' \| 'json'` | `true` | repo | whether to generate `CHANGELOG.md/json` (`'md'` or `'json'` to generate only that type) |
88-
| `gitTags` | `boolean` | `true` | repo, package | whether to create git tags for published packages (eg: foo_v1.0.1) |
89-
| `groups` | [`VersionGroupOptions[]`][3] | | repo | bump these packages together ([see details][3]) |
90-
| `groupChanges` | `boolean` | `false` | repo | write multiple changes to a single changefile |
91-
| `hooks` | [`HooksOptions`][4] | | repo | hooks for custom pre/post publish actions |
92-
| `ignorePatterns` | `string[]` | | repo | ignore changes in files matching these glob patterns ([see notes][6]) |
93-
| `package` | `string` | | repo | specifies which package the command relates to (overrides change detection based on `git diff`) |
94-
| `prereleasePrefix` | `string` | | repo | prerelease prefix, e.g. "beta"; note that if this is specified, packages with change type major/minor/patch will be bumped as prerelease instead |
95-
| `publish` | `boolean` | `true` | repo | whether to publish to npm registry |
96-
| `push` | `boolean` | `true` | repo | whether to push to the remote git branch |
97-
| `registry` | `string` | | repo | target NPM registry to publish |
98-
| `retries` | `number` | `3` | repo | number of retries for a package publish before failing |
99-
| `scope` | `string[]` | | repo | only consider package paths matching these patterns ([see details](#scoping)) |
100-
| `shouldPublish` | `false \| undefined` | | package | manually disable publishing of a package by beachball (does not work to force publishing) |
101-
| `tag` | `string` | `'latest'` | repo, package | dist-tag for npm when published |
102-
| `transform` | [`TransformOptions`][4] | | repo | transformations for change files |
77+
| `access` | `'public'` or `'restricted'` | `'restricted'` | repo | Publish access level for scoped package names (e.g. `@foo/bar`) |
78+
| `branch` | `string` | [see notes][5] | repo | Target branch; [see notes][5] |
79+
| `bumpDeps` | `boolean` | `true` | repo | Bump dependent packages during publish (if B is bumped, and A depends on B, also bump A) |
80+
| `changeFilePrompt` | [`ChangeFilePromptOptions`][1] | | repo | Customize the prompt for change files (can be used to add custom fields) |
81+
| `changehint` | `string` | | repo | Hint message for when change files are not detected but required |
82+
| `changeDir` | `string` | `change` | repo | Directory where change files are stored (relative to repo root) |
83+
| `changelog` | [`ChangelogOptions`][2] | | repo | Changelog rendering and grouping options |
84+
| `concurrency` | `number` | 1 | repo | Maximum concurrency for write operations, such as npm publish and hook calls, respecting topological order (see also `npmReadConcurrency`) |
85+
| `defaultNpmTag` | `string` | `'latest'` | repo, package | The default `dist-tag` used for NPM publish |
86+
| `disallowedChangeTypes` | `string[]` | | repo, package | What change types are disallowed |
87+
| `fetch` | `boolean` | `true` | repo | Fetch from remote before doing diff comparisons |
88+
| `generateChangelog` | `boolean \| 'md' \| 'json'` | `true` | repo | Whether to generate `CHANGELOG.md/json` (`'md'` or `'json'` to generate only that type) |
89+
| `gitTags` | `boolean` | `true` | repo, package | Whether to create git tags for published packages (eg: `foo_v1.0.1`) |
90+
| `groups` | [`VersionGroupOptions[]`][3] | | repo | Bump these packages together ([see details][3]) |
91+
| `groupChanges` | `boolean` | `false` | repo | Write multiple changes to a single change file |
92+
| `hooks` | [`HooksOptions`][4] | | repo | Hooks for custom pre/post publish actions |
93+
| `ignorePatterns` | `string[]` | | repo | Ignore changes in files matching these glob patterns ([see notes][6]) |
94+
| `npmReadConcurrency` | number | 10 | repo | Maximum concurrency for fetching package versions from the registry (see `concurrency` for write operations) |
95+
| `package` | `string` | | repo | Specifies which package the command relates to (overrides change detection based on `git diff`) |
96+
| `prereleasePrefix` | `string` | | repo | Prerelease prefix, e.g. `"beta"`. Note that if this is specified, packages with change type major/minor/patch will be bumped as prerelease instead. |
97+
| `publish` | `boolean` | `true` | repo | Whether to publish to npm registry |
98+
| `push` | `boolean` | `true` | repo | Whether to push to the remote git branch |
99+
| `registry` | `string` | | repo | Publish to this npm registry |
100+
| `retries` | `number` | `3` | repo | Number of retries for a package publish before failing |
101+
| `scope` | `string[]` | | repo | Only consider package paths matching these patterns ([see details](#scoping)) |
102+
| `shouldPublish` | `false \| undefined` | | package | Manually disable publishing of a package by beachball (does not work to force publishing) |
103+
| `tag` | `string` | `'latest'` | repo, package | `dist-tag` for npm when published |
104+
| `transform` | [`TransformOptions`][4] | | repo | Transformations for change files |
103105

104106
[1]: https://github.com/microsoft/beachball/blob/main/src/types/ChangeFilePrompt.ts
105107
[2]: https://github.com/microsoft/beachball/blob/main/src/types/ChangelogOptions.ts

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"cosmiconfig": "^9.0.0",
5555
"execa": "^5.0.0",
5656
"minimatch": "^3.0.4",
57+
"npm-registry-fetch": "^14.0.0",
5758
"p-graph": "^1.1.2",
5859
"p-limit": "^3.0.2",
5960
"prompts": "^2.4.2",
@@ -66,6 +67,7 @@
6667
"@jest/globals": "^29.0.0",
6768
"@types/minimatch": "^5.0.0",
6869
"@types/node": "^14.0.0",
70+
"@types/npm-registry-fetch": "^8.0.9",
6971
"@types/prompts": "^2.4.2",
7072
"@types/semver": "^7.3.13",
7173
"@types/tmp": "^0.2.3",

0 commit comments

Comments
 (0)