release-please 16.1.0 → 16.3.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 +5 -0
- package/build/src/manifest.d.ts +2 -0
- package/build/src/manifest.js +12 -14
- package/build/src/plugins/merge.d.ts +2 -0
- package/build/src/plugins/merge.js +2 -0
- package/build/src/plugins/node-workspace.d.ts +9 -7
- package/build/src/plugins/node-workspace.js +75 -103
- package/build/src/plugins/workspace.js +1 -1
- package/build/src/strategies/base.d.ts +3 -1
- package/build/src/strategies/base.js +7 -3
- package/build/src/strategies/dotnet-yoshi.js +5 -2
- package/build/src/updaters/node/package-json.d.ts +8 -0
- package/build/src/updaters/node/package-json.js +60 -1
- package/build/src/updaters/release-please-config.js +1 -0
- package/build/src/util/pull-request-body.js +1 -1
- package/package.json +1 -2
- package/schemas/config.json +5 -0
- package/CHANGELOG.md +0 -2787
- package/build/src/updaters/changelog.js.map +0 -1
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ A linear git history makes it much easier to:
|
|
|
63
63
|
change introduced a bug
|
|
64
64
|
* Control the release-please changelog - when you merge a PR, you may have
|
|
65
65
|
commit messages that make sense within the scope of the PR, but don't
|
|
66
|
-
make sense when merged in the main branch. For example, you
|
|
66
|
+
make sense when merged in the main branch. For example, you may have
|
|
67
67
|
`feat: introduce feature A` and then `fix: some bugfix introduced in
|
|
68
68
|
the first commit`. The `fix` commit is actually irrelevant to the release
|
|
69
69
|
notes as there was never a bug experienced in the main branch.
|
|
@@ -274,6 +274,10 @@ function taggingOptions(yargs) {
|
|
|
274
274
|
.option('pull-request-header', {
|
|
275
275
|
describe: 'Header for release PR',
|
|
276
276
|
type: 'string',
|
|
277
|
+
})
|
|
278
|
+
.option('pull-request-footer', {
|
|
279
|
+
describe: 'Footer for release PR',
|
|
280
|
+
type: 'string',
|
|
277
281
|
});
|
|
278
282
|
}
|
|
279
283
|
const createReleasePullRequestCommand = {
|
|
@@ -300,6 +304,7 @@ const createReleasePullRequestCommand = {
|
|
|
300
304
|
changelogHost: argv.changelogHost,
|
|
301
305
|
pullRequestTitlePattern: argv.pullRequestTitlePattern,
|
|
302
306
|
pullRequestHeader: argv.pullRequestHeader,
|
|
307
|
+
pullRequestFooter: argv.pullRequestFooter,
|
|
303
308
|
changelogSections: argv.changelogSections,
|
|
304
309
|
releaseAs: argv.releaseAs,
|
|
305
310
|
versioning: argv.versioningStrategy,
|
package/build/src/manifest.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export interface ReleaserConfig {
|
|
|
57
57
|
includeVInTag?: boolean;
|
|
58
58
|
pullRequestTitlePattern?: string;
|
|
59
59
|
pullRequestHeader?: string;
|
|
60
|
+
pullRequestFooter?: string;
|
|
60
61
|
tagSeparator?: string;
|
|
61
62
|
separatePullRequests?: boolean;
|
|
62
63
|
labels?: string[];
|
|
@@ -105,6 +106,7 @@ interface ReleaserConfigJson {
|
|
|
105
106
|
'changelog-host'?: string;
|
|
106
107
|
'pull-request-title-pattern'?: string;
|
|
107
108
|
'pull-request-header'?: string;
|
|
109
|
+
'pull-request-footer'?: string;
|
|
108
110
|
'separate-pull-requests'?: boolean;
|
|
109
111
|
'tag-separator'?: string;
|
|
110
112
|
'extra-files'?: ExtraFile[];
|
package/build/src/manifest.js
CHANGED
|
@@ -688,10 +688,8 @@ class Manifest {
|
|
|
688
688
|
releases.length) {
|
|
689
689
|
// we've either tagged all releases or they were duplicates:
|
|
690
690
|
// adjust tags on pullRequest
|
|
691
|
-
await
|
|
692
|
-
|
|
693
|
-
this.github.addIssueLabels(this.releaseLabels, pullRequest.number),
|
|
694
|
-
]);
|
|
691
|
+
await this.github.removeIssueLabels(this.labels, pullRequest.number);
|
|
692
|
+
await this.github.addIssueLabels(this.releaseLabels, pullRequest.number);
|
|
695
693
|
}
|
|
696
694
|
if (githubReleases.length === 0) {
|
|
697
695
|
// If all releases were duplicate, throw a duplicate error
|
|
@@ -700,10 +698,8 @@ class Manifest {
|
|
|
700
698
|
}
|
|
701
699
|
else {
|
|
702
700
|
// adjust tags on pullRequest
|
|
703
|
-
await
|
|
704
|
-
|
|
705
|
-
this.github.addIssueLabels(this.releaseLabels, pullRequest.number),
|
|
706
|
-
]);
|
|
701
|
+
await this.github.removeIssueLabels(this.labels, pullRequest.number);
|
|
702
|
+
await this.github.addIssueLabels(this.releaseLabels, pullRequest.number);
|
|
707
703
|
}
|
|
708
704
|
return githubReleases;
|
|
709
705
|
}
|
|
@@ -791,6 +787,7 @@ function extractReleaserConfig(config) {
|
|
|
791
787
|
changelogType: config['changelog-type'],
|
|
792
788
|
pullRequestTitlePattern: config['pull-request-title-pattern'],
|
|
793
789
|
pullRequestHeader: config['pull-request-header'],
|
|
790
|
+
pullRequestFooter: config['pull-request-footer'],
|
|
794
791
|
tagSeparator: config['tag-separator'],
|
|
795
792
|
separatePullRequests: config['separate-pull-requests'],
|
|
796
793
|
labels: (_a = config['label']) === null || _a === void 0 ? void 0 : _a.split(','),
|
|
@@ -1011,7 +1008,7 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, config,
|
|
|
1011
1008
|
return candidateTagVersion.sort((a, b) => b.compare(a))[0];
|
|
1012
1009
|
}
|
|
1013
1010
|
function mergeReleaserConfig(defaultConfig, pathConfig) {
|
|
1014
|
-
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;
|
|
1011
|
+
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;
|
|
1015
1012
|
return {
|
|
1016
1013
|
releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node',
|
|
1017
1014
|
bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor,
|
|
@@ -1035,11 +1032,12 @@ function mergeReleaserConfig(defaultConfig, pathConfig) {
|
|
|
1035
1032
|
tagSeparator: (_w = pathConfig.tagSeparator) !== null && _w !== void 0 ? _w : defaultConfig.tagSeparator,
|
|
1036
1033
|
pullRequestTitlePattern: (_x = pathConfig.pullRequestTitlePattern) !== null && _x !== void 0 ? _x : defaultConfig.pullRequestTitlePattern,
|
|
1037
1034
|
pullRequestHeader: (_y = pathConfig.pullRequestHeader) !== null && _y !== void 0 ? _y : defaultConfig.pullRequestHeader,
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1035
|
+
pullRequestFooter: (_z = pathConfig.pullRequestFooter) !== null && _z !== void 0 ? _z : defaultConfig.pullRequestFooter,
|
|
1036
|
+
separatePullRequests: (_0 = pathConfig.separatePullRequests) !== null && _0 !== void 0 ? _0 : defaultConfig.separatePullRequests,
|
|
1037
|
+
skipSnapshot: (_1 = pathConfig.skipSnapshot) !== null && _1 !== void 0 ? _1 : defaultConfig.skipSnapshot,
|
|
1038
|
+
initialVersion: (_2 = pathConfig.initialVersion) !== null && _2 !== void 0 ? _2 : defaultConfig.initialVersion,
|
|
1039
|
+
extraLabels: (_3 = pathConfig.extraLabels) !== null && _3 !== void 0 ? _3 : defaultConfig.extraLabels,
|
|
1040
|
+
excludePaths: (_4 = pathConfig.excludePaths) !== null && _4 !== void 0 ? _4 : defaultConfig.excludePaths,
|
|
1043
1041
|
};
|
|
1044
1042
|
}
|
|
1045
1043
|
/**
|
|
@@ -4,6 +4,7 @@ import { GitHub } from '../github';
|
|
|
4
4
|
interface MergeOptions {
|
|
5
5
|
pullRequestTitlePattern?: string;
|
|
6
6
|
pullRequestHeader?: string;
|
|
7
|
+
pullRequestFooter?: string;
|
|
7
8
|
headBranchName?: string;
|
|
8
9
|
forceMerge?: boolean;
|
|
9
10
|
}
|
|
@@ -16,6 +17,7 @@ interface MergeOptions {
|
|
|
16
17
|
export declare class Merge extends ManifestPlugin {
|
|
17
18
|
private pullRequestTitlePattern?;
|
|
18
19
|
private pullRequestHeader?;
|
|
20
|
+
private pullRequestFooter?;
|
|
19
21
|
private headBranchName?;
|
|
20
22
|
private forceMerge;
|
|
21
23
|
constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, options?: MergeOptions);
|
|
@@ -33,6 +33,7 @@ class Merge extends plugin_1.ManifestPlugin {
|
|
|
33
33
|
this.pullRequestTitlePattern =
|
|
34
34
|
(_a = options.pullRequestTitlePattern) !== null && _a !== void 0 ? _a : manifest_1.MANIFEST_PULL_REQUEST_TITLE_PATTERN;
|
|
35
35
|
this.pullRequestHeader = options.pullRequestHeader;
|
|
36
|
+
this.pullRequestFooter = options.pullRequestFooter;
|
|
36
37
|
this.headBranchName = options.headBranchName;
|
|
37
38
|
this.forceMerge = (_b = options.forceMerge) !== null && _b !== void 0 ? _b : false;
|
|
38
39
|
}
|
|
@@ -72,6 +73,7 @@ class Merge extends plugin_1.ManifestPlugin {
|
|
|
72
73
|
body: new pull_request_body_1.PullRequestBody(releaseData, {
|
|
73
74
|
useComponents: true,
|
|
74
75
|
header: this.pullRequestHeader,
|
|
76
|
+
footer: this.pullRequestFooter,
|
|
75
77
|
}),
|
|
76
78
|
updates,
|
|
77
79
|
labels: Array.from(labels),
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { Package as LernaPackage, RawManifest as PackageJson } from '@lerna-lite/core';
|
|
2
1
|
import { GitHub } from '../github';
|
|
3
2
|
import { CandidateReleasePullRequest, RepositoryConfig } from '../manifest';
|
|
4
3
|
import { Version, VersionsMap } from '../version';
|
|
5
4
|
import { WorkspacePlugin, DependencyGraph, WorkspacePluginOptions } from './workspace';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
interface Package {
|
|
6
|
+
path: string;
|
|
7
|
+
name: string;
|
|
8
|
+
version: string;
|
|
9
|
+
dependencies: Record<string, string>;
|
|
10
|
+
devDependencies: Record<string, string>;
|
|
11
|
+
peerDependencies: Record<string, string>;
|
|
12
|
+
optionalDependencies: Record<string, string>;
|
|
13
|
+
jsonContent: string;
|
|
10
14
|
}
|
|
11
15
|
interface NodeWorkspaceOptions extends WorkspacePluginOptions {
|
|
12
16
|
alwaysLinkLocal?: boolean;
|
|
@@ -20,7 +24,6 @@ interface NodeWorkspaceOptions extends WorkspacePluginOptions {
|
|
|
20
24
|
*/
|
|
21
25
|
export declare class NodeWorkspace extends WorkspacePlugin<Package> {
|
|
22
26
|
private alwaysLinkLocal;
|
|
23
|
-
private packageGraph?;
|
|
24
27
|
constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, options?: NodeWorkspaceOptions);
|
|
25
28
|
protected buildAllPackages(candidates: CandidateReleasePullRequest[]): Promise<{
|
|
26
29
|
allPackages: Package[];
|
|
@@ -34,7 +37,6 @@ export declare class NodeWorkspace extends WorkspacePlugin<Package> {
|
|
|
34
37
|
protected inScope(candidate: CandidateReleasePullRequest): boolean;
|
|
35
38
|
protected packageNameFromPackage(pkg: Package): string;
|
|
36
39
|
protected pathFromPackage(pkg: Package): string;
|
|
37
|
-
private detectRangePrefix;
|
|
38
40
|
private combineDeps;
|
|
39
41
|
}
|
|
40
42
|
export {};
|
|
@@ -14,26 +14,15 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.NodeWorkspace = void 0;
|
|
17
|
-
const core_1 = require("@lerna-lite/core");
|
|
18
|
-
const core_2 = require("@lerna-lite/core");
|
|
19
17
|
const version_1 = require("../version");
|
|
20
|
-
const raw_content_1 = require("../updaters/raw-content");
|
|
21
18
|
const pull_request_title_1 = require("../util/pull-request-title");
|
|
22
19
|
const pull_request_body_1 = require("../util/pull-request-body");
|
|
23
20
|
const branch_name_1 = require("../util/branch-name");
|
|
24
|
-
const json_stringify_1 = require("../util/json-stringify");
|
|
25
21
|
const changelog_1 = require("../updaters/changelog");
|
|
26
22
|
const workspace_1 = require("./workspace");
|
|
27
23
|
const versioning_strategy_1 = require("../versioning-strategy");
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
super(pkg !== null && pkg !== void 0 ? pkg : JSON.parse(rawContent), location);
|
|
31
|
-
this.rawContent = rawContent;
|
|
32
|
-
}
|
|
33
|
-
clone() {
|
|
34
|
-
return new Package(this.rawContent, this.location, this.toJSON());
|
|
35
|
-
}
|
|
36
|
-
}
|
|
24
|
+
const composite_1 = require("../updaters/composite");
|
|
25
|
+
const package_json_1 = require("../updaters/node/package-json");
|
|
37
26
|
/**
|
|
38
27
|
* The plugin analyzed a cargo workspace and will bump dependencies
|
|
39
28
|
* of managed packages if those dependencies are being updated.
|
|
@@ -47,6 +36,7 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
|
|
|
47
36
|
this.alwaysLinkLocal = options.alwaysLinkLocal === false ? false : true;
|
|
48
37
|
}
|
|
49
38
|
async buildAllPackages(candidates) {
|
|
39
|
+
var _a;
|
|
50
40
|
const candidatesByPath = new Map();
|
|
51
41
|
for (const candidate of candidates) {
|
|
52
42
|
candidatesByPath.set(candidate.path, candidate);
|
|
@@ -63,27 +53,41 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
|
|
|
63
53
|
this.logger.debug(`Found candidate pull request for path: ${candidate.path}`);
|
|
64
54
|
const packagePath = (0, workspace_1.addPath)(candidate.path, 'package.json');
|
|
65
55
|
const packageUpdate = candidate.pullRequest.updates.find(update => update.path === packagePath);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
56
|
+
const contents = (_a = packageUpdate === null || packageUpdate === void 0 ? void 0 : packageUpdate.cachedFileContents) !== null && _a !== void 0 ? _a : (await this.github.getFileContentsOnBranch(packagePath, this.targetBranch));
|
|
57
|
+
const packageJson = JSON.parse(contents.parsedContent);
|
|
58
|
+
const pkg = {
|
|
59
|
+
name: packageJson.name,
|
|
60
|
+
path,
|
|
61
|
+
version: packageJson.version,
|
|
62
|
+
dependencies: packageJson.dependencies || {},
|
|
63
|
+
devDependencies: packageJson.devDependencies || {},
|
|
64
|
+
peerDependencies: packageJson.peerDependencies || {},
|
|
65
|
+
optionalDependencies: packageJson.optionalDependencies || {},
|
|
66
|
+
jsonContent: contents.parsedContent,
|
|
67
|
+
};
|
|
68
|
+
packagesByPath.set(candidate.path, pkg);
|
|
69
|
+
candidatesByPackage[pkg.name] = candidate;
|
|
70
|
+
// }
|
|
77
71
|
}
|
|
78
72
|
else {
|
|
79
73
|
const packagePath = (0, workspace_1.addPath)(path, 'package.json');
|
|
80
74
|
this.logger.debug(`No candidate pull request for path: ${path} - inspect package from ${packagePath}`);
|
|
81
75
|
const contents = await this.github.getFileContentsOnBranch(packagePath, this.targetBranch);
|
|
82
|
-
|
|
76
|
+
const packageJson = JSON.parse(contents.parsedContent);
|
|
77
|
+
const pkg = {
|
|
78
|
+
name: packageJson.name,
|
|
79
|
+
path,
|
|
80
|
+
version: packageJson.version,
|
|
81
|
+
dependencies: packageJson.dependencies || {},
|
|
82
|
+
devDependencies: packageJson.devDependencies || {},
|
|
83
|
+
peerDependencies: packageJson.peerDependencies || {},
|
|
84
|
+
optionalDependencies: packageJson.optionalDependencies || {},
|
|
85
|
+
jsonContent: contents.parsedContent,
|
|
86
|
+
};
|
|
87
|
+
packagesByPath.set(path, pkg);
|
|
83
88
|
}
|
|
84
89
|
}
|
|
85
90
|
const allPackages = Array.from(packagesByPath.values());
|
|
86
|
-
this.packageGraph = new core_1.PackageGraph(allPackages, 'allDependencies', this.alwaysLinkLocal);
|
|
87
91
|
return {
|
|
88
92
|
allPackages,
|
|
89
93
|
candidatesByPackage,
|
|
@@ -94,35 +98,24 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
|
|
|
94
98
|
return new versioning_strategy_1.PatchVersionUpdate().bump(version);
|
|
95
99
|
}
|
|
96
100
|
updateCandidate(existingCandidate, pkg, updatedVersions) {
|
|
97
|
-
var _a, _b;
|
|
98
|
-
const graphPackage = (_a = this.packageGraph) === null || _a === void 0 ? void 0 : _a.get(pkg.name);
|
|
99
|
-
if (!graphPackage) {
|
|
100
|
-
throw new Error(`Could not find graph package for ${pkg.name}`);
|
|
101
|
-
}
|
|
102
|
-
const updatedPackage = pkg.clone();
|
|
103
101
|
// Update version of the package
|
|
104
|
-
const newVersion = updatedVersions.get(
|
|
105
|
-
if (newVersion) {
|
|
106
|
-
|
|
107
|
-
updatedPackage.version = newVersion.toString();
|
|
108
|
-
}
|
|
109
|
-
// Update dependency versions
|
|
110
|
-
for (const [depName, resolved] of graphPackage.localDependencies) {
|
|
111
|
-
const depVersion = updatedVersions.get(depName);
|
|
112
|
-
if (depVersion && resolved.type !== 'directory') {
|
|
113
|
-
const currentVersion = (_b = this.combineDeps(pkg)) === null || _b === void 0 ? void 0 : _b[depName];
|
|
114
|
-
const prefix = currentVersion
|
|
115
|
-
? this.detectRangePrefix(currentVersion)
|
|
116
|
-
: '';
|
|
117
|
-
updatedPackage.updateLocalDependency(resolved, depVersion.toString(), prefix);
|
|
118
|
-
this.logger.info(`${pkg.name}.${depName} updated to ${prefix}${depVersion.toString()}`);
|
|
119
|
-
}
|
|
102
|
+
const newVersion = updatedVersions.get(pkg.name);
|
|
103
|
+
if (!newVersion) {
|
|
104
|
+
throw new Error(`Didn't find updated version for ${pkg.name}`);
|
|
120
105
|
}
|
|
121
|
-
const
|
|
106
|
+
const updatedPackage = {
|
|
107
|
+
...pkg,
|
|
108
|
+
version: newVersion.toString(),
|
|
109
|
+
};
|
|
110
|
+
const updater = new package_json_1.PackageJson({
|
|
111
|
+
version: newVersion,
|
|
112
|
+
versionsMap: updatedVersions,
|
|
113
|
+
});
|
|
114
|
+
const dependencyNotes = getChangelogDepsNotes(pkg, updatedPackage, updatedVersions, this.logger);
|
|
122
115
|
existingCandidate.pullRequest.updates =
|
|
123
116
|
existingCandidate.pullRequest.updates.map(update => {
|
|
124
117
|
if (update.path === (0, workspace_1.addPath)(existingCandidate.path, 'package.json')) {
|
|
125
|
-
update.updater = new
|
|
118
|
+
update.updater = new composite_1.CompositeUpdater(update.updater, updater);
|
|
126
119
|
}
|
|
127
120
|
else if (update.updater instanceof changelog_1.Changelog) {
|
|
128
121
|
if (dependencyNotes) {
|
|
@@ -149,63 +142,50 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
|
|
|
149
142
|
return existingCandidate;
|
|
150
143
|
}
|
|
151
144
|
newCandidate(pkg, updatedVersions) {
|
|
152
|
-
var _a, _b;
|
|
153
|
-
const graphPackage = (_a = this.packageGraph) === null || _a === void 0 ? void 0 : _a.get(pkg.name);
|
|
154
|
-
if (!graphPackage) {
|
|
155
|
-
throw new Error(`Could not find graph package for ${pkg.name}`);
|
|
156
|
-
}
|
|
157
|
-
const updatedPackage = pkg.clone();
|
|
158
145
|
// Update version of the package
|
|
159
|
-
const newVersion = updatedVersions.get(
|
|
160
|
-
if (newVersion) {
|
|
161
|
-
|
|
162
|
-
updatedPackage.version = newVersion.toString();
|
|
146
|
+
const newVersion = updatedVersions.get(pkg.name);
|
|
147
|
+
if (!newVersion) {
|
|
148
|
+
throw new Error(`Didn't find updated version for ${pkg.name}`);
|
|
163
149
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
? this.detectRangePrefix(currentVersion)
|
|
170
|
-
: '';
|
|
171
|
-
updatedPackage.updateLocalDependency(resolved, depVersion.toString(), prefix);
|
|
172
|
-
this.logger.info(`${pkg.name}.${depName} updated to ${prefix}${depVersion.toString()}`);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
const dependencyNotes = getChangelogDepsNotes(pkg, updatedPackage, updatedVersions);
|
|
176
|
-
const packageJson = updatedPackage.toJSON();
|
|
177
|
-
const version = version_1.Version.parse(packageJson.version);
|
|
150
|
+
const updatedPackage = {
|
|
151
|
+
...pkg,
|
|
152
|
+
version: newVersion.toString(),
|
|
153
|
+
};
|
|
154
|
+
const dependencyNotes = getChangelogDepsNotes(pkg, updatedPackage, updatedVersions, this.logger);
|
|
178
155
|
const pullRequest = {
|
|
179
156
|
title: pull_request_title_1.PullRequestTitle.ofTargetBranch(this.targetBranch),
|
|
180
157
|
body: new pull_request_body_1.PullRequestBody([
|
|
181
158
|
{
|
|
182
159
|
component: updatedPackage.name,
|
|
183
|
-
version,
|
|
160
|
+
version: newVersion,
|
|
184
161
|
notes: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes, this.logger),
|
|
185
162
|
},
|
|
186
163
|
]),
|
|
187
164
|
updates: [
|
|
188
165
|
{
|
|
189
|
-
path: (0, workspace_1.addPath)(updatedPackage.
|
|
166
|
+
path: (0, workspace_1.addPath)(updatedPackage.path, 'package.json'),
|
|
190
167
|
createIfMissing: false,
|
|
191
|
-
updater: new
|
|
168
|
+
updater: new package_json_1.PackageJson({
|
|
169
|
+
version: newVersion,
|
|
170
|
+
versionsMap: updatedVersions,
|
|
171
|
+
}),
|
|
192
172
|
},
|
|
193
173
|
{
|
|
194
|
-
path: (0, workspace_1.addPath)(updatedPackage.
|
|
174
|
+
path: (0, workspace_1.addPath)(updatedPackage.path, 'CHANGELOG.md'),
|
|
195
175
|
createIfMissing: false,
|
|
196
176
|
updater: new changelog_1.Changelog({
|
|
197
|
-
version,
|
|
177
|
+
version: newVersion,
|
|
198
178
|
changelogEntry: (0, workspace_1.appendDependenciesSectionToChangelog)('', dependencyNotes, this.logger),
|
|
199
179
|
}),
|
|
200
180
|
},
|
|
201
181
|
],
|
|
202
182
|
labels: [],
|
|
203
183
|
headRefName: branch_name_1.BranchName.ofTargetBranch(this.targetBranch).toString(),
|
|
204
|
-
version,
|
|
184
|
+
version: newVersion,
|
|
205
185
|
draft: false,
|
|
206
186
|
};
|
|
207
187
|
return {
|
|
208
|
-
path: updatedPackage.
|
|
188
|
+
path: updatedPackage.path,
|
|
209
189
|
pullRequest,
|
|
210
190
|
config: {
|
|
211
191
|
releaseType: 'node',
|
|
@@ -236,10 +216,7 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
|
|
|
236
216
|
return pkg.name;
|
|
237
217
|
}
|
|
238
218
|
pathFromPackage(pkg) {
|
|
239
|
-
return pkg.
|
|
240
|
-
}
|
|
241
|
-
detectRangePrefix(version) {
|
|
242
|
-
return (Object.values(SUPPORTED_RANGE_PREFIXES).find(supportedRangePrefix => version.startsWith(supportedRangePrefix)) || '');
|
|
219
|
+
return pkg.path;
|
|
243
220
|
}
|
|
244
221
|
combineDeps(packageJson) {
|
|
245
222
|
var _a, _b, _c;
|
|
@@ -251,17 +228,8 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
|
|
|
251
228
|
}
|
|
252
229
|
}
|
|
253
230
|
exports.NodeWorkspace = NodeWorkspace;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
SUPPORTED_RANGE_PREFIXES["CARET"] = "^";
|
|
257
|
-
SUPPORTED_RANGE_PREFIXES["TILDE"] = "~";
|
|
258
|
-
SUPPORTED_RANGE_PREFIXES["GREATER_THAN"] = ">";
|
|
259
|
-
SUPPORTED_RANGE_PREFIXES["LESS_THAN"] = "<";
|
|
260
|
-
SUPPORTED_RANGE_PREFIXES["EQUAL_OR_GREATER_THAN"] = ">=";
|
|
261
|
-
SUPPORTED_RANGE_PREFIXES["EQUAL_OR_LESS_THAN"] = "<=";
|
|
262
|
-
})(SUPPORTED_RANGE_PREFIXES || (SUPPORTED_RANGE_PREFIXES = {}));
|
|
263
|
-
function getChangelogDepsNotes(original, updated, updateVersions) {
|
|
264
|
-
var _a, _b;
|
|
231
|
+
function getChangelogDepsNotes(original, updated, updateVersions, logger) {
|
|
232
|
+
var _a;
|
|
265
233
|
let depUpdateNotes = '';
|
|
266
234
|
const depTypes = [
|
|
267
235
|
'dependencies',
|
|
@@ -277,15 +245,19 @@ function getChangelogDepsNotes(original, updated, updateVersions) {
|
|
|
277
245
|
continue;
|
|
278
246
|
}
|
|
279
247
|
for (const [depName, currentDepVer] of Object.entries(pkgDepTypes)) {
|
|
248
|
+
const newVersion = updateVersions.get(depName);
|
|
249
|
+
if (!newVersion) {
|
|
250
|
+
logger.debug(`${depName} was not bumped, ignoring`);
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
280
253
|
const origDepVer = (_a = original[depType]) === null || _a === void 0 ? void 0 : _a[depName];
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
254
|
+
const newVersionString = (0, package_json_1.newVersionWithRange)(origDepVer, newVersion);
|
|
255
|
+
if (currentDepVer.startsWith('workspace:')) {
|
|
256
|
+
depUpdates.push(`\n * ${depName} bumped to ${newVersionString}`);
|
|
284
257
|
}
|
|
285
|
-
else if (
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
.get(depName)) === null || _b === void 0 ? void 0 : _b.toString()}`);
|
|
258
|
+
else if (newVersionString !== origDepVer) {
|
|
259
|
+
depUpdates.push(`\n * ${depName} bumped from ${origDepVer} to ${newVersionString}`);
|
|
260
|
+
//handle case when "workspace:" version is used
|
|
289
261
|
}
|
|
290
262
|
}
|
|
291
263
|
if (depUpdates.length > 0) {
|
|
@@ -73,7 +73,7 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin {
|
|
|
73
73
|
const existingCandidate = this.findCandidateForPackage(pkg, candidatesByPackage);
|
|
74
74
|
if (existingCandidate) {
|
|
75
75
|
// if already has an pull request, update the changelog and update
|
|
76
|
-
this.logger.info(`Updating
|
|
76
|
+
this.logger.info(`Updating existing candidate pull request for ${this.packageNameFromPackage(pkg)}, path: ${existingCandidate.path}`);
|
|
77
77
|
if (newCandidatePaths.has(existingCandidate.path)) {
|
|
78
78
|
this.logger.info(`Already updated candidate for path: ${existingCandidate.path}`);
|
|
79
79
|
}
|
|
@@ -43,6 +43,7 @@ export interface BaseStrategyOptions {
|
|
|
43
43
|
includeVInTag?: boolean;
|
|
44
44
|
pullRequestTitlePattern?: string;
|
|
45
45
|
pullRequestHeader?: string;
|
|
46
|
+
pullRequestFooter?: string;
|
|
46
47
|
extraFiles?: ExtraFile[];
|
|
47
48
|
versionFile?: string;
|
|
48
49
|
snapshotLabels?: string[];
|
|
@@ -74,6 +75,7 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
74
75
|
protected initialVersion?: string;
|
|
75
76
|
readonly pullRequestTitlePattern?: string;
|
|
76
77
|
readonly pullRequestHeader?: string;
|
|
78
|
+
readonly pullRequestFooter?: string;
|
|
77
79
|
readonly extraFiles: ExtraFile[];
|
|
78
80
|
readonly extraLabels: string[];
|
|
79
81
|
readonly changelogNotes: ChangelogNotes;
|
|
@@ -101,7 +103,7 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
101
103
|
*/
|
|
102
104
|
protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
|
|
103
105
|
protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release, commits?: Commit[]): Promise<string>;
|
|
104
|
-
protected buildPullRequestBody(component: string | undefined, newVersion: Version, releaseNotesBody: string, _conventionalCommits: ConventionalCommit[], _latestRelease?: Release, pullRequestHeader?: string): Promise<PullRequestBody>;
|
|
106
|
+
protected buildPullRequestBody(component: string | undefined, newVersion: Version, releaseNotesBody: string, _conventionalCommits: ConventionalCommit[], _latestRelease?: Release, pullRequestHeader?: string, pullRequestFooter?: string): Promise<PullRequestBody>;
|
|
105
107
|
/**
|
|
106
108
|
* Builds a candidate release pull request
|
|
107
109
|
* @param {Commit[]} commits Raw commits to consider for this release.
|
|
@@ -61,6 +61,7 @@ class BaseStrategy {
|
|
|
61
61
|
this.includeVInTag = (_c = options.includeVInTag) !== null && _c !== void 0 ? _c : true;
|
|
62
62
|
this.pullRequestTitlePattern = options.pullRequestTitlePattern;
|
|
63
63
|
this.pullRequestHeader = options.pullRequestHeader;
|
|
64
|
+
this.pullRequestFooter = options.pullRequestFooter;
|
|
64
65
|
this.extraFiles = options.extraFiles || [];
|
|
65
66
|
this.initialVersion = options.initialVersion;
|
|
66
67
|
this.extraLabels = options.extraLabels || [];
|
|
@@ -118,14 +119,17 @@ class BaseStrategy {
|
|
|
118
119
|
commits: commits,
|
|
119
120
|
});
|
|
120
121
|
}
|
|
121
|
-
async buildPullRequestBody(component, newVersion, releaseNotesBody, _conventionalCommits, _latestRelease, pullRequestHeader) {
|
|
122
|
+
async buildPullRequestBody(component, newVersion, releaseNotesBody, _conventionalCommits, _latestRelease, pullRequestHeader, pullRequestFooter) {
|
|
122
123
|
return new pull_request_body_1.PullRequestBody([
|
|
123
124
|
{
|
|
124
125
|
component,
|
|
125
126
|
version: newVersion,
|
|
126
127
|
notes: releaseNotesBody,
|
|
127
128
|
},
|
|
128
|
-
], {
|
|
129
|
+
], {
|
|
130
|
+
header: pullRequestHeader,
|
|
131
|
+
footer: pullRequestFooter,
|
|
132
|
+
});
|
|
129
133
|
}
|
|
130
134
|
/**
|
|
131
135
|
* Builds a candidate release pull request
|
|
@@ -169,7 +173,7 @@ class BaseStrategy {
|
|
|
169
173
|
commits: conventionalCommits,
|
|
170
174
|
});
|
|
171
175
|
const updatesWithExtras = (0, composite_1.mergeUpdates)(updates.concat(...(await this.extraFileUpdates(newVersion, versionsMap))));
|
|
172
|
-
const pullRequestBody = await this.buildPullRequestBody(component, newVersion, releaseNotesBody, conventionalCommits, latestRelease, this.pullRequestHeader);
|
|
176
|
+
const pullRequestBody = await this.buildPullRequestBody(component, newVersion, releaseNotesBody, conventionalCommits, latestRelease, this.pullRequestHeader, this.pullRequestFooter);
|
|
173
177
|
return {
|
|
174
178
|
title: pullRequestTitle,
|
|
175
179
|
body: pullRequestBody,
|
|
@@ -34,17 +34,20 @@ const CHANGELOG_SECTIONS = [
|
|
|
34
34
|
const DEFAULT_CHANGELOG_PATH = 'docs/history.md';
|
|
35
35
|
const DEFAULT_PULL_REQUEST_TITLE_PATTERN = 'Release${component} version ${version}';
|
|
36
36
|
const DEFAULT_PULL_REQUEST_HEADER = ':robot: I have created a release *beep* *boop*';
|
|
37
|
+
const DEFAULT_PULL_REQUEST_FOOTER = 'This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).';
|
|
37
38
|
const RELEASE_NOTES_HEADER_PATTERN = /#{2,3} \[?(\d+\.\d+\.\d+-?[^\]]*)\]?.* \((\d{4}-\d{2}-\d{2})\)/;
|
|
38
39
|
class DotnetYoshi extends base_1.BaseStrategy {
|
|
39
40
|
constructor(options) {
|
|
40
|
-
var _a, _b, _c, _d, _e;
|
|
41
|
+
var _a, _b, _c, _d, _e, _f;
|
|
41
42
|
options.changelogSections = (_a = options.changelogSections) !== null && _a !== void 0 ? _a : CHANGELOG_SECTIONS;
|
|
42
43
|
options.changelogPath = (_b = options.changelogPath) !== null && _b !== void 0 ? _b : DEFAULT_CHANGELOG_PATH;
|
|
43
44
|
options.pullRequestTitlePattern =
|
|
44
45
|
(_c = options.pullRequestTitlePattern) !== null && _c !== void 0 ? _c : DEFAULT_PULL_REQUEST_TITLE_PATTERN;
|
|
45
46
|
options.pullRequestHeader =
|
|
46
47
|
(_d = options.pullRequestHeader) !== null && _d !== void 0 ? _d : DEFAULT_PULL_REQUEST_HEADER;
|
|
47
|
-
options.
|
|
48
|
+
options.pullRequestFooter =
|
|
49
|
+
(_e = options.pullRequestFooter) !== null && _e !== void 0 ? _e : DEFAULT_PULL_REQUEST_FOOTER;
|
|
50
|
+
options.includeVInTag = (_f = options.includeVInTag) !== null && _f !== void 0 ? _f : false;
|
|
48
51
|
super(options);
|
|
49
52
|
}
|
|
50
53
|
async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Logger } from '../../util/logger';
|
|
2
2
|
import { DefaultUpdater } from '../default';
|
|
3
|
+
import { Version } from '../../version';
|
|
3
4
|
/**
|
|
4
5
|
* This updates a Node.js package.json file's main version.
|
|
5
6
|
*/
|
|
@@ -11,3 +12,10 @@ export declare class PackageJson extends DefaultUpdater {
|
|
|
11
12
|
*/
|
|
12
13
|
updateContent(content: string, logger?: Logger): string;
|
|
13
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Helper to coerce a new version value into a version range that preserves the
|
|
17
|
+
* version range prefix of the original version.
|
|
18
|
+
* @param {string} oldVersion Old semver with range
|
|
19
|
+
* @param {Version} newVersion The new version to update with
|
|
20
|
+
*/
|
|
21
|
+
export declare function newVersionWithRange(oldVersion: string, newVersion: Version): string;
|