Skip to content

Commit

Permalink
Merge branch 'main' into export-version
Browse files Browse the repository at this point in the history
  • Loading branch information
chingor13 authored Dec 11, 2023
2 parents e7f6325 + a31ee08 commit afd28f7
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "16.4.0"
".": "16.4.1"
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
18 changes: 12 additions & 6 deletions docs/manifest-releaser.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
35 changes: 29 additions & 6 deletions schemas/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
]
},
Expand All @@ -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"
}
}
},
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 5 additions & 4 deletions src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ export interface ManifestOptions {
bootstrapSha?: string;
lastReleaseSha?: string;
alwaysLinkLocal?: boolean;
updatePeerDependencies?: boolean;
separatePullRequests?: boolean;
plugins?: PluginType[];
fork?: boolean;
Expand Down Expand Up @@ -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[];
}
Expand All @@ -233,7 +235,8 @@ export type PluginType =
| GroupPriorityPluginConfig
| LinkedVersionPluginConfig
| SentenceCasePluginConfig
| WorkspacePluginConfig;
| WorkspacePluginConfig
| NodeWorkspacePluginConfig;

/**
* This is the schema of the manifest config json
Expand All @@ -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;
Expand Down Expand Up @@ -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'],
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/node-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ interface NodeWorkspaceOptions extends WorkspacePluginOptions {
*/
export class NodeWorkspace extends WorkspacePlugin<Package> {
private alwaysLinkLocal: boolean;
private updatePeerDependencies: boolean;
readonly updatePeerDependencies: boolean;
constructor(
github: GitHub,
targetBranch: string,
Expand Down
15 changes: 15 additions & 0 deletions test/factories/plugin-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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', () => {
Expand Down
21 changes: 21 additions & 0 deletions test/fixtures/manifest/config/node-workspace-plugins.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
30 changes: 30 additions & 0 deletions test/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit afd28f7

Please sign in to comment.