release-please 13.16.0 → 13.16.3
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 +21 -0
- package/build/src/factories/plugin-factory.d.ts +1 -0
- package/build/src/manifest.js +43 -2
- package/build/src/plugins/cargo-workspace.d.ts +1 -0
- package/build/src/plugins/cargo-workspace.js +3 -0
- package/build/src/plugins/node-workspace.d.ts +1 -0
- package/build/src/plugins/node-workspace.js +3 -0
- package/build/src/plugins/workspace.d.ts +8 -0
- package/build/src/plugins/workspace.js +21 -2
- package/build/src/strategies/base.js +3 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,27 @@
|
|
|
4
4
|
|
|
5
5
|
[1]: https://www.npmjs.com/package/release-please?activeTab=versions
|
|
6
6
|
|
|
7
|
+
### [13.16.3](https://github.com/googleapis/release-please/compare/v13.16.2...v13.16.3) (2022-05-13)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* workspace plugins should update manifest versions ([#1429](https://github.com/googleapis/release-please/issues/1429)) ([ab802a9](https://github.com/googleapis/release-please/commit/ab802a924704044b26017b40a2da48657022faad))
|
|
13
|
+
|
|
14
|
+
### [13.16.2](https://github.com/googleapis/release-please/compare/v13.16.1...v13.16.2) (2022-05-12)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* throw ConfigurationError when required manifest config file is missing ([#1422](https://github.com/googleapis/release-please/issues/1422)) ([83e461e](https://github.com/googleapis/release-please/commit/83e461e8947d16fbd92d57a0d9c64d37ab0dfa42))
|
|
20
|
+
|
|
21
|
+
### [13.16.1](https://github.com/googleapis/release-please/compare/v13.16.0...v13.16.1) (2022-05-10)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* release tagging can find branch components ([#1425](https://github.com/googleapis/release-please/issues/1425)) ([2947d1e](https://github.com/googleapis/release-please/commit/2947d1e9bc49cc25e7c5eef022ba4106d72e829f))
|
|
27
|
+
|
|
7
28
|
## [13.16.0](https://github.com/googleapis/release-please/compare/v13.15.1...v13.16.0) (2022-05-06)
|
|
8
29
|
|
|
9
30
|
|
package/build/src/manifest.js
CHANGED
|
@@ -314,6 +314,7 @@ class Manifest {
|
|
|
314
314
|
github: this.github,
|
|
315
315
|
targetBranch: this.targetBranch,
|
|
316
316
|
repositoryConfig: this.repositoryConfig,
|
|
317
|
+
manifestPath: this.manifestPath,
|
|
317
318
|
}));
|
|
318
319
|
let strategies = strategiesByPath;
|
|
319
320
|
for (const plugin of plugins) {
|
|
@@ -729,7 +730,7 @@ function extractReleaserConfig(config) {
|
|
|
729
730
|
* @param {string} releaseAs Optional. Override release-as and use the given version
|
|
730
731
|
*/
|
|
731
732
|
async function parseConfig(github, configFile, branch, onlyPath, releaseAs) {
|
|
732
|
-
const config = await github
|
|
733
|
+
const config = await fetchManifestConfig(github, configFile, branch);
|
|
733
734
|
const defaultConfig = extractReleaserConfig(config);
|
|
734
735
|
const repositoryConfig = {};
|
|
735
736
|
for (const path in config.packages) {
|
|
@@ -759,21 +760,61 @@ async function parseConfig(github, configFile, branch, onlyPath, releaseAs) {
|
|
|
759
760
|
};
|
|
760
761
|
return { config: repositoryConfig, options: manifestOptions };
|
|
761
762
|
}
|
|
763
|
+
/**
|
|
764
|
+
* Helper to fetch manifest config
|
|
765
|
+
*
|
|
766
|
+
* @param {GitHub} github
|
|
767
|
+
* @param {string} configFile
|
|
768
|
+
* @param {string} branch
|
|
769
|
+
* @returns {ManifestConfig}
|
|
770
|
+
* @throws {ConfigurationError} if missing the manifest config file
|
|
771
|
+
*/
|
|
772
|
+
async function fetchManifestConfig(github, configFile, branch) {
|
|
773
|
+
try {
|
|
774
|
+
return await github.getFileJson(configFile, branch);
|
|
775
|
+
}
|
|
776
|
+
catch (e) {
|
|
777
|
+
if (e instanceof errors_1.FileNotFoundError) {
|
|
778
|
+
throw new errors_1.ConfigurationError(`Missing required manifest config: ${configFile}`, 'base', `${github.repository.owner}/${github.repository.repo}`);
|
|
779
|
+
}
|
|
780
|
+
throw e;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
762
783
|
/**
|
|
763
784
|
* Helper to parse the manifest versions file.
|
|
764
785
|
*
|
|
765
786
|
* @param {GitHub} github GitHub client
|
|
766
787
|
* @param {string} manifestFile Path in the repository to the versions file
|
|
767
788
|
* @param {string} branch Branch to fetch the versions file from
|
|
789
|
+
* @returns {Record<string, string>}
|
|
768
790
|
*/
|
|
769
791
|
async function parseReleasedVersions(github, manifestFile, branch) {
|
|
770
|
-
const manifestJson = await github
|
|
792
|
+
const manifestJson = await fetchReleasedVersions(github, manifestFile, branch);
|
|
771
793
|
const releasedVersions = {};
|
|
772
794
|
for (const path in manifestJson) {
|
|
773
795
|
releasedVersions[path] = version_1.Version.parse(manifestJson[path]);
|
|
774
796
|
}
|
|
775
797
|
return releasedVersions;
|
|
776
798
|
}
|
|
799
|
+
/**
|
|
800
|
+
* Helper to fetch manifest config
|
|
801
|
+
*
|
|
802
|
+
* @param {GitHub} github
|
|
803
|
+
* @param {string} manifestFile
|
|
804
|
+
* @param {string} branch
|
|
805
|
+
* @throws {ConfigurationError} if missing the manifest config file
|
|
806
|
+
*/
|
|
807
|
+
async function fetchReleasedVersions(github, manifestFile, branch) {
|
|
808
|
+
try {
|
|
809
|
+
return await github.getFileJson(manifestFile, branch);
|
|
810
|
+
}
|
|
811
|
+
catch (e) {
|
|
812
|
+
if (e instanceof errors_1.FileNotFoundError) {
|
|
813
|
+
throw new errors_1.ConfigurationError(`Missing required manifest versions: ${manifestFile}`, 'base', `${github.repository.owner}/${github.repository.repo}`);
|
|
814
|
+
}
|
|
815
|
+
throw e;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
777
818
|
function isPublishedVersion(strategy, version) {
|
|
778
819
|
return strategy.isPublishedVersion
|
|
779
820
|
? strategy.isPublishedVersion(version)
|
|
@@ -47,5 +47,6 @@ export declare class CargoWorkspace extends WorkspacePlugin<CrateInfo> {
|
|
|
47
47
|
protected buildGraph(allPackages: CrateInfo[]): Promise<DependencyGraph<CrateInfo>>;
|
|
48
48
|
protected inScope(candidate: CandidateReleasePullRequest): boolean;
|
|
49
49
|
protected packageNameFromPackage(pkg: CrateInfo): string;
|
|
50
|
+
protected pathFromPackage(pkg: CrateInfo): string;
|
|
50
51
|
}
|
|
51
52
|
export {};
|
|
@@ -213,6 +213,9 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin {
|
|
|
213
213
|
packageNameFromPackage(pkg) {
|
|
214
214
|
return pkg.name;
|
|
215
215
|
}
|
|
216
|
+
pathFromPackage(pkg) {
|
|
217
|
+
return pkg.path;
|
|
218
|
+
}
|
|
216
219
|
}
|
|
217
220
|
exports.CargoWorkspace = CargoWorkspace;
|
|
218
221
|
function getChangelogDepsNotes(originalManifest, updatedManifest) {
|
|
@@ -33,5 +33,6 @@ export declare class NodeWorkspace extends WorkspacePlugin<Package> {
|
|
|
33
33
|
protected buildGraph(allPackages: Package[]): Promise<DependencyGraph<Package>>;
|
|
34
34
|
protected inScope(candidate: CandidateReleasePullRequest): boolean;
|
|
35
35
|
protected packageNameFromPackage(pkg: Package): string;
|
|
36
|
+
protected pathFromPackage(pkg: Package): string;
|
|
36
37
|
}
|
|
37
38
|
export {};
|
|
@@ -235,6 +235,9 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
|
|
|
235
235
|
packageNameFromPackage(pkg) {
|
|
236
236
|
return pkg.name;
|
|
237
237
|
}
|
|
238
|
+
pathFromPackage(pkg) {
|
|
239
|
+
return pkg.location;
|
|
240
|
+
}
|
|
238
241
|
}
|
|
239
242
|
exports.NodeWorkspace = NodeWorkspace;
|
|
240
243
|
function getChangelogDepsNotes(original, updated) {
|
|
@@ -8,6 +8,7 @@ export interface DependencyNode<T> {
|
|
|
8
8
|
value: T;
|
|
9
9
|
}
|
|
10
10
|
export interface WorkspacePluginOptions {
|
|
11
|
+
manifestPath?: string;
|
|
11
12
|
updateAllPackages?: boolean;
|
|
12
13
|
}
|
|
13
14
|
interface AllPackages<T> {
|
|
@@ -27,6 +28,7 @@ interface AllPackages<T> {
|
|
|
27
28
|
*/
|
|
28
29
|
export declare abstract class WorkspacePlugin<T> extends ManifestPlugin {
|
|
29
30
|
private updateAllPackages;
|
|
31
|
+
private manifestPath;
|
|
30
32
|
constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, options?: WorkspacePluginOptions);
|
|
31
33
|
run(candidates: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
|
|
32
34
|
/**
|
|
@@ -83,6 +85,12 @@ export declare abstract class WorkspacePlugin<T> extends ManifestPlugin {
|
|
|
83
85
|
* @returns {string} The package name.
|
|
84
86
|
*/
|
|
85
87
|
protected abstract packageNameFromPackage(pkg: T): string;
|
|
88
|
+
/**
|
|
89
|
+
* Given a package, return the path in the repo to the package.
|
|
90
|
+
* @param {T} pkg The package definition.
|
|
91
|
+
* @returns {string} The package path.
|
|
92
|
+
*/
|
|
93
|
+
protected abstract pathFromPackage(pkg: T): string;
|
|
86
94
|
/**
|
|
87
95
|
* Amend any or all in-scope candidates once all other processing has occured.
|
|
88
96
|
*
|
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.WorkspacePlugin = void 0;
|
|
17
17
|
const plugin_1 = require("../plugin");
|
|
18
|
+
const manifest_1 = require("../manifest");
|
|
18
19
|
const logger_1 = require("../util/logger");
|
|
19
20
|
const merge_1 = require("./merge");
|
|
21
|
+
const release_please_manifest_1 = require("../updaters/release-please-manifest");
|
|
20
22
|
/**
|
|
21
23
|
* The plugin generalizes the logic for handling a workspace and
|
|
22
24
|
* will bump dependencies of managed packages if those dependencies
|
|
@@ -30,9 +32,10 @@ const merge_1 = require("./merge");
|
|
|
30
32
|
*/
|
|
31
33
|
class WorkspacePlugin extends plugin_1.ManifestPlugin {
|
|
32
34
|
constructor(github, targetBranch, repositoryConfig, options = {}) {
|
|
33
|
-
var _a;
|
|
35
|
+
var _a, _b;
|
|
34
36
|
super(github, targetBranch, repositoryConfig);
|
|
35
|
-
this.
|
|
37
|
+
this.manifestPath = (_a = options.manifestPath) !== null && _a !== void 0 ? _a : manifest_1.DEFAULT_RELEASE_PLEASE_MANIFEST;
|
|
38
|
+
this.updateAllPackages = (_b = options.updateAllPackages) !== null && _b !== void 0 ? _b : false;
|
|
36
39
|
}
|
|
37
40
|
async run(candidates) {
|
|
38
41
|
logger_1.logger.info('Running workspace plugin');
|
|
@@ -63,6 +66,7 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin {
|
|
|
63
66
|
const orderedPackages = this.buildGraphOrder(graph, packageNamesToUpdate);
|
|
64
67
|
logger_1.logger.info(`Updating ${orderedPackages.length} packages`);
|
|
65
68
|
const updatedVersions = new Map();
|
|
69
|
+
const updatedPathVersions = new Map();
|
|
66
70
|
for (const pkg of orderedPackages) {
|
|
67
71
|
const packageName = this.packageNameFromPackage(pkg);
|
|
68
72
|
logger_1.logger.debug(`package: ${packageName}`);
|
|
@@ -76,6 +80,7 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin {
|
|
|
76
80
|
const version = this.bumpVersion(pkg);
|
|
77
81
|
logger_1.logger.debug(`version: ${version} forced bump`);
|
|
78
82
|
updatedVersions.set(packageName, version);
|
|
83
|
+
updatedPathVersions.set(this.pathFromPackage(pkg), version);
|
|
79
84
|
}
|
|
80
85
|
}
|
|
81
86
|
let newCandidates = [];
|
|
@@ -98,6 +103,20 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin {
|
|
|
98
103
|
logger_1.logger.info(`Merging ${newCandidates.length} in-scope candidates`);
|
|
99
104
|
const mergePlugin = new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig);
|
|
100
105
|
newCandidates = await mergePlugin.run(newCandidates);
|
|
106
|
+
if (newCandidates.length === 1) {
|
|
107
|
+
const newUpdates = newCandidates[0].pullRequest.updates;
|
|
108
|
+
newUpdates.push({
|
|
109
|
+
path: this.manifestPath,
|
|
110
|
+
createIfMissing: false,
|
|
111
|
+
updater: new release_please_manifest_1.ReleasePleaseManifest({
|
|
112
|
+
version: newCandidates[0].pullRequest.version,
|
|
113
|
+
versionsMap: updatedPathVersions,
|
|
114
|
+
}),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
logger_1.logger.warn(`Expected 1 merged candidate, got ${newCandidates.length}`);
|
|
119
|
+
}
|
|
101
120
|
logger_1.logger.info(`Post-processing ${newCandidates.length} in-scope candidates`);
|
|
102
121
|
newCandidates = this.postProcessCandidates(newCandidates, updatedVersions);
|
|
103
122
|
return [...outOfScopeCandidates, ...newCandidates];
|
|
@@ -272,10 +272,11 @@ class BaseStrategy {
|
|
|
272
272
|
let releaseData;
|
|
273
273
|
if (pullRequestBody.releaseData.length === 1 &&
|
|
274
274
|
!pullRequestBody.releaseData[0].component) {
|
|
275
|
+
const branchComponent = await this.getBranchComponent();
|
|
275
276
|
// standalone release PR, ensure the components match
|
|
276
277
|
if (this.normalizeComponent(branchName.component) !==
|
|
277
|
-
this.normalizeComponent(
|
|
278
|
-
logger_1.logger.warn(`PR component: ${branchName.component} does not match configured component: ${
|
|
278
|
+
this.normalizeComponent(branchComponent)) {
|
|
279
|
+
logger_1.logger.warn(`PR component: ${branchName.component} does not match configured component: ${branchComponent}`);
|
|
279
280
|
return;
|
|
280
281
|
}
|
|
281
282
|
releaseData = pullRequestBody.releaseData[0];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-please",
|
|
3
|
-
"version": "13.16.
|
|
3
|
+
"version": "13.16.3",
|
|
4
4
|
"description": "generate release PRs based on the conventionalcommits.org spec",
|
|
5
5
|
"main": "./build/src/index.js",
|
|
6
6
|
"bin": "./build/src/bin/release-please.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"gts": "^3.0.0",
|
|
61
61
|
"mocha": "^9.0.0",
|
|
62
62
|
"nock": "^13.0.0",
|
|
63
|
-
"sinon": "
|
|
63
|
+
"sinon": "14.0.0",
|
|
64
64
|
"snap-shot-it": "^7.0.0"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|