release-please 13.0.0-candidate.2 → 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.d.ts +0 -1
- package/build/src/bin/release-please.js +24 -6
- package/build/src/changelog-notes/default.d.ts +1 -3
- package/build/src/changelog-notes/default.js +2 -3
- package/build/src/changelog-notes/github.d.ts +8 -0
- package/build/src/changelog-notes/github.js +26 -0
- package/build/src/changelog-notes.d.ts +3 -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/factory.d.ts +13 -0
- package/build/src/factory.js +26 -1
- package/build/src/github.d.ts +48 -7
- package/build/src/github.js +73 -19
- package/build/src/manifest.d.ts +7 -3
- package/build/src/manifest.js +94 -25
- 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 +10 -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 +5 -4
- package/build/src/strategies/java-yoshi.js +58 -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 +3 -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 -70
- package/build/src/strategy.js +0 -217
- package/build/src/updaters/go/version-go.d.ts +4 -0
- package/build/src/updaters/go/version-go.js +24 -0
- package/build/src/updaters/rust/cargo-toml.js +5 -1
- package/build/src/util/branch-name.js +65 -7
- 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 +4 -4
- package/build/src/release-notes.d.ts +0 -29
- package/build/src/release-notes.js +0 -71
|
@@ -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}`);
|
|
@@ -21,7 +21,13 @@ const version_1 = require("../version");
|
|
|
21
21
|
// import {RELEASE_PLEASE} from '../constants';
|
|
22
22
|
const RELEASE_PLEASE = 'release-please';
|
|
23
23
|
function getAllResourceNames() {
|
|
24
|
-
return [
|
|
24
|
+
return [
|
|
25
|
+
AutoreleaseBranchName,
|
|
26
|
+
ComponentBranchName,
|
|
27
|
+
DefaultBranchName,
|
|
28
|
+
V12ComponentBranchName,
|
|
29
|
+
V12DefaultBranchName,
|
|
30
|
+
];
|
|
25
31
|
}
|
|
26
32
|
class BranchName {
|
|
27
33
|
constructor(_branchName) { }
|
|
@@ -41,10 +47,10 @@ class BranchName {
|
|
|
41
47
|
return new AutoreleaseBranchName(`release-v${version}`);
|
|
42
48
|
}
|
|
43
49
|
static ofTargetBranch(targetBranch) {
|
|
44
|
-
return new DefaultBranchName(`${RELEASE_PLEASE}
|
|
50
|
+
return new DefaultBranchName(`${RELEASE_PLEASE}--branches--${targetBranch}`);
|
|
45
51
|
}
|
|
46
52
|
static ofComponentTargetBranch(component, targetBranch) {
|
|
47
|
-
return new ComponentBranchName(`${RELEASE_PLEASE}
|
|
53
|
+
return new ComponentBranchName(`${RELEASE_PLEASE}--branches--${targetBranch}--components--${component}`);
|
|
48
54
|
}
|
|
49
55
|
static matches(_branchName) {
|
|
50
56
|
return false;
|
|
@@ -63,6 +69,11 @@ class BranchName {
|
|
|
63
69
|
}
|
|
64
70
|
}
|
|
65
71
|
exports.BranchName = BranchName;
|
|
72
|
+
/**
|
|
73
|
+
* This is the legacy branch pattern used by releasetool
|
|
74
|
+
*
|
|
75
|
+
* @see https://github.com/googleapis/releasetool
|
|
76
|
+
*/
|
|
66
77
|
const AUTORELEASE_PATTERN = /^release-?(?<component>[\w-.]*)?-v(?<version>[0-9].*)$/;
|
|
67
78
|
class AutoreleaseBranchName extends BranchName {
|
|
68
79
|
static matches(branchName) {
|
|
@@ -84,7 +95,54 @@ class AutoreleaseBranchName extends BranchName {
|
|
|
84
95
|
return `release-v${(_b = this.version) === null || _b === void 0 ? void 0 : _b.toString()}`;
|
|
85
96
|
}
|
|
86
97
|
}
|
|
87
|
-
|
|
98
|
+
/**
|
|
99
|
+
* This is a parsable branch pattern used by release-please v12.
|
|
100
|
+
* It has potential issues due to git treating `/` like directories.
|
|
101
|
+
* This should be removed at some point in the future.
|
|
102
|
+
*
|
|
103
|
+
* @see https://github.com/googleapis/release-please/issues/1024
|
|
104
|
+
*/
|
|
105
|
+
const V12_DEFAULT_PATTERN = `^${RELEASE_PLEASE}/branches/(?<branch>[^/]+)$`;
|
|
106
|
+
class V12DefaultBranchName extends BranchName {
|
|
107
|
+
static matches(branchName) {
|
|
108
|
+
return !!branchName.match(V12_DEFAULT_PATTERN);
|
|
109
|
+
}
|
|
110
|
+
constructor(branchName) {
|
|
111
|
+
super(branchName);
|
|
112
|
+
const match = branchName.match(V12_DEFAULT_PATTERN);
|
|
113
|
+
if (match === null || match === void 0 ? void 0 : match.groups) {
|
|
114
|
+
this.targetBranch = match.groups['branch'];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
toString() {
|
|
118
|
+
return `${RELEASE_PLEASE}/branches/${this.targetBranch}`;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* This is a parsable branch pattern used by release-please v12.
|
|
123
|
+
* It has potential issues due to git treating `/` like directories.
|
|
124
|
+
* This should be removed at some point in the future.
|
|
125
|
+
*
|
|
126
|
+
* @see https://github.com/googleapis/release-please/issues/1024
|
|
127
|
+
*/
|
|
128
|
+
const V12_COMPONENT_PATTERN = `^${RELEASE_PLEASE}/branches/(?<branch>[^/]+)/components/(?<component>.+)$`;
|
|
129
|
+
class V12ComponentBranchName extends BranchName {
|
|
130
|
+
static matches(branchName) {
|
|
131
|
+
return !!branchName.match(V12_COMPONENT_PATTERN);
|
|
132
|
+
}
|
|
133
|
+
constructor(branchName) {
|
|
134
|
+
super(branchName);
|
|
135
|
+
const match = branchName.match(V12_COMPONENT_PATTERN);
|
|
136
|
+
if (match === null || match === void 0 ? void 0 : match.groups) {
|
|
137
|
+
this.targetBranch = match.groups['branch'];
|
|
138
|
+
this.component = match.groups['component'];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
toString() {
|
|
142
|
+
return `${RELEASE_PLEASE}/branches/${this.targetBranch}/components/${this.component}`;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const DEFAULT_PATTERN = `^${RELEASE_PLEASE}--branches--(?<branch>.+)$`;
|
|
88
146
|
class DefaultBranchName extends BranchName {
|
|
89
147
|
static matches(branchName) {
|
|
90
148
|
return !!branchName.match(DEFAULT_PATTERN);
|
|
@@ -97,10 +155,10 @@ class DefaultBranchName extends BranchName {
|
|
|
97
155
|
}
|
|
98
156
|
}
|
|
99
157
|
toString() {
|
|
100
|
-
return `${RELEASE_PLEASE}
|
|
158
|
+
return `${RELEASE_PLEASE}--branches--${this.targetBranch}`;
|
|
101
159
|
}
|
|
102
160
|
}
|
|
103
|
-
const COMPONENT_PATTERN = `^${RELEASE_PLEASE}
|
|
161
|
+
const COMPONENT_PATTERN = `^${RELEASE_PLEASE}--branches--(?<branch>.+)--components--(?<component>.+)$`;
|
|
104
162
|
class ComponentBranchName extends BranchName {
|
|
105
163
|
static matches(branchName) {
|
|
106
164
|
return !!branchName.match(COMPONENT_PATTERN);
|
|
@@ -114,7 +172,7 @@ class ComponentBranchName extends BranchName {
|
|
|
114
172
|
}
|
|
115
173
|
}
|
|
116
174
|
toString() {
|
|
117
|
-
return `${RELEASE_PLEASE}
|
|
175
|
+
return `${RELEASE_PLEASE}--branches--${this.targetBranch}--components--${this.component}`;
|
|
118
176
|
}
|
|
119
177
|
}
|
|
120
178
|
//# sourceMappingURL=branch-name.js.map
|
|
@@ -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();
|
|
@@ -1,28 +1,90 @@
|
|
|
1
1
|
import { Version } from './version';
|
|
2
2
|
import { ConventionalCommit } from './commit';
|
|
3
|
+
/**
|
|
4
|
+
* An interface for updating a version.
|
|
5
|
+
*/
|
|
3
6
|
export interface VersionUpdater {
|
|
7
|
+
/**
|
|
8
|
+
* Returns the new bumped version
|
|
9
|
+
*
|
|
10
|
+
* @param {Version} version The current version
|
|
11
|
+
* @returns {Version} The bumped version
|
|
12
|
+
*/
|
|
4
13
|
bump(version: Version): Version;
|
|
5
|
-
name: string;
|
|
6
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* This VersionUpdater performs a SemVer major version bump.
|
|
17
|
+
*/
|
|
7
18
|
export declare class MajorVersionUpdate implements VersionUpdater {
|
|
8
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Returns the new bumped version
|
|
21
|
+
*
|
|
22
|
+
* @param {Version} version The current version
|
|
23
|
+
* @returns {Version} The bumped version
|
|
24
|
+
*/
|
|
9
25
|
bump(version: Version): Version;
|
|
10
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* This VersionUpdater performs a SemVer minor version bump.
|
|
29
|
+
*/
|
|
11
30
|
export declare class MinorVersionUpdate implements VersionUpdater {
|
|
12
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Returns the new bumped version
|
|
33
|
+
*
|
|
34
|
+
* @param {Version} version The current version
|
|
35
|
+
* @returns {Version} The bumped version
|
|
36
|
+
*/
|
|
13
37
|
bump(version: Version): Version;
|
|
14
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* This VersionUpdater performs a SemVer patch version bump.
|
|
41
|
+
*/
|
|
15
42
|
export declare class PatchVersionUpdate implements VersionUpdater {
|
|
16
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Returns the new bumped version
|
|
45
|
+
*
|
|
46
|
+
* @param {Version} version The current version
|
|
47
|
+
* @returns {Version} The bumped version
|
|
48
|
+
*/
|
|
17
49
|
bump(version: Version): Version;
|
|
18
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* This VersionUpdater sets the version to a specific version.
|
|
53
|
+
*/
|
|
19
54
|
export declare class CustomVersionUpdate implements VersionUpdater {
|
|
20
|
-
name: string;
|
|
21
55
|
private versionString;
|
|
22
56
|
constructor(versionString: string);
|
|
57
|
+
/**
|
|
58
|
+
* Returns the new bumped version. This version is specified
|
|
59
|
+
* at initialization.
|
|
60
|
+
*
|
|
61
|
+
* @param {Version} version The current version
|
|
62
|
+
* @returns {Version} The bumped version
|
|
63
|
+
*/
|
|
23
64
|
bump(_version: Version): Version;
|
|
24
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Implement this interface to create a new versioning scheme.
|
|
68
|
+
*/
|
|
25
69
|
export interface VersioningStrategy {
|
|
70
|
+
/**
|
|
71
|
+
* Given the current version of an artifact and a list of commits,
|
|
72
|
+
* return the next version.
|
|
73
|
+
*
|
|
74
|
+
* @param {Version} version The current version
|
|
75
|
+
* @param {ConventionalCommit[]} commits The list of commits to consider
|
|
76
|
+
* @returns {Version} The next version
|
|
77
|
+
*/
|
|
26
78
|
bump(version: Version, commits: ConventionalCommit[]): Version;
|
|
79
|
+
/**
|
|
80
|
+
* Given the current version of an artifact and a list of commits,
|
|
81
|
+
* return a VersionUpdater that knows how to bump the version.
|
|
82
|
+
*
|
|
83
|
+
* This is useful for chaining together versioning strategies.
|
|
84
|
+
*
|
|
85
|
+
* @param {Version} version The current version
|
|
86
|
+
* @param {ConventionalCommit[]} commits The list of commits to consider
|
|
87
|
+
* @returns {VersionUpdater} Updater for bumping the next version.
|
|
88
|
+
*/
|
|
27
89
|
determineReleaseType(version: Version, commits: ConventionalCommit[]): VersionUpdater;
|
|
28
90
|
}
|