diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c37cab5ca..68374e9dd 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "16.4.0" + ".": "16.4.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index edad8aa9f..ddb8667f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ [1]: https://www.npmjs.com/package/release-please?activeTab=versions +## [16.4.1](https://github.com/googleapis/release-please/compare/v16.4.0...v16.4.1) (2023-12-11) + + +### Bug Fixes + +* **node-workspace:** Add update-peer-dependencies option that also updates peer dependencies ([#2094](https://github.com/googleapis/release-please/issues/2094)) ([c84414a](https://github.com/googleapis/release-please/commit/c84414a3192cca65da4469c7559460624446c898)) +* pass pull request header and footer options to merge plugin ([#2143](https://github.com/googleapis/release-please/issues/2143)) ([e848100](https://github.com/googleapis/release-please/commit/e8481007981cf9fa3f476f65db4d3de807259e89)) + ## [16.4.0](https://github.com/googleapis/release-please/compare/v16.3.1...v16.4.0) (2023-12-05) diff --git a/docs/manifest-releaser.md b/docs/manifest-releaser.md index e3b768325..ce0b198a6 100644 --- a/docs/manifest-releaser.md +++ b/docs/manifest-releaser.md @@ -207,11 +207,6 @@ defaults (those are documented in comments) // absence defaults to true "always-link-local": false, - // when using the `node-workspace` plugin, update peer dependency fields - // that reference bumped packages. - // absence defaults to false, and peer dependency fields are not updated. - "update-peer-dependencies": true, - // if true, create separate pull requests for each package instead of a // single manifest release pull request // absence defaults to false and one pull request will be raised @@ -504,7 +499,18 @@ your local dependencies bumped if they are within the SemVer range, you can set By default, the `node-workspace` plugin doesn't modify `peerDependencies` fields in package.json. If you would like version bumps to be also linked in `peerDependencies` -fields, set `"update-peer-dependencies"` to `true` in your manifest config. +fields, set `"updatePeerDependencies"` to `true` in your manifest plugin config. + +``` +{ + "plugins": [ + { + "type": "node-workspace", + "updatePeerDependencies": true + } + ] +} +``` ### cargo-workspace diff --git a/package-lock.json b/package-lock.json index 892de2ce5..0bcb5535e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "release-please", - "version": "16.4.0", + "version": "16.4.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "release-please", - "version": "16.4.0", + "version": "16.4.1", "license": "Apache-2.0", "dependencies": { "@conventional-commits/parser": "^0.4.1", diff --git a/package.json b/package.json index 846e2d6fc..139874521 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "release-please", - "version": "16.4.0", + "version": "16.4.1", "description": "generate release PRs based on the conventionalcommits.org spec", "main": "./build/src/index.js", "bin": "./build/src/bin/release-please.js", diff --git a/schemas/config.json b/schemas/config.json index a3e170e8b..716d7daf8 100644 --- a/schemas/config.json +++ b/schemas/config.json @@ -248,10 +248,6 @@ "description": "When using the `node-workspace` plugin, force all local dependencies to be linked.", "type": "boolean" }, - "update-peer-dependencies": { - "description": "When using the `node-workspace` plugin, also bump peer dependency versions if they are modified.", - "type": "boolean" - }, "plugins": { "description": "Plugins to apply to pull requests. Plugins can be added to perform extra release processing that cannot be achieved by an individual release strategy.", "type": "array", @@ -304,7 +300,31 @@ "type": "string", "enum": [ "cargo-workspace", - "maven-workspace", + "maven-workspace" + ] + }, + "updateAllPackages": { + "description": "Whether to force updating all packages regardless of the dependency tree. Defaults to `false`.", + "type": "boolean" + }, + "merge": { + "description": "Whether to merge in-scope pull requests into a combined release pull request. Defaults to `true`.", + "type": "boolean" + }, + "considerAllArtifacts": { + "description": "Whether to analyze all packages in the workspace for cross-component version bumping. This currently only works for the maven-workspace plugin. Defaults to `true`.", + "type": "boolean" + } + } + }, + { + "description": "Configuration for various `workspace` plugins.", + "type": "object", + "properties": { + "type": { + "description": "The name of the plugin.", + "type": "string", + "enum": [ "node-workspace" ] }, @@ -319,6 +339,10 @@ "considerAllArtifacts": { "description": "Whether to analyze all packages in the workspace for cross-component version bumping. This currently only works for the maven-workspace plugin. Defaults to `true`.", "type": "boolean" + }, + "updatePeerDependencies": { + "description": "Also bump peer dependency versions if they are modified. Defaults to `false`.", + "type": "boolean" } } }, @@ -387,7 +411,6 @@ "bootstrap-sha": true, "last-release-sha": true, "always-link-local": true, - "update-peer-dependencies": true, "plugins": true, "group-pull-request-title-pattern": true, "release-search-depth": true, diff --git a/src/manifest.ts b/src/manifest.ts index aaac3cc65..e41847a2b 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -181,7 +181,6 @@ export interface ManifestOptions { bootstrapSha?: string; lastReleaseSha?: string; alwaysLinkLocal?: boolean; - updatePeerDependencies?: boolean; separatePullRequests?: boolean; plugins?: PluginType[]; fork?: boolean; @@ -224,6 +223,9 @@ export interface WorkspacePluginConfig extends ConfigurablePluginType { merge?: boolean; considerAllArtifacts?: boolean; } +export interface NodeWorkspacePluginConfig extends WorkspacePluginConfig { + updatePeerDependencies?: boolean; +} export interface GroupPriorityPluginConfig extends ConfigurablePluginType { groups: string[]; } @@ -233,7 +235,8 @@ export type PluginType = | GroupPriorityPluginConfig | LinkedVersionPluginConfig | SentenceCasePluginConfig - | WorkspacePluginConfig; + | WorkspacePluginConfig + | NodeWorkspacePluginConfig; /** * This is the schema of the manifest config json @@ -243,7 +246,6 @@ export interface ManifestConfig extends ReleaserConfigJson { 'bootstrap-sha'?: string; 'last-release-sha'?: string; 'always-link-local'?: boolean; - 'update-peer-dependencies'?: boolean; plugins?: PluginType[]; 'group-pull-request-title-pattern'?: string; 'release-search-depth'?: number; @@ -1391,7 +1393,6 @@ async function parseConfig( bootstrapSha: config['bootstrap-sha'], lastReleaseSha: config['last-release-sha'], alwaysLinkLocal: config['always-link-local'], - updatePeerDependencies: config['update-peer-dependencies'], separatePullRequests: config['separate-pull-requests'], groupPullRequestTitlePattern: config['group-pull-request-title-pattern'], plugins: config['plugins'], diff --git a/src/plugins/node-workspace.ts b/src/plugins/node-workspace.ts index 66827d111..3241c5760 100644 --- a/src/plugins/node-workspace.ts +++ b/src/plugins/node-workspace.ts @@ -67,7 +67,7 @@ interface NodeWorkspaceOptions extends WorkspacePluginOptions { */ export class NodeWorkspace extends WorkspacePlugin { private alwaysLinkLocal: boolean; - private updatePeerDependencies: boolean; + readonly updatePeerDependencies: boolean; constructor( github: GitHub, targetBranch: string, diff --git a/test/factories/plugin-factory.ts b/test/factories/plugin-factory.ts index f08d11703..ef78222a4 100644 --- a/test/factories/plugin-factory.ts +++ b/test/factories/plugin-factory.ts @@ -25,6 +25,7 @@ import {LinkedVersions} from '../../src/plugins/linked-versions'; import {ManifestPlugin} from '../../src/plugin'; import {GitHub} from '../../src'; import {GroupPriority} from '../../src/plugins/group-priority'; +import {NodeWorkspace} from '../../src/plugins/node-workspace'; describe('PluginFactory', () => { let github: GitHub; @@ -97,6 +98,20 @@ describe('PluginFactory', () => { expect(plugin).to.not.be.undefined; expect(plugin).instanceof(GroupPriority); }); + it('should build workspace options', () => { + const plugin = buildPlugin({ + github, + type: { + type: 'node-workspace', + updatePeerDependencies: true, + }, + targetBranch: 'target-branch', + repositoryConfig, + manifestPath: '.manifest.json', + }); + expect(plugin).to.not.be.undefined; + expect(plugin).instanceof(NodeWorkspace); + }); }); describe('getPluginTypes', () => { it('should return default types', () => { diff --git a/test/fixtures/manifest/config/node-workspace-plugins.json b/test/fixtures/manifest/config/node-workspace-plugins.json new file mode 100644 index 000000000..e282374db --- /dev/null +++ b/test/fixtures/manifest/config/node-workspace-plugins.json @@ -0,0 +1,21 @@ +{ + "release-type": "node", + "plugins": [ + { + "type": "node-workspace", + "considerAllArtifacts": true, + "updatePeerDependencies": true + } + ], + "packages": { + "pkg1": { + "component": "pkg1" + }, + "pkg2": { + "component": "pkg2" + }, + "pkg3": { + "component": "pkg3" + } + } +} diff --git a/test/manifest.ts b/test/manifest.ts index 4c50131cf..31beb2880 100644 --- a/test/manifest.ts +++ b/test/manifest.ts @@ -773,6 +773,36 @@ describe('Manifest', () => { ).to.eql('default'); }); + it('should read plugins from manifest', async () => { + const getFileContentsStub = sandbox.stub( + github, + 'getFileContentsOnBranch' + ); + getFileContentsStub + .withArgs('release-please-config.json', 'main') + .resolves( + buildGitHubFileContent( + fixturesPath, + 'manifest/config/node-workspace-plugins.json' + ) + ) + .withArgs('.release-please-manifest.json', 'main') + .resolves( + buildGitHubFileContent( + fixturesPath, + 'manifest/versions/versions.json' + ) + ); + const manifest = await Manifest.fromManifest( + github, + github.repository.defaultBranch + ); + expect(manifest.plugins).lengthOf(1); + expect(manifest.plugins[0]).instanceOf(NodeWorkspace); + const workspacePlugin = manifest.plugins[0] as NodeWorkspace; + expect(workspacePlugin.updatePeerDependencies).to.be.true; + }); + it('should throw a configuration error for a missing manifest config', async () => { const getFileContentsStub = sandbox.stub( github,