release-please 13.0.0-candidate.5 → 13.0.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/CHANGELOG.md +52 -0
- package/README.md +33 -131
- package/build/src/bin/release-please.js +12 -1
- package/build/src/changelog-notes.d.ts +1 -0
- package/build/src/changelog-notes.js +24 -0
- package/build/src/commit.d.ts +1 -1
- package/build/src/commit.js +14 -1
- package/build/src/github.d.ts +41 -7
- package/build/src/github.js +51 -14
- package/build/src/manifest.js +76 -20
- package/build/src/plugins/cargo-workspace.js +2 -2
- package/build/src/plugins/merge.js +4 -1
- package/build/src/plugins/node-workspace.js +2 -2
- package/build/src/pull-request.d.ts +8 -8
- package/build/src/release-pull-request.d.ts +6 -6
- package/build/src/strategies/base.d.ts +108 -0
- package/build/src/strategies/base.js +253 -0
- package/build/src/strategies/dart.d.ts +2 -2
- package/build/src/strategies/dart.js +2 -2
- package/build/src/strategies/elixir.d.ts +2 -2
- package/build/src/strategies/elixir.js +2 -2
- package/build/src/strategies/go-yoshi.d.ts +3 -3
- package/build/src/strategies/go-yoshi.js +2 -2
- package/build/src/strategies/go.d.ts +2 -2
- package/build/src/strategies/go.js +2 -2
- package/build/src/strategies/helm.d.ts +2 -2
- package/build/src/strategies/helm.js +2 -2
- package/build/src/strategies/java-yoshi.d.ts +3 -3
- package/build/src/strategies/java-yoshi.js +2 -2
- package/build/src/strategies/krm-blueprint.d.ts +2 -2
- package/build/src/strategies/krm-blueprint.js +3 -3
- package/build/src/strategies/node.d.ts +2 -2
- package/build/src/strategies/node.js +2 -2
- package/build/src/strategies/ocaml.d.ts +2 -2
- package/build/src/strategies/ocaml.js +2 -2
- package/build/src/strategies/php-yoshi.d.ts +3 -3
- package/build/src/strategies/php-yoshi.js +2 -2
- package/build/src/strategies/php.d.ts +3 -3
- package/build/src/strategies/php.js +2 -2
- package/build/src/strategies/python.d.ts +2 -2
- package/build/src/strategies/python.js +2 -2
- package/build/src/strategies/ruby-yoshi.d.ts +3 -3
- package/build/src/strategies/ruby-yoshi.js +7 -2
- package/build/src/strategies/ruby.d.ts +3 -3
- package/build/src/strategies/ruby.js +2 -2
- package/build/src/strategies/rust.d.ts +2 -2
- package/build/src/strategies/rust.js +2 -2
- package/build/src/strategies/simple.d.ts +2 -2
- package/build/src/strategies/simple.js +2 -2
- package/build/src/strategies/terraform-module.d.ts +2 -2
- package/build/src/strategies/terraform-module.js +2 -2
- package/build/src/strategy.d.ts +8 -73
- package/build/src/strategy.js +0 -233
- package/build/src/updaters/rust/cargo-toml.js +5 -1
- package/build/src/util/commit-split.js +3 -0
- package/build/src/util/pull-request-title.js +1 -0
- package/build/src/version.d.ts +28 -5
- package/build/src/version.js +26 -0
- package/build/src/versioning-strategies/always-bump-patch.d.ts +4 -0
- package/build/src/versioning-strategies/always-bump-patch.js +4 -0
- package/build/src/versioning-strategies/default.d.ts +31 -0
- package/build/src/versioning-strategies/default.js +31 -0
- package/build/src/versioning-strategies/dependency-manifest.d.ts +8 -0
- package/build/src/versioning-strategies/dependency-manifest.js +8 -0
- package/build/src/versioning-strategies/java-add-snapshot.d.ts +4 -0
- package/build/src/versioning-strategies/java-add-snapshot.js +6 -5
- package/build/src/versioning-strategies/java-snapshot.d.ts +4 -0
- package/build/src/versioning-strategies/java-snapshot.js +4 -1
- package/build/src/versioning-strategies/service-pack.d.ts +5 -0
- package/build/src/versioning-strategies/service-pack.js +10 -3
- package/build/src/versioning-strategy.d.ts +67 -5
- package/build/src/versioning-strategy.js +37 -10
- package/package.json +3 -3
- package/build/src/release-notes.d.ts +0 -29
- package/build/src/release-notes.js +0 -71
package/build/src/strategy.js
CHANGED
|
@@ -13,237 +13,4 @@
|
|
|
13
13
|
// See the License for the specific language governing permissions and
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.Strategy = void 0;
|
|
17
|
-
const version_1 = require("./version");
|
|
18
|
-
const commit_1 = require("./commit");
|
|
19
|
-
const default_1 = require("./versioning-strategies/default");
|
|
20
|
-
const pull_request_title_1 = require("./util/pull-request-title");
|
|
21
|
-
const branch_name_1 = require("./util/branch-name");
|
|
22
|
-
const tag_name_1 = require("./util/tag-name");
|
|
23
|
-
const logger_1 = require("./util/logger");
|
|
24
|
-
const manifest_1 = require("./manifest");
|
|
25
|
-
const pull_request_body_1 = require("./util/pull-request-body");
|
|
26
|
-
const default_2 = require("./changelog-notes/default");
|
|
27
|
-
const DEFAULT_CHANGELOG_PATH = 'CHANGELOG.md';
|
|
28
|
-
/**
|
|
29
|
-
* A strategy is responsible for determining which files are
|
|
30
|
-
* necessary to update in a release pull request.
|
|
31
|
-
*/
|
|
32
|
-
class Strategy {
|
|
33
|
-
constructor(options) {
|
|
34
|
-
var _a;
|
|
35
|
-
this.path = options.path || manifest_1.ROOT_PROJECT_PATH;
|
|
36
|
-
this.github = options.github;
|
|
37
|
-
this.packageName = options.packageName;
|
|
38
|
-
this.component =
|
|
39
|
-
options.component || this.normalizeComponent(this.packageName);
|
|
40
|
-
this.versioningStrategy =
|
|
41
|
-
options.versioningStrategy || new default_1.DefaultVersioningStrategy({});
|
|
42
|
-
this.targetBranch = options.targetBranch;
|
|
43
|
-
this.repository = options.github.repository;
|
|
44
|
-
this.changelogPath = options.changelogPath || DEFAULT_CHANGELOG_PATH;
|
|
45
|
-
this.changelogSections = options.changelogSections;
|
|
46
|
-
this.tagSeparator = options.tagSeparator;
|
|
47
|
-
this.skipGitHubRelease = options.skipGitHubRelease || false;
|
|
48
|
-
this.releaseAs = options.releaseAs;
|
|
49
|
-
this.changelogNotes =
|
|
50
|
-
options.changelogNotes || new default_2.DefaultChangelogNotes(options);
|
|
51
|
-
this.includeComponentInTag = (_a = options.includeComponentInTag) !== null && _a !== void 0 ? _a : true;
|
|
52
|
-
this.pullRequestTitlePattern = options.pullRequestTitlePattern;
|
|
53
|
-
}
|
|
54
|
-
async getComponent() {
|
|
55
|
-
if (!this.includeComponentInTag) {
|
|
56
|
-
return '';
|
|
57
|
-
}
|
|
58
|
-
return this.component || (await this.getDefaultComponent());
|
|
59
|
-
}
|
|
60
|
-
async getDefaultComponent() {
|
|
61
|
-
return this.normalizeComponent(await this.getDefaultPackageName());
|
|
62
|
-
}
|
|
63
|
-
async getDefaultPackageName() {
|
|
64
|
-
return '';
|
|
65
|
-
}
|
|
66
|
-
normalizeComponent(component) {
|
|
67
|
-
if (!component) {
|
|
68
|
-
return '';
|
|
69
|
-
}
|
|
70
|
-
return component;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Override this method to post process commits
|
|
74
|
-
* @param {ConventionalCommit[]} commits parsed commits
|
|
75
|
-
* @returns {ConventionalCommit[]} modified commits
|
|
76
|
-
*/
|
|
77
|
-
postProcessCommits(commits) {
|
|
78
|
-
return commits;
|
|
79
|
-
}
|
|
80
|
-
async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease) {
|
|
81
|
-
var _a;
|
|
82
|
-
return await this.changelogNotes.buildNotes(conventionalCommits, {
|
|
83
|
-
owner: this.repository.owner,
|
|
84
|
-
repository: this.repository.repo,
|
|
85
|
-
version: newVersion.toString(),
|
|
86
|
-
previousTag: (_a = latestRelease === null || latestRelease === void 0 ? void 0 : latestRelease.tag) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
87
|
-
currentTag: newVersionTag.toString(),
|
|
88
|
-
targetBranch: this.targetBranch,
|
|
89
|
-
changelogSections: this.changelogSections,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Builds a candidate release pull request
|
|
94
|
-
* @param {Commit[]} commits Raw commits to consider for this release.
|
|
95
|
-
* @param {Release} latestRelease Optional. The last release for this
|
|
96
|
-
* component if available.
|
|
97
|
-
* @param {boolean} draft Optional. Whether or not to create the pull
|
|
98
|
-
* request as a draft. Defaults to `false`.
|
|
99
|
-
* @returns {ReleasePullRequest | undefined} The release pull request to
|
|
100
|
-
* open for this path/component. Returns undefined if we should not
|
|
101
|
-
* open a pull request.
|
|
102
|
-
*/
|
|
103
|
-
async buildReleasePullRequest(commits, latestRelease, draft, labels = []) {
|
|
104
|
-
const conventionalCommits = this.postProcessCommits(commit_1.parseConventionalCommits(commits));
|
|
105
|
-
const newVersion = await this.buildNewVersion(conventionalCommits, latestRelease);
|
|
106
|
-
const versionsMap = await this.updateVersionsMap(await this.buildVersionsMap(conventionalCommits), conventionalCommits);
|
|
107
|
-
const component = await this.getComponent();
|
|
108
|
-
logger_1.logger.debug('component:', component);
|
|
109
|
-
const newVersionTag = new tag_name_1.TagName(newVersion, this.includeComponentInTag ? component : undefined, this.tagSeparator);
|
|
110
|
-
logger_1.logger.warn('pull request title pattern:', this.pullRequestTitlePattern);
|
|
111
|
-
const pullRequestTitle = pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(component || '', this.targetBranch, newVersion, this.pullRequestTitlePattern);
|
|
112
|
-
const branchName = component
|
|
113
|
-
? branch_name_1.BranchName.ofComponentTargetBranch(component, this.targetBranch)
|
|
114
|
-
: branch_name_1.BranchName.ofTargetBranch(this.targetBranch);
|
|
115
|
-
const releaseNotesBody = await this.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease);
|
|
116
|
-
if (this.changelogEmpty(releaseNotesBody)) {
|
|
117
|
-
logger_1.logger.info(`No user facing commits found since ${latestRelease ? latestRelease.sha : 'beginning of time'} - skipping`);
|
|
118
|
-
return undefined;
|
|
119
|
-
}
|
|
120
|
-
const updates = await this.buildUpdates({
|
|
121
|
-
changelogEntry: releaseNotesBody,
|
|
122
|
-
newVersion,
|
|
123
|
-
versionsMap,
|
|
124
|
-
latestVersion: latestRelease === null || latestRelease === void 0 ? void 0 : latestRelease.tag.version,
|
|
125
|
-
});
|
|
126
|
-
const pullRequestBody = new pull_request_body_1.PullRequestBody([
|
|
127
|
-
{
|
|
128
|
-
component,
|
|
129
|
-
version: newVersion,
|
|
130
|
-
notes: releaseNotesBody,
|
|
131
|
-
},
|
|
132
|
-
]);
|
|
133
|
-
return {
|
|
134
|
-
title: pullRequestTitle,
|
|
135
|
-
body: pullRequestBody,
|
|
136
|
-
updates,
|
|
137
|
-
labels,
|
|
138
|
-
headRefName: branchName.toString(),
|
|
139
|
-
version: newVersion,
|
|
140
|
-
draft: draft !== null && draft !== void 0 ? draft : false,
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
changelogEmpty(changelogEntry) {
|
|
144
|
-
return changelogEntry.split('\n').length <= 1;
|
|
145
|
-
}
|
|
146
|
-
async updateVersionsMap(versionsMap, conventionalCommits) {
|
|
147
|
-
for (const versionKey of versionsMap.keys()) {
|
|
148
|
-
const version = versionsMap.get(versionKey);
|
|
149
|
-
if (!version) {
|
|
150
|
-
logger_1.logger.warn(`didn't find version for ${versionKey}`);
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
const newVersion = await this.versioningStrategy.bump(version, conventionalCommits);
|
|
154
|
-
versionsMap.set(versionKey, newVersion);
|
|
155
|
-
}
|
|
156
|
-
return versionsMap;
|
|
157
|
-
}
|
|
158
|
-
async buildNewVersion(conventionalCommits, latestRelease) {
|
|
159
|
-
if (this.releaseAs) {
|
|
160
|
-
logger_1.logger.warn(`Setting version for ${this.path} from release-as configuration`);
|
|
161
|
-
return version_1.Version.parse(this.releaseAs);
|
|
162
|
-
}
|
|
163
|
-
else if (latestRelease) {
|
|
164
|
-
return await this.versioningStrategy.bump(latestRelease.tag.version, conventionalCommits);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
return this.initialReleaseVersion();
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
async buildVersionsMap(_conventionalCommits) {
|
|
171
|
-
return new Map();
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Given a merged pull request, build the candidate release.
|
|
175
|
-
* @param {PullRequest} mergedPullRequest The merged release pull request.
|
|
176
|
-
* @returns {Release} The candidate release.
|
|
177
|
-
*/
|
|
178
|
-
async buildRelease(mergedPullRequest) {
|
|
179
|
-
if (this.skipGitHubRelease) {
|
|
180
|
-
logger_1.logger.info('Release skipped from strategy config');
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
if (!mergedPullRequest.sha) {
|
|
184
|
-
logger_1.logger.error('Pull request should have been merged');
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
const pullRequestTitle = pull_request_title_1.PullRequestTitle.parse(mergedPullRequest.title, this.pullRequestTitlePattern) ||
|
|
188
|
-
pull_request_title_1.PullRequestTitle.parse(mergedPullRequest.title, manifest_1.MANIFEST_PULL_REQUEST_TITLE_PATTERN);
|
|
189
|
-
if (!pullRequestTitle) {
|
|
190
|
-
logger_1.logger.error(`Bad pull request title: '${mergedPullRequest.title}'`);
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
const branchName = branch_name_1.BranchName.parse(mergedPullRequest.headBranchName);
|
|
194
|
-
if (!branchName) {
|
|
195
|
-
logger_1.logger.error(`Bad branch name: ${mergedPullRequest.headBranchName}`);
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
const pullRequestBody = pull_request_body_1.PullRequestBody.parse(mergedPullRequest.body);
|
|
199
|
-
if (!pullRequestBody) {
|
|
200
|
-
logger_1.logger.error('Could not parse pull request body as a release PR');
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
const component = await this.getComponent();
|
|
204
|
-
logger_1.logger.info('component:', component);
|
|
205
|
-
const releaseData = pullRequestBody.releaseData.length === 1 &&
|
|
206
|
-
!pullRequestBody.releaseData[0].component
|
|
207
|
-
? pullRequestBody.releaseData[0]
|
|
208
|
-
: pullRequestBody.releaseData.find(releaseData => {
|
|
209
|
-
return (this.normalizeComponent(releaseData.component) ===
|
|
210
|
-
this.normalizeComponent(component));
|
|
211
|
-
});
|
|
212
|
-
const notes = releaseData === null || releaseData === void 0 ? void 0 : releaseData.notes;
|
|
213
|
-
if (notes === undefined) {
|
|
214
|
-
logger_1.logger.warn('Failed to find release notes');
|
|
215
|
-
}
|
|
216
|
-
const version = pullRequestTitle.getVersion() || (releaseData === null || releaseData === void 0 ? void 0 : releaseData.version);
|
|
217
|
-
if (!version) {
|
|
218
|
-
logger_1.logger.error('Pull request should have included version');
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
const tag = new tag_name_1.TagName(version, this.includeComponentInTag ? component : undefined, this.tagSeparator);
|
|
222
|
-
return {
|
|
223
|
-
tag,
|
|
224
|
-
notes: notes || '',
|
|
225
|
-
sha: mergedPullRequest.sha,
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Override this to handle the initial version of a new library.
|
|
230
|
-
*/
|
|
231
|
-
initialReleaseVersion() {
|
|
232
|
-
return version_1.Version.parse('1.0.0');
|
|
233
|
-
}
|
|
234
|
-
addPath(file) {
|
|
235
|
-
if (this.path === manifest_1.ROOT_PROJECT_PATH) {
|
|
236
|
-
return file;
|
|
237
|
-
}
|
|
238
|
-
file = file.replace(/^[/\\]/, '');
|
|
239
|
-
if (this.path === undefined) {
|
|
240
|
-
return file;
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
const path = this.path.replace(/[/\\]$/, '');
|
|
244
|
-
return `${path}/${file}`;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
exports.Strategy = Strategy;
|
|
249
16
|
//# sourceMappingURL=strategy.js.map
|
|
@@ -55,7 +55,11 @@ class CargoToml extends default_1.DefaultUpdater {
|
|
|
55
55
|
}
|
|
56
56
|
const dep = deps[pkgName];
|
|
57
57
|
if (typeof dep === 'string' || typeof dep.path === 'undefined') {
|
|
58
|
-
logger_1.logger.info(`skipping ${depKind}.${pkgName}
|
|
58
|
+
logger_1.logger.info(`skipping ${depKind}.${pkgName} (no path set)`);
|
|
59
|
+
continue; // to next depKind
|
|
60
|
+
}
|
|
61
|
+
if (typeof dep.version === 'undefined') {
|
|
62
|
+
logger_1.logger.info(`skipping ${depKind}.${pkgName} (no version set)`);
|
|
59
63
|
continue; // to next depKind
|
|
60
64
|
}
|
|
61
65
|
logger_1.logger.info(`updating ${depKind}.${pkgName} from ${dep.version} to ${pkgVersion}`);
|
|
@@ -54,6 +54,9 @@ class CommitSplit {
|
|
|
54
54
|
split(commits) {
|
|
55
55
|
const splitCommits = {};
|
|
56
56
|
commits.forEach(commit => {
|
|
57
|
+
if (commit.files === undefined) {
|
|
58
|
+
throw new Error(`Commit ${commit.sha} is missing files. Did you set "backfillFiles" to "true"?`);
|
|
59
|
+
}
|
|
57
60
|
const dedupe = new Set();
|
|
58
61
|
for (let i = 0; i < commit.files.length; i++) {
|
|
59
62
|
const file = commit.files[i];
|
package/build/src/version.d.ts
CHANGED
|
@@ -1,11 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This data class is used to represent a SemVer version.
|
|
3
|
+
*/
|
|
1
4
|
export declare class Version {
|
|
2
|
-
major: number;
|
|
3
|
-
minor: number;
|
|
4
|
-
patch: number;
|
|
5
|
-
preRelease?: string;
|
|
6
|
-
build?: string;
|
|
5
|
+
readonly major: number;
|
|
6
|
+
readonly minor: number;
|
|
7
|
+
readonly patch: number;
|
|
8
|
+
readonly preRelease?: string;
|
|
9
|
+
readonly build?: string;
|
|
7
10
|
constructor(major: number, minor: number, patch: number, preRelease?: string, build?: string);
|
|
11
|
+
/**
|
|
12
|
+
* Parse a version string into a data class.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} versionString the input version string
|
|
15
|
+
* @returns {Version} the parsed version
|
|
16
|
+
* @throws {Error} if the version string cannot be parsed
|
|
17
|
+
*/
|
|
8
18
|
static parse(versionString: string): Version;
|
|
19
|
+
/**
|
|
20
|
+
* Comparator to other Versions to be used in sorting.
|
|
21
|
+
*
|
|
22
|
+
* @param {Version} other The other version to compare to
|
|
23
|
+
* @returns {number} -1 if this version is earlier, 0 if the versions
|
|
24
|
+
* are the same, or 1 otherwise.
|
|
25
|
+
*/
|
|
26
|
+
compare(other: Version): -1 | 0 | 1;
|
|
27
|
+
/**
|
|
28
|
+
* Returns a normalized string version of this version.
|
|
29
|
+
*
|
|
30
|
+
* @returns {string}
|
|
31
|
+
*/
|
|
9
32
|
toString(): string;
|
|
10
33
|
}
|
|
11
34
|
export declare type VersionsMap = Map<string, Version>;
|
package/build/src/version.js
CHANGED
|
@@ -14,7 +14,11 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.Version = void 0;
|
|
17
|
+
const semver = require("semver");
|
|
17
18
|
const VERSION_REGEX = /(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(-(?<preRelease>[^+]+))?(\+(?<build>.*))?/;
|
|
19
|
+
/**
|
|
20
|
+
* This data class is used to represent a SemVer version.
|
|
21
|
+
*/
|
|
18
22
|
class Version {
|
|
19
23
|
constructor(major, minor, patch, preRelease, build) {
|
|
20
24
|
this.major = major;
|
|
@@ -23,6 +27,13 @@ class Version {
|
|
|
23
27
|
this.preRelease = preRelease;
|
|
24
28
|
this.build = build;
|
|
25
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Parse a version string into a data class.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} versionString the input version string
|
|
34
|
+
* @returns {Version} the parsed version
|
|
35
|
+
* @throws {Error} if the version string cannot be parsed
|
|
36
|
+
*/
|
|
26
37
|
static parse(versionString) {
|
|
27
38
|
const match = versionString.match(VERSION_REGEX);
|
|
28
39
|
if (!(match === null || match === void 0 ? void 0 : match.groups)) {
|
|
@@ -35,6 +46,21 @@ class Version {
|
|
|
35
46
|
const build = match.groups.build;
|
|
36
47
|
return new Version(major, minor, patch, preRelease, build);
|
|
37
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Comparator to other Versions to be used in sorting.
|
|
51
|
+
*
|
|
52
|
+
* @param {Version} other The other version to compare to
|
|
53
|
+
* @returns {number} -1 if this version is earlier, 0 if the versions
|
|
54
|
+
* are the same, or 1 otherwise.
|
|
55
|
+
*/
|
|
56
|
+
compare(other) {
|
|
57
|
+
return semver.compare(this.toString(), other.toString());
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Returns a normalized string version of this version.
|
|
61
|
+
*
|
|
62
|
+
* @returns {string}
|
|
63
|
+
*/
|
|
38
64
|
toString() {
|
|
39
65
|
const preReleasePart = this.preRelease ? `-${this.preRelease}` : '';
|
|
40
66
|
const buildPart = this.build ? `+${this.build}` : '';
|
|
@@ -2,6 +2,10 @@ import { Version } from '../version';
|
|
|
2
2
|
import { ConventionalCommit } from '../commit';
|
|
3
3
|
import { DefaultVersioningStrategy } from './default';
|
|
4
4
|
import { VersionUpdater } from '../versioning-strategy';
|
|
5
|
+
/**
|
|
6
|
+
* This VersioningStrategy always bumps the patch version. This
|
|
7
|
+
* strategy is useful for backport branches.
|
|
8
|
+
*/
|
|
5
9
|
export declare class AlwaysBumpPatch extends DefaultVersioningStrategy {
|
|
6
10
|
determineReleaseType(_version: Version, _commits: ConventionalCommit[]): VersionUpdater;
|
|
7
11
|
}
|
|
@@ -16,6 +16,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.AlwaysBumpPatch = void 0;
|
|
17
17
|
const default_1 = require("./default");
|
|
18
18
|
const versioning_strategy_1 = require("../versioning-strategy");
|
|
19
|
+
/**
|
|
20
|
+
* This VersioningStrategy always bumps the patch version. This
|
|
21
|
+
* strategy is useful for backport branches.
|
|
22
|
+
*/
|
|
19
23
|
class AlwaysBumpPatch extends default_1.DefaultVersioningStrategy {
|
|
20
24
|
determineReleaseType(_version, _commits) {
|
|
21
25
|
return new versioning_strategy_1.PatchVersionUpdate();
|
|
@@ -5,11 +5,42 @@ interface DefaultVersioningStrategyOptions {
|
|
|
5
5
|
bumpMinorPreMajor?: boolean;
|
|
6
6
|
bumpPatchForMinorPreMajor?: boolean;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* This is the default VersioningStrategy for release-please. Breaking
|
|
10
|
+
* changes should bump the major, features should bump the minor, and other
|
|
11
|
+
* significant changes should bump the patch version.
|
|
12
|
+
*/
|
|
8
13
|
export declare class DefaultVersioningStrategy implements VersioningStrategy {
|
|
9
14
|
readonly bumpMinorPreMajor: boolean;
|
|
10
15
|
readonly bumpPatchForMinorPreMajor: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Create a new DefaultVersioningStrategy
|
|
18
|
+
* @param {DefaultVersioningStrategyOptions} options Configuration options
|
|
19
|
+
* @param {boolean} options.bumpMinorPreMajor If the current version is less than 1.0.0,
|
|
20
|
+
* then bump the minor version for breaking changes
|
|
21
|
+
* @param {boolean} options.bumpPatchForMinorPreMajor If the current version is less than
|
|
22
|
+
* 1.0.0, then bump the patch version for features
|
|
23
|
+
*/
|
|
11
24
|
constructor(options?: DefaultVersioningStrategyOptions);
|
|
25
|
+
/**
|
|
26
|
+
* Given the current version of an artifact and a list of commits,
|
|
27
|
+
* return a VersionUpdater that knows how to bump the version.
|
|
28
|
+
*
|
|
29
|
+
* This is useful for chaining together versioning strategies.
|
|
30
|
+
*
|
|
31
|
+
* @param {Version} version The current version
|
|
32
|
+
* @param {ConventionalCommit[]} commits The list of commits to consider
|
|
33
|
+
* @returns {VersionUpdater} Updater for bumping the next version.
|
|
34
|
+
*/
|
|
12
35
|
determineReleaseType(version: Version, commits: ConventionalCommit[]): VersionUpdater;
|
|
36
|
+
/**
|
|
37
|
+
* Given the current version of an artifact and a list of commits,
|
|
38
|
+
* return the next version.
|
|
39
|
+
*
|
|
40
|
+
* @param {Version} version The current version
|
|
41
|
+
* @param {ConventionalCommit[]} commits The list of commits to consider
|
|
42
|
+
* @returns {Version} The next version
|
|
43
|
+
*/
|
|
13
44
|
bump(version: Version, commits: ConventionalCommit[]): Version;
|
|
14
45
|
}
|
|
15
46
|
export {};
|
|
@@ -16,11 +16,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.DefaultVersioningStrategy = void 0;
|
|
17
17
|
const versioning_strategy_1 = require("../versioning-strategy");
|
|
18
18
|
const version_1 = require("../version");
|
|
19
|
+
/**
|
|
20
|
+
* This is the default VersioningStrategy for release-please. Breaking
|
|
21
|
+
* changes should bump the major, features should bump the minor, and other
|
|
22
|
+
* significant changes should bump the patch version.
|
|
23
|
+
*/
|
|
19
24
|
class DefaultVersioningStrategy {
|
|
25
|
+
/**
|
|
26
|
+
* Create a new DefaultVersioningStrategy
|
|
27
|
+
* @param {DefaultVersioningStrategyOptions} options Configuration options
|
|
28
|
+
* @param {boolean} options.bumpMinorPreMajor If the current version is less than 1.0.0,
|
|
29
|
+
* then bump the minor version for breaking changes
|
|
30
|
+
* @param {boolean} options.bumpPatchForMinorPreMajor If the current version is less than
|
|
31
|
+
* 1.0.0, then bump the patch version for features
|
|
32
|
+
*/
|
|
20
33
|
constructor(options = {}) {
|
|
21
34
|
this.bumpMinorPreMajor = options.bumpMinorPreMajor === true;
|
|
22
35
|
this.bumpPatchForMinorPreMajor = options.bumpPatchForMinorPreMajor === true;
|
|
23
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Given the current version of an artifact and a list of commits,
|
|
39
|
+
* return a VersionUpdater that knows how to bump the version.
|
|
40
|
+
*
|
|
41
|
+
* This is useful for chaining together versioning strategies.
|
|
42
|
+
*
|
|
43
|
+
* @param {Version} version The current version
|
|
44
|
+
* @param {ConventionalCommit[]} commits The list of commits to consider
|
|
45
|
+
* @returns {VersionUpdater} Updater for bumping the next version.
|
|
46
|
+
*/
|
|
24
47
|
determineReleaseType(version, commits) {
|
|
25
48
|
// iterate through list of commits and find biggest commit type
|
|
26
49
|
let breaking = 0;
|
|
@@ -59,6 +82,14 @@ class DefaultVersioningStrategy {
|
|
|
59
82
|
}
|
|
60
83
|
return new versioning_strategy_1.PatchVersionUpdate();
|
|
61
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Given the current version of an artifact and a list of commits,
|
|
87
|
+
* return the next version.
|
|
88
|
+
*
|
|
89
|
+
* @param {Version} version The current version
|
|
90
|
+
* @param {ConventionalCommit[]} commits The list of commits to consider
|
|
91
|
+
* @returns {Version} The next version
|
|
92
|
+
*/
|
|
62
93
|
bump(version, commits) {
|
|
63
94
|
return this.determineReleaseType(version, commits).bump(version);
|
|
64
95
|
}
|
|
@@ -2,6 +2,14 @@ import { Version } from '../version';
|
|
|
2
2
|
import { ConventionalCommit } from '../commit';
|
|
3
3
|
import { DefaultVersioningStrategy } from './default';
|
|
4
4
|
import { VersionUpdater } from '../versioning-strategy';
|
|
5
|
+
/**
|
|
6
|
+
* This VersioningStrategy looks at `deps` type commits and tries to
|
|
7
|
+
* mirror the semantic version bump for that dependency update. For
|
|
8
|
+
* example, an update to v2, would be treated as a major version bump.
|
|
9
|
+
*
|
|
10
|
+
* It also respects the default commit types and will pick the
|
|
11
|
+
* greatest version bump.
|
|
12
|
+
*/
|
|
5
13
|
export declare class DependencyManifest extends DefaultVersioningStrategy {
|
|
6
14
|
determineReleaseType(version: Version, commits: ConventionalCommit[]): VersionUpdater;
|
|
7
15
|
}
|
|
@@ -19,6 +19,14 @@ const semver = require("semver");
|
|
|
19
19
|
const default_1 = require("./default");
|
|
20
20
|
const versioning_strategy_1 = require("../versioning-strategy");
|
|
21
21
|
const DEPENDENCY_UPDATE_REGEX = /^deps: update dependency (.*) to (v.*)(\s\(#\d+\))?$/m;
|
|
22
|
+
/**
|
|
23
|
+
* This VersioningStrategy looks at `deps` type commits and tries to
|
|
24
|
+
* mirror the semantic version bump for that dependency update. For
|
|
25
|
+
* example, an update to v2, would be treated as a major version bump.
|
|
26
|
+
*
|
|
27
|
+
* It also respects the default commit types and will pick the
|
|
28
|
+
* greatest version bump.
|
|
29
|
+
*/
|
|
22
30
|
class DependencyManifest extends default_1.DefaultVersioningStrategy {
|
|
23
31
|
determineReleaseType(version, commits) {
|
|
24
32
|
const regularBump = super.determineReleaseType(version, commits);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { VersioningStrategy, VersionUpdater } from '../versioning-strategy';
|
|
2
2
|
import { Version } from '../version';
|
|
3
3
|
import { ConventionalCommit } from '../commit';
|
|
4
|
+
/**
|
|
5
|
+
* This VersioningStrategy is used by Java releases to bump
|
|
6
|
+
* to the next snapshot version.
|
|
7
|
+
*/
|
|
4
8
|
export declare class JavaAddSnapshot implements VersioningStrategy {
|
|
5
9
|
strategy: VersioningStrategy;
|
|
6
10
|
constructor(strategy: VersioningStrategy);
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.JavaAddSnapshot = void 0;
|
|
17
|
+
const version_1 = require("../version");
|
|
17
18
|
const fakeCommit = {
|
|
18
19
|
message: 'fix: fake fix',
|
|
19
20
|
type: 'fix',
|
|
@@ -27,17 +28,17 @@ const fakeCommit = {
|
|
|
27
28
|
};
|
|
28
29
|
class AddSnapshotVersionUpdate {
|
|
29
30
|
constructor(strategy) {
|
|
30
|
-
this.name = 'java-snapshot';
|
|
31
31
|
this.strategy = strategy;
|
|
32
32
|
}
|
|
33
33
|
bump(version) {
|
|
34
34
|
const nextPatch = this.strategy.bump(version, [fakeCommit]);
|
|
35
|
-
nextPatch.preRelease
|
|
36
|
-
? `${nextPatch.preRelease}-SNAPSHOT`
|
|
37
|
-
: 'SNAPSHOT';
|
|
38
|
-
return nextPatch;
|
|
35
|
+
return new version_1.Version(nextPatch.major, nextPatch.minor, nextPatch.patch, nextPatch.preRelease ? `${nextPatch.preRelease}-SNAPSHOT` : 'SNAPSHOT', nextPatch.build);
|
|
39
36
|
}
|
|
40
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* This VersioningStrategy is used by Java releases to bump
|
|
40
|
+
* to the next snapshot version.
|
|
41
|
+
*/
|
|
41
42
|
class JavaAddSnapshot {
|
|
42
43
|
constructor(strategy) {
|
|
43
44
|
this.strategy = strategy;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { VersioningStrategy, VersionUpdater } from '../versioning-strategy';
|
|
2
2
|
import { Version } from '../version';
|
|
3
3
|
import { ConventionalCommit } from '../commit';
|
|
4
|
+
/**
|
|
5
|
+
* This VersioningStrategy is used by Java releases to bump
|
|
6
|
+
* to the next non-snapshot version.
|
|
7
|
+
*/
|
|
4
8
|
export declare class JavaSnapshot implements VersioningStrategy {
|
|
5
9
|
strategy: VersioningStrategy;
|
|
6
10
|
constructor(strategy: VersioningStrategy);
|
|
@@ -28,7 +28,6 @@ const fakeCommit = {
|
|
|
28
28
|
};
|
|
29
29
|
class RemoveSnapshotVersionUpdate {
|
|
30
30
|
constructor(parent) {
|
|
31
|
-
this.name = 'remove-snapshot';
|
|
32
31
|
this.parent = parent;
|
|
33
32
|
}
|
|
34
33
|
bump(version) {
|
|
@@ -40,6 +39,10 @@ class RemoveSnapshotVersionUpdate {
|
|
|
40
39
|
: undefined, version.build);
|
|
41
40
|
}
|
|
42
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* This VersioningStrategy is used by Java releases to bump
|
|
44
|
+
* to the next non-snapshot version.
|
|
45
|
+
*/
|
|
43
46
|
class JavaSnapshot {
|
|
44
47
|
constructor(strategy) {
|
|
45
48
|
this.strategy = strategy;
|
|
@@ -2,6 +2,11 @@ import { Version } from '../version';
|
|
|
2
2
|
import { DefaultVersioningStrategy } from './default';
|
|
3
3
|
import { ConventionalCommit } from '../commit';
|
|
4
4
|
import { VersionUpdater } from '../versioning-strategy';
|
|
5
|
+
/**
|
|
6
|
+
* This VersioningStrategy is used for "service pack" versioning. In this
|
|
7
|
+
* strategy, we use the pre-release field with a pattern of `sp-\d+` where
|
|
8
|
+
* the number is an auto-incrementing integer starting with 1.
|
|
9
|
+
*/
|
|
5
10
|
export declare class ServicePackVersioningStrategy extends DefaultVersioningStrategy {
|
|
6
11
|
determineReleaseType(_version: Version, _commits: ConventionalCommit[]): VersionUpdater;
|
|
7
12
|
}
|
|
@@ -17,10 +17,12 @@ exports.ServicePackVersioningStrategy = void 0;
|
|
|
17
17
|
const version_1 = require("../version");
|
|
18
18
|
const default_1 = require("./default");
|
|
19
19
|
const SERVICE_PACK_PATTERN = /sp\.(\d+)/;
|
|
20
|
+
/**
|
|
21
|
+
* This version updater knows how to bump from a non-service pack
|
|
22
|
+
* version to a service pack version and increment the service
|
|
23
|
+
* pack number in subsequent releases.
|
|
24
|
+
*/
|
|
20
25
|
class ServicePackVersionUpdate {
|
|
21
|
-
constructor() {
|
|
22
|
-
this.name = 'service-pack';
|
|
23
|
-
}
|
|
24
26
|
bump(version) {
|
|
25
27
|
var _a;
|
|
26
28
|
const match = (_a = version.preRelease) === null || _a === void 0 ? void 0 : _a.match(SERVICE_PACK_PATTERN);
|
|
@@ -31,6 +33,11 @@ class ServicePackVersionUpdate {
|
|
|
31
33
|
return new version_1.Version(version.major, version.minor, version.patch, 'sp.1', version.build);
|
|
32
34
|
}
|
|
33
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* This VersioningStrategy is used for "service pack" versioning. In this
|
|
38
|
+
* strategy, we use the pre-release field with a pattern of `sp-\d+` where
|
|
39
|
+
* the number is an auto-incrementing integer starting with 1.
|
|
40
|
+
*/
|
|
34
41
|
class ServicePackVersioningStrategy extends default_1.DefaultVersioningStrategy {
|
|
35
42
|
determineReleaseType(_version, _commits) {
|
|
36
43
|
return new ServicePackVersionUpdate();
|