release-please 14.2.3 → 14.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/build/src/factories/plugin-factory.js +2 -0
- package/build/src/manifest.d.ts +4 -1
- package/build/src/manifest.js +7 -1
- package/build/src/plugin.d.ts +6 -0
- package/build/src/plugin.js +10 -0
- package/build/src/plugins/sentence-case.d.ts +19 -0
- package/build/src/plugins/sentence-case.js +77 -0
- package/build/src/updaters/changelog.js +10 -1
- package/build/src/updaters/changelog.js.map +1 -1
- package/package.json +1 -1
- package/schemas/config.json +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,33 @@
|
|
|
4
4
|
|
|
5
5
|
[1]: https://www.npmjs.com/package/release-please?activeTab=versions
|
|
6
6
|
|
|
7
|
+
## [14.3.1](https://github.com/googleapis/release-please/compare/v14.3.0...v14.3.1) (2022-09-06)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **sentence-case:** handle multiple colons in subject ([0564594](https://github.com/googleapis/release-please/commit/05645949c771a3898a8521520322dd952c9aa6ff))
|
|
13
|
+
|
|
14
|
+
## [14.3.0](https://github.com/googleapis/release-please/compare/v14.2.4...v14.3.0) (2022-08-31)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* introduce `sentence-case` plugin that capitalizes commit messages ([414eb5f](https://github.com/googleapis/release-please/commit/414eb5f716662569c72ff4cae2b1d1c95c0441ea))
|
|
20
|
+
* introduce processCommits hook for plugins ([#1607](https://github.com/googleapis/release-please/issues/1607)) ([414eb5f](https://github.com/googleapis/release-please/commit/414eb5f716662569c72ff4cae2b1d1c95c0441ea))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* add changelog-path to valid config schema ([#1612](https://github.com/googleapis/release-please/issues/1612)) ([c2937ba](https://github.com/googleapis/release-please/commit/c2937ba9f96e7d7c78332ceba94d1ebcee35768b))
|
|
26
|
+
|
|
27
|
+
## [14.2.4](https://github.com/googleapis/release-please/compare/v14.2.3...v14.2.4) (2022-08-30)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* prepend release notes to non-conforming changelog ([#1615](https://github.com/googleapis/release-please/issues/1615)) ([7d6c4c5](https://github.com/googleapis/release-please/commit/7d6c4c5aabd39436762253b019e17a5922ffa560))
|
|
33
|
+
|
|
7
34
|
## [14.2.3](https://github.com/googleapis/release-please/compare/v14.2.2...v14.2.3) (2022-08-30)
|
|
8
35
|
|
|
9
36
|
|
|
@@ -19,11 +19,13 @@ const cargo_workspace_1 = require("../plugins/cargo-workspace");
|
|
|
19
19
|
const node_workspace_1 = require("../plugins/node-workspace");
|
|
20
20
|
const maven_workspace_1 = require("../plugins/maven-workspace");
|
|
21
21
|
const errors_1 = require("../errors");
|
|
22
|
+
const sentence_case_1 = require("../plugins/sentence-case");
|
|
22
23
|
const pluginFactories = {
|
|
23
24
|
'linked-versions': options => new linked_versions_1.LinkedVersions(options.github, options.targetBranch, options.repositoryConfig, options.type.groupName, options.type.components),
|
|
24
25
|
'cargo-workspace': options => new cargo_workspace_1.CargoWorkspace(options.github, options.targetBranch, options.repositoryConfig, options),
|
|
25
26
|
'node-workspace': options => new node_workspace_1.NodeWorkspace(options.github, options.targetBranch, options.repositoryConfig, options),
|
|
26
27
|
'maven-workspace': options => new maven_workspace_1.MavenWorkspace(options.github, options.targetBranch, options.repositoryConfig, options),
|
|
28
|
+
'sentence-case': options => new sentence_case_1.SentenceCase(options.github, options.targetBranch, options.repositoryConfig, options.type.specialWords),
|
|
27
29
|
};
|
|
28
30
|
function buildPlugin(options) {
|
|
29
31
|
if (typeof options.type === 'object') {
|
package/build/src/manifest.d.ts
CHANGED
|
@@ -132,10 +132,13 @@ export interface LinkedVersionPluginConfig extends ConfigurablePluginType {
|
|
|
132
132
|
components: string[];
|
|
133
133
|
merge?: boolean;
|
|
134
134
|
}
|
|
135
|
+
export interface SentenceCasePluginConfig extends ConfigurablePluginType {
|
|
136
|
+
specialWords?: string[];
|
|
137
|
+
}
|
|
135
138
|
export interface WorkspacePluginConfig extends ConfigurablePluginType {
|
|
136
139
|
merge?: boolean;
|
|
137
140
|
}
|
|
138
|
-
export declare type PluginType = DirectPluginType | ConfigurablePluginType | LinkedVersionPluginConfig | WorkspacePluginConfig;
|
|
141
|
+
export declare type PluginType = DirectPluginType | ConfigurablePluginType | LinkedVersionPluginConfig | SentenceCasePluginConfig | WorkspacePluginConfig;
|
|
139
142
|
/**
|
|
140
143
|
* This is the schema of the manifest config json
|
|
141
144
|
*/
|
package/build/src/manifest.js
CHANGED
|
@@ -329,7 +329,13 @@ class Manifest {
|
|
|
329
329
|
this.logger.info(`Building candidate release pull request for path: ${path}`);
|
|
330
330
|
this.logger.debug(`type: ${config.releaseType}`);
|
|
331
331
|
this.logger.debug(`targetBranch: ${this.targetBranch}`);
|
|
332
|
-
|
|
332
|
+
let pathCommits = commitsPerPath[path];
|
|
333
|
+
// The processCommits hook can be implemented by plugins to
|
|
334
|
+
// post-process commits. This can be used to perform cleanup, e.g,, sentence
|
|
335
|
+
// casing all commit messages:
|
|
336
|
+
for (const plugin of plugins) {
|
|
337
|
+
pathCommits = plugin.processCommits(pathCommits);
|
|
338
|
+
}
|
|
333
339
|
this.logger.debug(`commits: ${pathCommits.length}`);
|
|
334
340
|
const latestReleasePullRequest = releasePullRequestsBySha[releaseShasByPath[path]];
|
|
335
341
|
if (!latestReleasePullRequest) {
|
package/build/src/plugin.d.ts
CHANGED
|
@@ -16,6 +16,12 @@ export declare abstract class ManifestPlugin {
|
|
|
16
16
|
readonly repositoryConfig: RepositoryConfig;
|
|
17
17
|
protected logger: Logger;
|
|
18
18
|
constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, logger?: Logger);
|
|
19
|
+
/**
|
|
20
|
+
* Perform post-processing on commits, e.g, sentence casing them.
|
|
21
|
+
* @param {Commit[]} commits The set of commits that will feed into release pull request.
|
|
22
|
+
* @returns {Commit[]} The modified commit objects.
|
|
23
|
+
*/
|
|
24
|
+
processCommits(commits: Commit[]): Commit[];
|
|
19
25
|
/**
|
|
20
26
|
* Post-process candidate pull requests.
|
|
21
27
|
* @param {CandidateReleasePullRequest[]} pullRequests Candidate pull requests
|
package/build/src/plugin.js
CHANGED
|
@@ -28,6 +28,16 @@ class ManifestPlugin {
|
|
|
28
28
|
this.repositoryConfig = repositoryConfig;
|
|
29
29
|
this.logger = logger;
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Perform post-processing on commits, e.g, sentence casing them.
|
|
33
|
+
* @param {Commit[]} commits The set of commits that will feed into release pull request.
|
|
34
|
+
* @returns {Commit[]} The modified commit objects.
|
|
35
|
+
*/
|
|
36
|
+
// TODO: for next major version, let's run the default conventional commit parser earlier
|
|
37
|
+
// (outside of the strategy classes) and pass in the ConventionalCommit[] objects in.
|
|
38
|
+
processCommits(commits) {
|
|
39
|
+
return commits;
|
|
40
|
+
}
|
|
31
41
|
/**
|
|
32
42
|
* Post-process candidate pull requests.
|
|
33
43
|
* @param {CandidateReleasePullRequest[]} pullRequests Candidate pull requests
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ManifestPlugin } from '../plugin';
|
|
2
|
+
import { GitHub } from '../github';
|
|
3
|
+
import { RepositoryConfig } from '../manifest';
|
|
4
|
+
import { Commit } from '../commit';
|
|
5
|
+
/**
|
|
6
|
+
* This plugin converts commit messages to sentence case, for the benefit
|
|
7
|
+
* of the generated CHANGELOG.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SentenceCase extends ManifestPlugin {
|
|
10
|
+
specialWords: Set<string>;
|
|
11
|
+
constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, specialWords?: Array<string>);
|
|
12
|
+
/**
|
|
13
|
+
* Perform post-processing on commits, e.g, sentence casing them.
|
|
14
|
+
* @param {Commit[]} commits The set of commits that will feed into release pull request.
|
|
15
|
+
* @returns {Commit[]} The modified commit objects.
|
|
16
|
+
*/
|
|
17
|
+
processCommits(commits: Commit[]): Commit[];
|
|
18
|
+
toUpperCase(word: string): string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2022 Google LLC
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.SentenceCase = void 0;
|
|
17
|
+
const plugin_1 = require("../plugin");
|
|
18
|
+
// A list of words that should not be converted to uppercase:
|
|
19
|
+
const SPECIAL_WORDS = ['gRPC', 'npm'];
|
|
20
|
+
/**
|
|
21
|
+
* This plugin converts commit messages to sentence case, for the benefit
|
|
22
|
+
* of the generated CHANGELOG.
|
|
23
|
+
*/
|
|
24
|
+
class SentenceCase extends plugin_1.ManifestPlugin {
|
|
25
|
+
constructor(github, targetBranch, repositoryConfig, specialWords) {
|
|
26
|
+
super(github, targetBranch, repositoryConfig);
|
|
27
|
+
this.specialWords = new Set(specialWords ? [...specialWords] : SPECIAL_WORDS);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Perform post-processing on commits, e.g, sentence casing them.
|
|
31
|
+
* @param {Commit[]} commits The set of commits that will feed into release pull request.
|
|
32
|
+
* @returns {Commit[]} The modified commit objects.
|
|
33
|
+
*/
|
|
34
|
+
processCommits(commits) {
|
|
35
|
+
this.logger.info(`SentenceCase processing ${commits.length} commits`);
|
|
36
|
+
for (const commit of commits) {
|
|
37
|
+
// Check whether commit is in conventional commit format, if it is
|
|
38
|
+
// we'll split the string by type and description:
|
|
39
|
+
if (commit.message.includes(':')) {
|
|
40
|
+
const splitMessage = commit.message.split(':');
|
|
41
|
+
let prefix = splitMessage[0];
|
|
42
|
+
prefix += ': ';
|
|
43
|
+
let suffix = splitMessage.slice(1).join(':').trim();
|
|
44
|
+
// Extract the first word from the rest of the string:
|
|
45
|
+
const match = /\s|$/.exec(suffix);
|
|
46
|
+
if (match) {
|
|
47
|
+
const endFirstWord = match.index;
|
|
48
|
+
const firstWord = suffix.slice(0, endFirstWord);
|
|
49
|
+
suffix = suffix.slice(endFirstWord);
|
|
50
|
+
// Put the string back together again:
|
|
51
|
+
commit.message = `${prefix}${this.toUpperCase(firstWord)}${suffix}`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return commits;
|
|
56
|
+
}
|
|
57
|
+
/*
|
|
58
|
+
* Convert a string to upper case, taking into account a dictionary of
|
|
59
|
+
* common lowercase words, e.g., gRPC, npm.
|
|
60
|
+
*
|
|
61
|
+
* @param {string} word The original word.
|
|
62
|
+
* @returns {string} The word, now upper case.
|
|
63
|
+
*/
|
|
64
|
+
toUpperCase(word) {
|
|
65
|
+
if (this.specialWords.has(word)) {
|
|
66
|
+
return word;
|
|
67
|
+
}
|
|
68
|
+
if (word.match(/^[a-z]/)) {
|
|
69
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return word;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.SentenceCase = SentenceCase;
|
|
77
|
+
//# sourceMappingURL=sentence-case.js.map
|
|
@@ -28,7 +28,12 @@ class Changelog extends default_1.DefaultUpdater {
|
|
|
28
28
|
// Handle both H2 (features/BREAKING CHANGES) and H3 (fixes).
|
|
29
29
|
const lastEntryIndex = content.search(this.versionHeaderRegex);
|
|
30
30
|
if (lastEntryIndex === -1) {
|
|
31
|
-
|
|
31
|
+
if (content) {
|
|
32
|
+
return `${this.header()}\n${this.changelogEntry}\n\n${adjustHeaders(content).trim()}\n`;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return `${this.header()}\n${this.changelogEntry}\n`;
|
|
36
|
+
}
|
|
32
37
|
}
|
|
33
38
|
else {
|
|
34
39
|
const before = content.slice(0, lastEntryIndex);
|
|
@@ -43,4 +48,8 @@ class Changelog extends default_1.DefaultUpdater {
|
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
50
|
exports.Changelog = Changelog;
|
|
51
|
+
// Helper to increase markdown H1 headers to H2
|
|
52
|
+
function adjustHeaders(content) {
|
|
53
|
+
return content.replace(/^#(\s)/gm, '##$1');
|
|
54
|
+
}
|
|
46
55
|
//# sourceMappingURL=changelog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../../src/updaters/changelog.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,uCAAwD;AAOxD,MAAM,4BAA4B,GAAG,iBAAiB,CAAC;AAEvD,MAAa,SAAU,SAAQ,wBAAc;IAI3C,YAAY,OAAyB;;QACnC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,kBAAkB,GAAG,IAAI,MAAM,CAClC,MAAA,OAAO,CAAC,kBAAkB,mCAAI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AAa,CACjE,OAAO,CACR,CAAC,IAAI,EAAE,IAAI,CAAC;aACd;iBAAM;gBACL,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,cAAc,IAAI,CAAC;aACrD;SACF;aAAM;YACL,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;YAChD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;YAC5C,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC,cAAc,KAAK,KAAK,EAAE,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC;SACpE;IACH,CAAC;IACO,MAAM;QACZ,OAAO;;CAEV,CAAC;IACA,CAAC;CACF;AApCD,8BAoCC;AAED,+CAA+C;AAC/C,SAAS,aAAa,CAAC,OAAe;IACpC,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC"}
|
package/package.json
CHANGED
package/schemas/config.json
CHANGED
|
@@ -91,6 +91,10 @@
|
|
|
91
91
|
"description": "Generate changelog links to this GitHub host. Useful for running against GitHub Enterprise.",
|
|
92
92
|
"type": "string"
|
|
93
93
|
},
|
|
94
|
+
"changelog-path": {
|
|
95
|
+
"description": "Path to the file that tracks release note changes. Defaults to `CHANGELOG.md`.",
|
|
96
|
+
"type": "string"
|
|
97
|
+
},
|
|
94
98
|
"pull-request-title-pattern": {
|
|
95
99
|
"description": "Customize the release pull request title.",
|
|
96
100
|
"type": "string"
|
|
@@ -249,6 +253,13 @@
|
|
|
249
253
|
"merge": {
|
|
250
254
|
"description": "Whether to merge in-scope pull requests into a combined release pull request. Defaults to `true`.",
|
|
251
255
|
"type": "boolean"
|
|
256
|
+
},
|
|
257
|
+
"specialWords": {
|
|
258
|
+
"description": "Words that sentence casing logic will not be applied to",
|
|
259
|
+
"type": "array",
|
|
260
|
+
"items": {
|
|
261
|
+
"type": "string"
|
|
262
|
+
}
|
|
252
263
|
}
|
|
253
264
|
},
|
|
254
265
|
"required": ["type", "groupName", "components"]
|
|
@@ -332,6 +343,7 @@
|
|
|
332
343
|
"include-v-in-tag": true,
|
|
333
344
|
"changelog-type": true,
|
|
334
345
|
"changelog-host": true,
|
|
346
|
+
"changelog-path": true,
|
|
335
347
|
"pull-request-title-pattern": true,
|
|
336
348
|
"pull-request-header": true,
|
|
337
349
|
"separate-pull-requests": true,
|