release-please 16.12.2 → 16.14.0
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/README.md +1 -1
- package/build/src/bin/release-please.js +6 -0
- package/build/src/commit.js +41 -7
- package/build/src/index.d.ts +1 -1
- package/build/src/index.js +1 -1
- package/build/src/manifest.d.ts +2 -0
- package/build/src/manifest.js +13 -8
- package/build/src/plugins/merge.d.ts +2 -0
- package/build/src/plugins/merge.js +2 -1
- package/build/src/strategies/base.d.ts +2 -0
- package/build/src/strategies/base.js +5 -3
- package/build/src/strategies/java.js +1 -1
- package/build/src/updaters/release-please-config.js +1 -0
- package/build/src/util/pull-request-title.d.ts +8 -7
- package/build/src/util/pull-request-title.js +40 -13
- package/package.json +1 -1
- package/schemas/config.json +10 -1
package/README.md
CHANGED
|
@@ -191,7 +191,7 @@ Release Please automates releases for the following flavors of repositories:
|
|
|
191
191
|
| `krm-blueprint` | [A kpt package, with 1 or more KRM files and a CHANGELOG.md](https://github.com/GoogleCloudPlatform/blueprints/tree/main/catalog/project) |
|
|
192
192
|
| `maven` | [Strategy for Maven projects, generates SNAPSHOT version after each release and updates `pom.xml` automatically](docs/java.md) |
|
|
193
193
|
| `node` | [A Node.js repository, with a package.json and CHANGELOG.md](https://github.com/yargs/yargs) |
|
|
194
|
-
| `expo` | An Expo based React Native repository, with a package.json, app.json and CHANGELOG.md |
|
|
194
|
+
| `expo` | [An Expo based React Native repository, with a package.json, app.json and CHANGELOG.md](https://github.com/dmi3y/expo-release-please-example) |
|
|
195
195
|
| `ocaml` | [An OCaml repository, containing 1 or more opam or esy files and a CHANGELOG.md](https://github.com/grain-lang/binaryen.ml) |
|
|
196
196
|
| `php` | A repository with a composer.json and a CHANGELOG.md |
|
|
197
197
|
| `python` | [A Python repository, with a setup.py, setup.cfg, CHANGELOG.md](https://github.com/googleapis/python-storage) and optionally a pyproject.toml and a <project>/\_\_init\_\_.py |
|
|
@@ -278,6 +278,11 @@ function taggingOptions(yargs) {
|
|
|
278
278
|
.option('pull-request-footer', {
|
|
279
279
|
describe: 'Footer for release PR',
|
|
280
280
|
type: 'string',
|
|
281
|
+
})
|
|
282
|
+
.option('component-no-space', {
|
|
283
|
+
describe: 'release-please automatically adds ` ` (space) in front of parsed ${component}. Should this be disabled?',
|
|
284
|
+
type: 'boolean',
|
|
285
|
+
default: false,
|
|
281
286
|
});
|
|
282
287
|
}
|
|
283
288
|
const createReleasePullRequestCommand = {
|
|
@@ -305,6 +310,7 @@ const createReleasePullRequestCommand = {
|
|
|
305
310
|
pullRequestTitlePattern: argv.pullRequestTitlePattern,
|
|
306
311
|
pullRequestHeader: argv.pullRequestHeader,
|
|
307
312
|
pullRequestFooter: argv.pullRequestFooter,
|
|
313
|
+
componentNoSpace: argv.componentNoSpace,
|
|
308
314
|
changelogSections: argv.changelogSections,
|
|
309
315
|
releaseAs: argv.releaseAs,
|
|
310
316
|
versioning: argv.versioningStrategy,
|
package/build/src/commit.js
CHANGED
|
@@ -127,6 +127,17 @@ function toConventionalChangelogFormat(ast) {
|
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
|
+
// Add additional breaking change detection from commit body
|
|
131
|
+
if (body) {
|
|
132
|
+
const bodyString = String(body);
|
|
133
|
+
const breakingChangeMatch = bodyString.match(/BREAKING-CHANGE:\s*(.*)/);
|
|
134
|
+
if (breakingChangeMatch && breakingChangeMatch[1]) {
|
|
135
|
+
if (breaking.text) {
|
|
136
|
+
breaking.text += '\n';
|
|
137
|
+
}
|
|
138
|
+
breaking.text += breakingChangeMatch[1].trim();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
130
141
|
if (breaking.text !== '')
|
|
131
142
|
headerCommit.notes.push(breaking);
|
|
132
143
|
// Populates references array from footers:
|
|
@@ -241,6 +252,7 @@ function toConventionalChangelogFormat(ast) {
|
|
|
241
252
|
// we should be able to move post processing into
|
|
242
253
|
// to-conventional-changelog.ts.
|
|
243
254
|
function postProcessCommits(commit) {
|
|
255
|
+
var _a;
|
|
244
256
|
commit.notes.forEach(note => {
|
|
245
257
|
let text = '';
|
|
246
258
|
let i = 0;
|
|
@@ -262,6 +274,19 @@ function postProcessCommits(commit) {
|
|
|
262
274
|
}
|
|
263
275
|
note.text = text.trim();
|
|
264
276
|
});
|
|
277
|
+
const breakingChangeMatch = (_a = commit.body) === null || _a === void 0 ? void 0 : _a.match(/BREAKING-CHANGE:\s*(.*)/);
|
|
278
|
+
if (breakingChangeMatch && breakingChangeMatch[1]) {
|
|
279
|
+
const existingNote = commit.notes.find(note => note.title === 'BREAKING CHANGE');
|
|
280
|
+
if (existingNote) {
|
|
281
|
+
existingNote.text += `\n${breakingChangeMatch[1].trim()}`;
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
commit.notes.push({
|
|
285
|
+
title: 'BREAKING CHANGE',
|
|
286
|
+
text: breakingChangeMatch[1].trim(),
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}
|
|
265
290
|
return commit;
|
|
266
291
|
}
|
|
267
292
|
// If someone wishes to include additional contextual information for a
|
|
@@ -283,20 +308,29 @@ function hasExtendedContext(line) {
|
|
|
283
308
|
function parseCommits(message) {
|
|
284
309
|
return conventionalCommitsFilter(toConventionalChangelogFormat(parser.parser(message))).map(postProcessCommits);
|
|
285
310
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
311
|
+
/**
|
|
312
|
+
* Splits a commit message into multiple messages based on conventional commit format and nested commit blocks.
|
|
313
|
+
* This function is capable of:
|
|
314
|
+
* 1. Separating conventional commits (feat, fix, docs, etc.) within the main message.
|
|
315
|
+
* 2. Extracting nested commits enclosed in BEGIN_NESTED_COMMIT/END_NESTED_COMMIT blocks.
|
|
316
|
+
* 3. Preserving the original message structure outside of nested commit blocks.
|
|
317
|
+
* 4. Handling multiple nested commits and conventional commits in a single message.
|
|
318
|
+
*
|
|
319
|
+
* @param message The input commit message string
|
|
320
|
+
* @returns An array of individual commit messages
|
|
321
|
+
*/
|
|
289
322
|
function splitMessages(message) {
|
|
290
323
|
const parts = message.split('BEGIN_NESTED_COMMIT');
|
|
291
324
|
const messages = [parts.shift()];
|
|
292
325
|
for (const part of parts) {
|
|
293
326
|
const [newMessage, ...rest] = part.split('END_NESTED_COMMIT');
|
|
294
327
|
messages.push(newMessage);
|
|
295
|
-
|
|
296
|
-
// commit
|
|
297
|
-
messages[0] = messages[0] + rest.join();
|
|
328
|
+
messages[0] = messages[0] + rest.join('END_NESTED_COMMIT');
|
|
298
329
|
}
|
|
299
|
-
|
|
330
|
+
const conventionalCommits = messages[0]
|
|
331
|
+
.split(/\n(?=(?:feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.*?\))?: )/)
|
|
332
|
+
.filter(Boolean);
|
|
333
|
+
return [...conventionalCommits, ...messages.slice(1)];
|
|
300
334
|
}
|
|
301
335
|
/**
|
|
302
336
|
* Given a list of raw commits, parse and expand into conventional commits.
|
package/build/src/index.d.ts
CHANGED
package/build/src/index.js
CHANGED
|
@@ -36,6 +36,6 @@ Object.defineProperty(exports, "GitHub", { enumerable: true, get: function () {
|
|
|
36
36
|
exports.configSchema = require('../../schemas/config.json');
|
|
37
37
|
exports.manifestSchema = require('../../schemas/manifest.json');
|
|
38
38
|
// x-release-please-start-version
|
|
39
|
-
exports.VERSION = '16.
|
|
39
|
+
exports.VERSION = '16.14.0';
|
|
40
40
|
// x-release-please-end
|
|
41
41
|
//# sourceMappingURL=index.js.map
|
package/build/src/manifest.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ export interface ReleaserConfig {
|
|
|
63
63
|
pullRequestTitlePattern?: string;
|
|
64
64
|
pullRequestHeader?: string;
|
|
65
65
|
pullRequestFooter?: string;
|
|
66
|
+
componentNoSpace?: boolean;
|
|
66
67
|
tagSeparator?: string;
|
|
67
68
|
separatePullRequests?: boolean;
|
|
68
69
|
labels?: string[];
|
|
@@ -112,6 +113,7 @@ interface ReleaserConfigJson {
|
|
|
112
113
|
'pull-request-title-pattern'?: string;
|
|
113
114
|
'pull-request-header'?: string;
|
|
114
115
|
'pull-request-footer'?: string;
|
|
116
|
+
'component-no-space'?: boolean;
|
|
115
117
|
'separate-pull-requests'?: boolean;
|
|
116
118
|
'tag-separator'?: string;
|
|
117
119
|
'extra-files'?: ExtraFile[];
|
package/build/src/manifest.js
CHANGED
|
@@ -392,6 +392,10 @@ class Manifest {
|
|
|
392
392
|
!('pullRequestFooter' in mergeOptions)) {
|
|
393
393
|
mergeOptions.pullRequestFooter = config.pullRequestFooter;
|
|
394
394
|
}
|
|
395
|
+
if ('componentNoSpace' in config &&
|
|
396
|
+
!('componentNoSpace' in mergeOptions)) {
|
|
397
|
+
mergeOptions.componentNoSpace = config.componentNoSpace;
|
|
398
|
+
}
|
|
395
399
|
}
|
|
396
400
|
this.plugins.push(new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig, mergeOptions));
|
|
397
401
|
}
|
|
@@ -818,6 +822,7 @@ function extractReleaserConfig(config) {
|
|
|
818
822
|
pullRequestTitlePattern: config['pull-request-title-pattern'],
|
|
819
823
|
pullRequestHeader: config['pull-request-header'],
|
|
820
824
|
pullRequestFooter: config['pull-request-footer'],
|
|
825
|
+
componentNoSpace: config['component-no-space'],
|
|
821
826
|
tagSeparator: config['tag-separator'],
|
|
822
827
|
separatePullRequests: config['separate-pull-requests'],
|
|
823
828
|
labels: (_a = config['label']) === null || _a === void 0 ? void 0 : _a.split(','),
|
|
@@ -946,7 +951,6 @@ function isPublishedVersion(strategy, version) {
|
|
|
946
951
|
* @param {string} targetBranch Name of the scanned branch.
|
|
947
952
|
* @param releaseFilter Validator function for release version. Used to filter-out SNAPSHOT releases for Java strategy.
|
|
948
953
|
* @param {string} prefix Limit the release to a specific component.
|
|
949
|
-
* @param pullRequestTitlePattern Configured PR title pattern.
|
|
950
954
|
*/
|
|
951
955
|
async function latestReleaseVersion(github, targetBranch, releaseFilter, config, prefix, logger = logger_1.logger) {
|
|
952
956
|
const branchPrefix = prefix
|
|
@@ -983,7 +987,7 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, config,
|
|
|
983
987
|
logger.trace(`skipping commit: ${commitWithPullRequest.sha} branch component ${branchName.getComponent()} doesn't match expected prefix: ${branchPrefix}`);
|
|
984
988
|
continue;
|
|
985
989
|
}
|
|
986
|
-
const pullRequestTitle = pull_request_title_1.PullRequestTitle.parse(mergedPullRequest.title, config.pullRequestTitlePattern, logger);
|
|
990
|
+
const pullRequestTitle = pull_request_title_1.PullRequestTitle.parse(mergedPullRequest.title, config.pullRequestTitlePattern, config.componentNoSpace, logger);
|
|
987
991
|
if (!pullRequestTitle) {
|
|
988
992
|
logger.trace(`skipping commit: ${commitWithPullRequest.sha} couldn't parse pull request title: ${mergedPullRequest.title}`);
|
|
989
993
|
continue;
|
|
@@ -1039,7 +1043,7 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, config,
|
|
|
1039
1043
|
return candidateTagVersion.sort((a, b) => b.compare(a))[0];
|
|
1040
1044
|
}
|
|
1041
1045
|
function mergeReleaserConfig(defaultConfig, pathConfig) {
|
|
1042
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
|
1046
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
|
|
1043
1047
|
return {
|
|
1044
1048
|
releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node',
|
|
1045
1049
|
bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor,
|
|
@@ -1065,11 +1069,12 @@ function mergeReleaserConfig(defaultConfig, pathConfig) {
|
|
|
1065
1069
|
pullRequestTitlePattern: (_y = pathConfig.pullRequestTitlePattern) !== null && _y !== void 0 ? _y : defaultConfig.pullRequestTitlePattern,
|
|
1066
1070
|
pullRequestHeader: (_z = pathConfig.pullRequestHeader) !== null && _z !== void 0 ? _z : defaultConfig.pullRequestHeader,
|
|
1067
1071
|
pullRequestFooter: (_0 = pathConfig.pullRequestFooter) !== null && _0 !== void 0 ? _0 : defaultConfig.pullRequestFooter,
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1072
|
+
componentNoSpace: (_1 = pathConfig.componentNoSpace) !== null && _1 !== void 0 ? _1 : defaultConfig.componentNoSpace,
|
|
1073
|
+
separatePullRequests: (_2 = pathConfig.separatePullRequests) !== null && _2 !== void 0 ? _2 : defaultConfig.separatePullRequests,
|
|
1074
|
+
skipSnapshot: (_3 = pathConfig.skipSnapshot) !== null && _3 !== void 0 ? _3 : defaultConfig.skipSnapshot,
|
|
1075
|
+
initialVersion: (_4 = pathConfig.initialVersion) !== null && _4 !== void 0 ? _4 : defaultConfig.initialVersion,
|
|
1076
|
+
extraLabels: (_5 = pathConfig.extraLabels) !== null && _5 !== void 0 ? _5 : defaultConfig.extraLabels,
|
|
1077
|
+
excludePaths: (_6 = pathConfig.excludePaths) !== null && _6 !== void 0 ? _6 : defaultConfig.excludePaths,
|
|
1073
1078
|
};
|
|
1074
1079
|
}
|
|
1075
1080
|
/**
|
|
@@ -5,6 +5,7 @@ export interface MergeOptions {
|
|
|
5
5
|
pullRequestTitlePattern?: string;
|
|
6
6
|
pullRequestHeader?: string;
|
|
7
7
|
pullRequestFooter?: string;
|
|
8
|
+
componentNoSpace?: boolean;
|
|
8
9
|
headBranchName?: string;
|
|
9
10
|
forceMerge?: boolean;
|
|
10
11
|
}
|
|
@@ -18,6 +19,7 @@ export declare class Merge extends ManifestPlugin {
|
|
|
18
19
|
private pullRequestTitlePattern?;
|
|
19
20
|
private pullRequestHeader?;
|
|
20
21
|
private pullRequestFooter?;
|
|
22
|
+
private componentNoSpace?;
|
|
21
23
|
private headBranchName?;
|
|
22
24
|
private forceMerge;
|
|
23
25
|
constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, options?: MergeOptions);
|
|
@@ -34,6 +34,7 @@ class Merge extends plugin_1.ManifestPlugin {
|
|
|
34
34
|
(_a = options.pullRequestTitlePattern) !== null && _a !== void 0 ? _a : manifest_1.MANIFEST_PULL_REQUEST_TITLE_PATTERN;
|
|
35
35
|
this.pullRequestHeader = options.pullRequestHeader;
|
|
36
36
|
this.pullRequestFooter = options.pullRequestFooter;
|
|
37
|
+
this.componentNoSpace = options.componentNoSpace;
|
|
37
38
|
this.headBranchName = options.headBranchName;
|
|
38
39
|
this.forceMerge = (_b = options.forceMerge) !== null && _b !== void 0 ? _b : false;
|
|
39
40
|
}
|
|
@@ -69,7 +70,7 @@ class Merge extends plugin_1.ManifestPlugin {
|
|
|
69
70
|
}
|
|
70
71
|
const updates = (0, composite_1.mergeUpdates)(rawUpdates);
|
|
71
72
|
const pullRequest = {
|
|
72
|
-
title: pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(rootRelease === null || rootRelease === void 0 ? void 0 : rootRelease.pullRequest.title.component, this.targetBranch, rootRelease === null || rootRelease === void 0 ? void 0 : rootRelease.pullRequest.title.version, this.pullRequestTitlePattern),
|
|
73
|
+
title: pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(rootRelease === null || rootRelease === void 0 ? void 0 : rootRelease.pullRequest.title.component, this.targetBranch, rootRelease === null || rootRelease === void 0 ? void 0 : rootRelease.pullRequest.title.version, this.pullRequestTitlePattern, this.componentNoSpace),
|
|
73
74
|
body: new pull_request_body_1.PullRequestBody(releaseData, {
|
|
74
75
|
useComponents: true,
|
|
75
76
|
header: this.pullRequestHeader,
|
|
@@ -44,6 +44,7 @@ export interface BaseStrategyOptions {
|
|
|
44
44
|
pullRequestTitlePattern?: string;
|
|
45
45
|
pullRequestHeader?: string;
|
|
46
46
|
pullRequestFooter?: string;
|
|
47
|
+
componentNoSpace?: boolean;
|
|
47
48
|
extraFiles?: ExtraFile[];
|
|
48
49
|
versionFile?: string;
|
|
49
50
|
snapshotLabels?: string[];
|
|
@@ -76,6 +77,7 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
76
77
|
readonly pullRequestTitlePattern?: string;
|
|
77
78
|
readonly pullRequestHeader?: string;
|
|
78
79
|
readonly pullRequestFooter?: string;
|
|
80
|
+
readonly componentNoSpace?: boolean;
|
|
79
81
|
readonly extraFiles: ExtraFile[];
|
|
80
82
|
readonly extraLabels: string[];
|
|
81
83
|
readonly changelogNotes: ChangelogNotes;
|
|
@@ -62,6 +62,7 @@ class BaseStrategy {
|
|
|
62
62
|
this.pullRequestTitlePattern = options.pullRequestTitlePattern;
|
|
63
63
|
this.pullRequestHeader = options.pullRequestHeader;
|
|
64
64
|
this.pullRequestFooter = options.pullRequestFooter;
|
|
65
|
+
this.componentNoSpace = options.componentNoSpace;
|
|
65
66
|
this.extraFiles = options.extraFiles || [];
|
|
66
67
|
this.initialVersion = options.initialVersion;
|
|
67
68
|
this.extraLabels = options.extraLabels || [];
|
|
@@ -156,7 +157,8 @@ class BaseStrategy {
|
|
|
156
157
|
this.logger.debug('component:', component);
|
|
157
158
|
const newVersionTag = new tag_name_1.TagName(newVersion, this.includeComponentInTag ? component : undefined, this.tagSeparator, this.includeVInTag);
|
|
158
159
|
this.logger.debug('pull request title pattern:', this.pullRequestTitlePattern);
|
|
159
|
-
|
|
160
|
+
this.logger.debug('componentNoSpace:', this.componentNoSpace);
|
|
161
|
+
const pullRequestTitle = pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(component || '', this.targetBranch, newVersion, this.pullRequestTitlePattern, this.componentNoSpace);
|
|
160
162
|
const branchComponent = await this.getBranchComponent();
|
|
161
163
|
const branchName = branchComponent
|
|
162
164
|
? branch_name_1.BranchName.ofComponentTargetBranch(branchComponent, this.targetBranch)
|
|
@@ -350,8 +352,8 @@ class BaseStrategy {
|
|
|
350
352
|
return;
|
|
351
353
|
}
|
|
352
354
|
const mergedTitlePattern = (_a = options === null || options === void 0 ? void 0 : options.groupPullRequestTitlePattern) !== null && _a !== void 0 ? _a : manifest_1.MANIFEST_PULL_REQUEST_TITLE_PATTERN;
|
|
353
|
-
const pullRequestTitle = pull_request_title_1.PullRequestTitle.parse(mergedPullRequest.title, this.pullRequestTitlePattern, this.logger) ||
|
|
354
|
-
pull_request_title_1.PullRequestTitle.parse(mergedPullRequest.title, mergedTitlePattern, this.logger);
|
|
355
|
+
const pullRequestTitle = pull_request_title_1.PullRequestTitle.parse(mergedPullRequest.title, this.pullRequestTitlePattern, this.componentNoSpace, this.logger) ||
|
|
356
|
+
pull_request_title_1.PullRequestTitle.parse(mergedPullRequest.title, mergedTitlePattern, this.componentNoSpace, this.logger);
|
|
355
357
|
if (!pullRequestTitle) {
|
|
356
358
|
this.logger.error(`Bad pull request title: '${mergedPullRequest.title}'`);
|
|
357
359
|
return;
|
|
@@ -130,7 +130,7 @@ class Java extends base_1.BaseStrategy {
|
|
|
130
130
|
const pullRequests = commits
|
|
131
131
|
.map(commit => {
|
|
132
132
|
var _a;
|
|
133
|
-
return pull_request_title_1.PullRequestTitle.parse(((_a = commit.pullRequest) === null || _a === void 0 ? void 0 : _a.title) || commit.message, this.pullRequestTitlePattern, this.logger);
|
|
133
|
+
return pull_request_title_1.PullRequestTitle.parse(((_a = commit.pullRequest) === null || _a === void 0 ? void 0 : _a.title) || commit.message, this.pullRequestTitlePattern, this.componentNoSpace, this.logger);
|
|
134
134
|
})
|
|
135
135
|
.filter(pullRequest => pullRequest);
|
|
136
136
|
const snapshotCommits = pullRequests
|
|
@@ -65,6 +65,7 @@ function releaserConfigToJsonConfig(config) {
|
|
|
65
65
|
'pull-request-title-pattern': config.pullRequestTitlePattern,
|
|
66
66
|
'pull-request-header': config.pullRequestHeader,
|
|
67
67
|
'pull-request-footer': config.pullRequestFooter,
|
|
68
|
+
'component-no-space': config.componentNoSpace,
|
|
68
69
|
'separate-pull-requests': config.separatePullRequests,
|
|
69
70
|
'tag-separator': config.tagSeparator,
|
|
70
71
|
'extra-files': config.extraFiles,
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { Logger } from './logger';
|
|
2
2
|
import { Version } from '../version';
|
|
3
|
-
export declare function generateMatchPattern(pullRequestTitlePattern?: string, logger?: Logger): RegExp;
|
|
3
|
+
export declare function generateMatchPattern(pullRequestTitlePattern?: string, componentNoSpace?: boolean, logger?: Logger): RegExp;
|
|
4
4
|
export declare class PullRequestTitle {
|
|
5
5
|
component?: string;
|
|
6
6
|
targetBranch?: string;
|
|
7
7
|
version?: Version;
|
|
8
8
|
pullRequestTitlePattern: string;
|
|
9
9
|
matchPattern: RegExp;
|
|
10
|
+
componentNoSpace?: boolean;
|
|
10
11
|
private constructor();
|
|
11
|
-
static parse(title: string, pullRequestTitlePattern?: string, logger?: Logger): PullRequestTitle | undefined;
|
|
12
|
-
static ofComponentVersion(component: string, version: Version, pullRequestTitlePattern?: string): PullRequestTitle;
|
|
13
|
-
static ofVersion(version: Version, pullRequestTitlePattern?: string): PullRequestTitle;
|
|
14
|
-
static ofTargetBranchVersion(targetBranch: string, version: Version, pullRequestTitlePattern?: string): PullRequestTitle;
|
|
15
|
-
static ofComponentTargetBranchVersion(component?: string, targetBranch?: string, version?: Version, pullRequestTitlePattern?: string): PullRequestTitle;
|
|
16
|
-
static ofTargetBranch(targetBranch: string, pullRequestTitlePattern?: string): PullRequestTitle;
|
|
12
|
+
static parse(title: string, pullRequestTitlePattern?: string, componentNoSpace?: boolean, logger?: Logger): PullRequestTitle | undefined;
|
|
13
|
+
static ofComponentVersion(component: string, version: Version, pullRequestTitlePattern?: string, componentNoSpace?: boolean): PullRequestTitle;
|
|
14
|
+
static ofVersion(version: Version, pullRequestTitlePattern?: string, componentNoSpace?: boolean): PullRequestTitle;
|
|
15
|
+
static ofTargetBranchVersion(targetBranch: string, version: Version, pullRequestTitlePattern?: string, componentNoSpace?: boolean): PullRequestTitle;
|
|
16
|
+
static ofComponentTargetBranchVersion(component?: string, targetBranch?: string, version?: Version, pullRequestTitlePattern?: string, componentNoSpace?: boolean): PullRequestTitle;
|
|
17
|
+
static ofTargetBranch(targetBranch: string, pullRequestTitlePattern?: string, componentNoSpace?: boolean): PullRequestTitle;
|
|
17
18
|
getTargetBranch(): string | undefined;
|
|
18
19
|
getComponent(): string | undefined;
|
|
19
20
|
getVersion(): Version | undefined;
|
|
@@ -20,7 +20,8 @@ const version_1 = require("../version");
|
|
|
20
20
|
// at the script level are undefined, they are only defined inside function
|
|
21
21
|
// or instance methods/properties.
|
|
22
22
|
const DEFAULT_PR_TITLE_PATTERN = 'chore${scope}: release${component} ${version}';
|
|
23
|
-
|
|
23
|
+
const COMPONENT_NO_SPACE = false;
|
|
24
|
+
function generateMatchPattern(pullRequestTitlePattern, componentNoSpace, logger = logger_1.logger) {
|
|
24
25
|
if (pullRequestTitlePattern &&
|
|
25
26
|
pullRequestTitlePattern.search(/\$\{scope\}/) === -1)
|
|
26
27
|
logger.warn("pullRequestTitlePattern miss the part of '${scope}'");
|
|
@@ -36,7 +37,9 @@ function generateMatchPattern(pullRequestTitlePattern, logger = logger_1.logger)
|
|
|
36
37
|
.replace('(', '\\(')
|
|
37
38
|
.replace(')', '\\)')
|
|
38
39
|
.replace('${scope}', '(\\((?<branch>[\\w-./]+)\\))?')
|
|
39
|
-
.replace('${component}',
|
|
40
|
+
.replace('${component}', componentNoSpace === true
|
|
41
|
+
? '?(?<component>@?[\\w-./]*)?'
|
|
42
|
+
: ' ?(?<component>@?[\\w-./]*)?')
|
|
40
43
|
.replace('${version}', 'v?(?<version>[0-9].*)')
|
|
41
44
|
.replace('${branch}', '(?<branch>[\\w-./]+)?')}$`);
|
|
42
45
|
}
|
|
@@ -48,10 +51,11 @@ class PullRequestTitle {
|
|
|
48
51
|
this.targetBranch = opts.targetBranch;
|
|
49
52
|
this.pullRequestTitlePattern =
|
|
50
53
|
opts.pullRequestTitlePattern || DEFAULT_PR_TITLE_PATTERN;
|
|
51
|
-
this.
|
|
54
|
+
this.componentNoSpace = opts.componentNoSpace || COMPONENT_NO_SPACE;
|
|
55
|
+
this.matchPattern = generateMatchPattern(this.pullRequestTitlePattern, this.componentNoSpace, opts.logger);
|
|
52
56
|
}
|
|
53
|
-
static parse(title, pullRequestTitlePattern, logger = logger_1.logger) {
|
|
54
|
-
const matchPattern = generateMatchPattern(pullRequestTitlePattern, logger);
|
|
57
|
+
static parse(title, pullRequestTitlePattern, componentNoSpace, logger = logger_1.logger) {
|
|
58
|
+
const matchPattern = generateMatchPattern(pullRequestTitlePattern, componentNoSpace, logger);
|
|
55
59
|
const match = title.match(matchPattern);
|
|
56
60
|
if (match === null || match === void 0 ? void 0 : match.groups) {
|
|
57
61
|
return new PullRequestTitle({
|
|
@@ -61,36 +65,49 @@ class PullRequestTitle {
|
|
|
61
65
|
component: match.groups['component'],
|
|
62
66
|
targetBranch: match.groups['branch'],
|
|
63
67
|
pullRequestTitlePattern,
|
|
68
|
+
componentNoSpace,
|
|
64
69
|
logger,
|
|
65
70
|
});
|
|
66
71
|
}
|
|
67
72
|
return undefined;
|
|
68
73
|
}
|
|
69
|
-
static ofComponentVersion(component, version, pullRequestTitlePattern) {
|
|
70
|
-
return new PullRequestTitle({
|
|
74
|
+
static ofComponentVersion(component, version, pullRequestTitlePattern, componentNoSpace) {
|
|
75
|
+
return new PullRequestTitle({
|
|
76
|
+
version,
|
|
77
|
+
component,
|
|
78
|
+
pullRequestTitlePattern,
|
|
79
|
+
componentNoSpace,
|
|
80
|
+
});
|
|
71
81
|
}
|
|
72
|
-
static ofVersion(version, pullRequestTitlePattern) {
|
|
73
|
-
return new PullRequestTitle({
|
|
82
|
+
static ofVersion(version, pullRequestTitlePattern, componentNoSpace) {
|
|
83
|
+
return new PullRequestTitle({
|
|
84
|
+
version,
|
|
85
|
+
pullRequestTitlePattern,
|
|
86
|
+
componentNoSpace,
|
|
87
|
+
});
|
|
74
88
|
}
|
|
75
|
-
static ofTargetBranchVersion(targetBranch, version, pullRequestTitlePattern) {
|
|
89
|
+
static ofTargetBranchVersion(targetBranch, version, pullRequestTitlePattern, componentNoSpace) {
|
|
76
90
|
return new PullRequestTitle({
|
|
77
91
|
version,
|
|
78
92
|
targetBranch,
|
|
79
93
|
pullRequestTitlePattern,
|
|
94
|
+
componentNoSpace,
|
|
80
95
|
});
|
|
81
96
|
}
|
|
82
|
-
static ofComponentTargetBranchVersion(component, targetBranch, version, pullRequestTitlePattern) {
|
|
97
|
+
static ofComponentTargetBranchVersion(component, targetBranch, version, pullRequestTitlePattern, componentNoSpace) {
|
|
83
98
|
return new PullRequestTitle({
|
|
84
99
|
version,
|
|
85
100
|
component,
|
|
86
101
|
targetBranch,
|
|
87
102
|
pullRequestTitlePattern,
|
|
103
|
+
componentNoSpace,
|
|
88
104
|
});
|
|
89
105
|
}
|
|
90
|
-
static ofTargetBranch(targetBranch, pullRequestTitlePattern) {
|
|
106
|
+
static ofTargetBranch(targetBranch, pullRequestTitlePattern, componentNoSpace) {
|
|
91
107
|
return new PullRequestTitle({
|
|
92
108
|
targetBranch,
|
|
93
109
|
pullRequestTitlePattern,
|
|
110
|
+
componentNoSpace,
|
|
94
111
|
});
|
|
95
112
|
}
|
|
96
113
|
getTargetBranch() {
|
|
@@ -105,8 +122,18 @@ class PullRequestTitle {
|
|
|
105
122
|
toString() {
|
|
106
123
|
var _a;
|
|
107
124
|
const scope = this.targetBranch ? `(${this.targetBranch})` : '';
|
|
108
|
-
const component = this.
|
|
125
|
+
const component = this.componentNoSpace === true
|
|
126
|
+
? this.component
|
|
127
|
+
? `${this.component}`
|
|
128
|
+
: ''
|
|
129
|
+
: this.component
|
|
130
|
+
? ` ${this.component}`
|
|
131
|
+
: '';
|
|
109
132
|
const version = (_a = this.version) !== null && _a !== void 0 ? _a : '';
|
|
133
|
+
if (this.componentNoSpace === true && !component) {
|
|
134
|
+
console.log('`component` is empty. Removing component from title pattern..');
|
|
135
|
+
this.pullRequestTitlePattern = this.pullRequestTitlePattern.replace('${component} ', '');
|
|
136
|
+
}
|
|
110
137
|
return this.pullRequestTitlePattern
|
|
111
138
|
.replace('${scope}', scope)
|
|
112
139
|
.replace('${component}', component)
|
package/package.json
CHANGED
package/schemas/config.json
CHANGED
|
@@ -233,6 +233,10 @@
|
|
|
233
233
|
"initial-version": {
|
|
234
234
|
"description": "Releases the initial library with a specified version",
|
|
235
235
|
"type": "string"
|
|
236
|
+
},
|
|
237
|
+
"component-no-space": {
|
|
238
|
+
"description": "release-please automatically adds ` ` (space) in front of parsed ${component}. This option indicates whether that behaviour should be disabled. Defaults to `false`",
|
|
239
|
+
"type": "boolean"
|
|
236
240
|
}
|
|
237
241
|
}
|
|
238
242
|
}
|
|
@@ -423,6 +427,10 @@
|
|
|
423
427
|
"release-label": {
|
|
424
428
|
"description": "Comma-separated list of labels to add to a pull request that has been released/tagged",
|
|
425
429
|
"type": "string"
|
|
430
|
+
},
|
|
431
|
+
"component-no-space": {
|
|
432
|
+
"description": "release-please automatically adds ` ` (space) in front of parsed ${component}. This option indicates whether that behaviour should be disabled. Defaults to `false`",
|
|
433
|
+
"type": "boolean"
|
|
426
434
|
}
|
|
427
435
|
},
|
|
428
436
|
"required": ["packages"]
|
|
@@ -467,6 +475,7 @@
|
|
|
467
475
|
"version-file": true,
|
|
468
476
|
"snapshot-label": true,
|
|
469
477
|
"initial-version": true,
|
|
470
|
-
"exclude-paths": true
|
|
478
|
+
"exclude-paths": true,
|
|
479
|
+
"component-no-space": false
|
|
471
480
|
}
|
|
472
481
|
}
|