release-please 14.1.2 → 14.2.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 +7 -0
- package/build/src/commit.d.ts +2 -1
- package/build/src/commit.js +2 -2
- package/build/src/github.d.ts +3 -0
- package/build/src/github.js +29 -27
- package/build/src/manifest.d.ts +3 -0
- package/build/src/manifest.js +66 -65
- package/build/src/plugin.d.ts +3 -1
- package/build/src/plugin.js +3 -1
- package/build/src/plugins/cargo-workspace.js +9 -10
- package/build/src/plugins/linked-versions.d.ts +2 -0
- package/build/src/plugins/linked-versions.js +5 -6
- package/build/src/plugins/maven-workspace.js +14 -14
- package/build/src/plugins/merge.js +1 -2
- package/build/src/plugins/node-workspace.js +11 -12
- package/build/src/plugins/workspace.d.ts +3 -1
- package/build/src/plugins/workspace.js +20 -20
- package/build/src/strategies/base.d.ts +3 -0
- package/build/src/strategies/base.js +26 -24
- package/build/src/strategies/dotnet-yoshi.js +2 -3
- package/build/src/strategies/go-yoshi.js +7 -8
- package/build/src/strategies/java-yoshi.js +1 -2
- package/build/src/strategies/java.js +9 -8
- package/build/src/strategies/php-yoshi.js +4 -5
- package/build/src/strategies/python.js +2 -3
- package/build/src/strategies/rust.js +8 -9
- package/build/src/update.d.ts +2 -1
- package/build/src/updaters/dart/pubspec-yaml.d.ts +2 -1
- package/build/src/updaters/dart/pubspec-yaml.js +4 -4
- package/build/src/updaters/dotnet/apis.d.ts +2 -1
- package/build/src/updaters/dotnet/apis.js +2 -2
- package/build/src/updaters/elixir/elixir-mix-exs.d.ts +2 -1
- package/build/src/updaters/elixir/elixir-mix-exs.js +2 -2
- package/build/src/updaters/generic-json.d.ts +2 -1
- package/build/src/updaters/generic-json.js +2 -2
- package/build/src/updaters/generic-yaml.d.ts +2 -1
- package/build/src/updaters/generic-yaml.js +3 -3
- package/build/src/updaters/generic.d.ts +2 -1
- package/build/src/updaters/generic.js +2 -2
- package/build/src/updaters/helm/chart-yaml.d.ts +2 -1
- package/build/src/updaters/helm/chart-yaml.js +2 -2
- package/build/src/updaters/java/java-update.d.ts +2 -1
- package/build/src/updaters/java/java-update.js +2 -2
- package/build/src/updaters/java/versions-manifest.d.ts +2 -1
- package/build/src/updaters/java/versions-manifest.js +2 -2
- package/build/src/updaters/krm/krm-blueprint-version.d.ts +2 -1
- package/build/src/updaters/krm/krm-blueprint-version.js +2 -2
- package/build/src/updaters/node/package-json.d.ts +2 -1
- package/build/src/updaters/node/package-json.js +2 -2
- package/build/src/updaters/node/package-lock-json.d.ts +2 -1
- package/build/src/updaters/node/package-lock-json.js +2 -2
- package/build/src/updaters/node/samples-package-json.d.ts +2 -1
- package/build/src/updaters/node/samples-package-json.js +2 -2
- package/build/src/updaters/ocaml/dune-project.d.ts +2 -1
- package/build/src/updaters/ocaml/dune-project.js +2 -2
- package/build/src/updaters/ocaml/esy-json.d.ts +2 -1
- package/build/src/updaters/ocaml/esy-json.js +2 -2
- package/build/src/updaters/ocaml/opam.d.ts +2 -1
- package/build/src/updaters/ocaml/opam.js +2 -2
- package/build/src/updaters/php/php-manifest.d.ts +2 -1
- package/build/src/updaters/php/php-manifest.js +3 -3
- package/build/src/updaters/php/root-composer-update-packages.d.ts +2 -1
- package/build/src/updaters/php/root-composer-update-packages.js +3 -3
- package/build/src/updaters/python/pyproject-toml.d.ts +2 -1
- package/build/src/updaters/python/pyproject-toml.js +2 -2
- package/build/src/updaters/rust/cargo-lock.d.ts +2 -1
- package/build/src/updaters/rust/cargo-lock.js +3 -3
- package/build/src/updaters/rust/cargo-toml.d.ts +2 -1
- package/build/src/updaters/rust/cargo-toml.js +7 -7
- package/build/src/updaters/terraform/module-version.d.ts +2 -1
- package/build/src/updaters/terraform/module-version.js +2 -2
- package/build/src/util/branch-name.d.ts +2 -1
- package/build/src/util/branch-name.js +2 -2
- package/build/src/util/pull-request-body.d.ts +2 -1
- package/build/src/util/pull-request-body.js +9 -9
- package/build/src/util/pull-request-title.d.ts +3 -2
- package/build/src/util/pull-request-title.js +8 -7
- package/build/src/versioning-strategies/default.d.ts +3 -0
- package/build/src/versioning-strategies/default.js +3 -1
- package/package.json +1 -1
|
@@ -18,7 +18,6 @@ const base_1 = require("./base");
|
|
|
18
18
|
const changelog_1 = require("../updaters/changelog");
|
|
19
19
|
const version_1 = require("../version");
|
|
20
20
|
const version_go_1 = require("../updaters/go/version-go");
|
|
21
|
-
const logger_1 = require("../util/logger");
|
|
22
21
|
const path_1 = require("path");
|
|
23
22
|
const CHANGELOG_SECTIONS = [
|
|
24
23
|
{ type: 'feat', section: 'Features' },
|
|
@@ -67,7 +66,7 @@ class GoYoshi extends base_1.BaseStrategy {
|
|
|
67
66
|
async postProcessCommits(commits) {
|
|
68
67
|
let regenCommit;
|
|
69
68
|
const component = await this.getComponent();
|
|
70
|
-
|
|
69
|
+
this.logger.debug('Filtering commits');
|
|
71
70
|
const ignoredSubmodules = await this.getIgnoredSubModules();
|
|
72
71
|
return commits.filter(commit => {
|
|
73
72
|
var _a, _b;
|
|
@@ -108,7 +107,7 @@ class GoYoshi extends base_1.BaseStrategy {
|
|
|
108
107
|
// Skip commits that don't have a scope as we don't know where to
|
|
109
108
|
// put them
|
|
110
109
|
if (!commit.scope) {
|
|
111
|
-
|
|
110
|
+
this.logger.debug(`Skipping commit without scope: ${commit.message}`);
|
|
112
111
|
return false;
|
|
113
112
|
}
|
|
114
113
|
// Skip commits related to sub-modules as they are not part of
|
|
@@ -117,7 +116,7 @@ class GoYoshi extends base_1.BaseStrategy {
|
|
|
117
116
|
// This is a submodule release, so only include commits in this
|
|
118
117
|
// scope
|
|
119
118
|
if (!commitMatchesScope(commit.scope, component)) {
|
|
120
|
-
|
|
119
|
+
this.logger.debug(`Skipping commit scope: ${commit.scope} != ${component}`);
|
|
121
120
|
return false;
|
|
122
121
|
}
|
|
123
122
|
}
|
|
@@ -126,7 +125,7 @@ class GoYoshi extends base_1.BaseStrategy {
|
|
|
126
125
|
// are released independently
|
|
127
126
|
for (const submodule of ignoredSubmodules) {
|
|
128
127
|
if (commitMatchesScope(commit.scope, submodule)) {
|
|
129
|
-
|
|
128
|
+
this.logger.debug(`Skipping ignored commit scope: ${commit.scope}`);
|
|
130
129
|
return false;
|
|
131
130
|
}
|
|
132
131
|
}
|
|
@@ -143,12 +142,12 @@ class GoYoshi extends base_1.BaseStrategy {
|
|
|
143
142
|
this.includeComponentInTag) {
|
|
144
143
|
return new Set();
|
|
145
144
|
}
|
|
146
|
-
|
|
145
|
+
this.logger.info('Looking for go.mod files');
|
|
147
146
|
const paths = (await this.github.findFilesByFilenameAndRef('go.mod', this.targetBranch))
|
|
148
147
|
.filter(path => !path.includes('internal') && path !== 'go.mod')
|
|
149
148
|
.map(path => (0, path_1.dirname)(path));
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
this.logger.info(`Found ${paths.length} submodules`);
|
|
150
|
+
this.logger.debug(JSON.stringify(paths));
|
|
152
151
|
return new Set(paths);
|
|
153
152
|
}
|
|
154
153
|
// "closes" is a little presumptuous, let's just indicate that the
|
|
@@ -18,7 +18,6 @@ const versions_manifest_1 = require("../updaters/java/versions-manifest");
|
|
|
18
18
|
const version_1 = require("../version");
|
|
19
19
|
const changelog_1 = require("../updaters/changelog");
|
|
20
20
|
const errors_1 = require("../errors");
|
|
21
|
-
const logger_1 = require("../util/logger");
|
|
22
21
|
const java_1 = require("./java");
|
|
23
22
|
const java_update_1 = require("../updaters/java/java-update");
|
|
24
23
|
class JavaYoshi extends java_1.Java {
|
|
@@ -162,7 +161,7 @@ class JavaYoshi extends java_1.Java {
|
|
|
162
161
|
for (const versionKey of versionsMap.keys()) {
|
|
163
162
|
const version = versionsMap.get(versionKey);
|
|
164
163
|
if (!version) {
|
|
165
|
-
|
|
164
|
+
this.logger.warn(`didn't find version for ${versionKey}`);
|
|
166
165
|
continue;
|
|
167
166
|
}
|
|
168
167
|
if (isPromotion && isStableArtifact(versionKey)) {
|
|
@@ -17,7 +17,6 @@ exports.Java = void 0;
|
|
|
17
17
|
const base_1 = require("./base");
|
|
18
18
|
const changelog_1 = require("../updaters/changelog");
|
|
19
19
|
const java_snapshot_1 = require("../versioning-strategies/java-snapshot");
|
|
20
|
-
const logger_1 = require("../util/logger");
|
|
21
20
|
const pull_request_title_1 = require("../util/pull-request-title");
|
|
22
21
|
const branch_name_1 = require("../util/branch-name");
|
|
23
22
|
const pull_request_body_1 = require("../util/pull-request-body");
|
|
@@ -26,6 +25,7 @@ const java_add_snapshot_1 = require("../versioning-strategies/java-add-snapshot"
|
|
|
26
25
|
const manifest_1 = require("../manifest");
|
|
27
26
|
const java_released_1 = require("../updaters/java/java-released");
|
|
28
27
|
const composite_1 = require("../updaters/composite");
|
|
28
|
+
const logger_1 = require("../util/logger");
|
|
29
29
|
const CHANGELOG_SECTIONS = [
|
|
30
30
|
{ type: 'feat', section: 'Features' },
|
|
31
31
|
{ type: 'fix', section: 'Bug Fixes' },
|
|
@@ -47,22 +47,23 @@ const CHANGELOG_SECTIONS = [
|
|
|
47
47
|
*/
|
|
48
48
|
class Java extends base_1.BaseStrategy {
|
|
49
49
|
constructor(options) {
|
|
50
|
-
var _a, _b;
|
|
50
|
+
var _a, _b, _c;
|
|
51
51
|
options.changelogSections = (_a = options.changelogSections) !== null && _a !== void 0 ? _a : CHANGELOG_SECTIONS;
|
|
52
52
|
// wrap the configured versioning strategy with snapshotting
|
|
53
|
-
const parentVersioningStrategy = options.versioningStrategy ||
|
|
53
|
+
const parentVersioningStrategy = options.versioningStrategy ||
|
|
54
|
+
new default_1.DefaultVersioningStrategy({ logger: (_b = options.logger) !== null && _b !== void 0 ? _b : logger_1.logger });
|
|
54
55
|
options.versioningStrategy = new java_snapshot_1.JavaSnapshot(parentVersioningStrategy);
|
|
55
56
|
super(options);
|
|
56
57
|
this.snapshotVersioning = new java_add_snapshot_1.JavaAddSnapshot(parentVersioningStrategy);
|
|
57
58
|
this.snapshotLabels = options.snapshotLabels || manifest_1.DEFAULT_SNAPSHOT_LABELS;
|
|
58
|
-
this.skipSnapshot = (
|
|
59
|
+
this.skipSnapshot = (_c = options.skipSnapshot) !== null && _c !== void 0 ? _c : false;
|
|
59
60
|
}
|
|
60
61
|
async buildReleasePullRequest(commits, latestRelease, draft, labels = []) {
|
|
61
62
|
if (await this.needsSnapshot(commits, latestRelease)) {
|
|
62
|
-
|
|
63
|
+
this.logger.info('Repository needs a snapshot bump.');
|
|
63
64
|
return await this.buildSnapshotPullRequest(latestRelease, draft, this.snapshotLabels);
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
+
this.logger.info('No Java snapshot needed');
|
|
66
67
|
return await super.buildReleasePullRequest(commits, latestRelease, draft, labels);
|
|
67
68
|
}
|
|
68
69
|
async buildSnapshotPullRequest(latestRelease, draft, labels = []) {
|
|
@@ -113,7 +114,7 @@ class Java extends base_1.BaseStrategy {
|
|
|
113
114
|
return false;
|
|
114
115
|
}
|
|
115
116
|
const component = await this.getComponent();
|
|
116
|
-
|
|
117
|
+
this.logger.debug('component:', component);
|
|
117
118
|
const version = (_a = latestRelease === null || latestRelease === void 0 ? void 0 : latestRelease.tag) === null || _a === void 0 ? void 0 : _a.version;
|
|
118
119
|
if (!version) {
|
|
119
120
|
// Don't bump snapshots for the first release ever
|
|
@@ -127,7 +128,7 @@ class Java extends base_1.BaseStrategy {
|
|
|
127
128
|
const pullRequests = commits
|
|
128
129
|
.map(commit => {
|
|
129
130
|
var _a;
|
|
130
|
-
return pull_request_title_1.PullRequestTitle.parse(((_a = commit.pullRequest) === null || _a === void 0 ? void 0 : _a.title) || commit.message, this.pullRequestTitlePattern);
|
|
131
|
+
return pull_request_title_1.PullRequestTitle.parse(((_a = commit.pullRequest) === null || _a === void 0 ? void 0 : _a.title) || commit.message, this.pullRequestTitlePattern, this.logger);
|
|
131
132
|
})
|
|
132
133
|
.filter(pullRequest => pullRequest);
|
|
133
134
|
const snapshotCommits = pullRequests
|
|
@@ -23,7 +23,6 @@ const version_1 = require("../version");
|
|
|
23
23
|
const commit_1 = require("../commit");
|
|
24
24
|
const commit_split_1 = require("../util/commit-split");
|
|
25
25
|
const default_1 = require("../updaters/default");
|
|
26
|
-
const logger_1 = require("../util/logger");
|
|
27
26
|
const tag_name_1 = require("../util/tag-name");
|
|
28
27
|
const pull_request_title_1 = require("../util/pull-request-title");
|
|
29
28
|
const branch_name_1 = require("../util/branch-name");
|
|
@@ -51,9 +50,9 @@ class PHPYoshi extends base_1.BaseStrategy {
|
|
|
51
50
|
}
|
|
52
51
|
async buildReleasePullRequest(commits, latestRelease, draft, labels = []) {
|
|
53
52
|
var _a, _b, _c;
|
|
54
|
-
const conventionalCommits = await this.postProcessCommits((0, commit_1.parseConventionalCommits)(commits));
|
|
53
|
+
const conventionalCommits = await this.postProcessCommits((0, commit_1.parseConventionalCommits)(commits, this.logger));
|
|
55
54
|
if (conventionalCommits.length === 0) {
|
|
56
|
-
|
|
55
|
+
this.logger.info(`No commits for path: ${this.path}, skipping`);
|
|
57
56
|
return undefined;
|
|
58
57
|
}
|
|
59
58
|
const newVersion = latestRelease
|
|
@@ -115,7 +114,7 @@ class PHPYoshi extends base_1.BaseStrategy {
|
|
|
115
114
|
const componentInfo = directoryVersionContents[directory];
|
|
116
115
|
const version = versionsMap.get(componentInfo.composer.name);
|
|
117
116
|
if (!version) {
|
|
118
|
-
|
|
117
|
+
this.logger.warn(`No version found for ${componentInfo.composer.name}`);
|
|
119
118
|
continue;
|
|
120
119
|
}
|
|
121
120
|
updates.push({
|
|
@@ -155,7 +154,7 @@ class PHPYoshi extends base_1.BaseStrategy {
|
|
|
155
154
|
};
|
|
156
155
|
}
|
|
157
156
|
async parsePullRequestBody(pullRequestBody) {
|
|
158
|
-
const body = pull_request_body_1.PullRequestBody.parse(pullRequestBody);
|
|
157
|
+
const body = pull_request_body_1.PullRequestBody.parse(pullRequestBody, this.logger);
|
|
159
158
|
if (!body) {
|
|
160
159
|
return undefined;
|
|
161
160
|
}
|
|
@@ -20,7 +20,6 @@ const version_1 = require("../version");
|
|
|
20
20
|
const setup_cfg_1 = require("../updaters/python/setup-cfg");
|
|
21
21
|
const setup_py_1 = require("../updaters/python/setup-py");
|
|
22
22
|
const pyproject_toml_1 = require("../updaters/python/pyproject-toml");
|
|
23
|
-
const logger_1 = require("../util/logger");
|
|
24
23
|
const python_file_with_version_1 = require("../updaters/python/python-file-with-version");
|
|
25
24
|
const CHANGELOG_SECTIONS = [
|
|
26
25
|
{ type: 'feat', section: 'Features' },
|
|
@@ -82,12 +81,12 @@ class Python extends base_1.BaseStrategy {
|
|
|
82
81
|
projectName = pyProject.name;
|
|
83
82
|
}
|
|
84
83
|
else {
|
|
85
|
-
|
|
84
|
+
this.logger.warn(parsedPyProject
|
|
86
85
|
? 'invalid pyproject.toml'
|
|
87
86
|
: `file ${this.addPath('pyproject.toml')} did not exist`);
|
|
88
87
|
}
|
|
89
88
|
if (!projectName) {
|
|
90
|
-
|
|
89
|
+
this.logger.warn('No project/component found.');
|
|
91
90
|
}
|
|
92
91
|
else {
|
|
93
92
|
[projectName, projectName.replace(/-/g, '_')]
|
|
@@ -20,7 +20,6 @@ const changelog_1 = require("../updaters/changelog");
|
|
|
20
20
|
const cargo_toml_1 = require("../updaters/rust/cargo-toml");
|
|
21
21
|
const cargo_lock_1 = require("../updaters/rust/cargo-lock");
|
|
22
22
|
const common_1 = require("../updaters/rust/common");
|
|
23
|
-
const logger_1 = require("../util/logger");
|
|
24
23
|
const base_1 = require("./base");
|
|
25
24
|
const version_1 = require("../version");
|
|
26
25
|
class Rust extends base_1.BaseStrategy {
|
|
@@ -44,28 +43,28 @@ class Rust extends base_1.BaseStrategy {
|
|
|
44
43
|
versionsMap.set(workspaceManifest.package.name, version);
|
|
45
44
|
}
|
|
46
45
|
else {
|
|
47
|
-
|
|
46
|
+
this.logger.warn('No workspace manifest package name found');
|
|
48
47
|
}
|
|
49
|
-
|
|
48
|
+
this.logger.info(`found workspace with ${members.length} members, upgrading all`);
|
|
50
49
|
// Collect submodule names to update
|
|
51
50
|
const manifestsByPath = new Map();
|
|
52
51
|
for (const member of members) {
|
|
53
52
|
const manifestPath = `${member}/Cargo.toml`;
|
|
54
53
|
const manifestContent = await this.getContent(manifestPath);
|
|
55
54
|
if (!manifestContent) {
|
|
56
|
-
|
|
55
|
+
this.logger.warn(`member ${member} declared but did not find Cargo.toml`);
|
|
57
56
|
continue;
|
|
58
57
|
}
|
|
59
58
|
const manifest = (0, common_1.parseCargoManifest)(manifestContent.parsedContent);
|
|
60
59
|
manifestsByPath.set(manifestPath, manifestContent);
|
|
61
60
|
if (!((_c = manifest.package) === null || _c === void 0 ? void 0 : _c.name)) {
|
|
62
|
-
|
|
61
|
+
this.logger.warn(`member ${member} has no package name`);
|
|
63
62
|
continue;
|
|
64
63
|
}
|
|
65
64
|
versionsMap.set(manifest.package.name, version);
|
|
66
65
|
}
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
this.logger.info(`updating ${manifestsByPath.size} submodules`);
|
|
67
|
+
this.logger.debug('versions map:', versionsMap);
|
|
69
68
|
for (const [manifestPath, manifestContent] of manifestsByPath) {
|
|
70
69
|
updates.push({
|
|
71
70
|
path: this.addPath(manifestPath),
|
|
@@ -88,13 +87,13 @@ class Rust extends base_1.BaseStrategy {
|
|
|
88
87
|
});
|
|
89
88
|
}
|
|
90
89
|
else {
|
|
91
|
-
|
|
90
|
+
this.logger.info('single crate found, updating Cargo.toml');
|
|
92
91
|
const packageName = await this.getDefaultPackageName();
|
|
93
92
|
if (packageName) {
|
|
94
93
|
versionsMap.set(packageName, version);
|
|
95
94
|
}
|
|
96
95
|
else {
|
|
97
|
-
|
|
96
|
+
this.logger.warn('No crate package name found');
|
|
98
97
|
}
|
|
99
98
|
updates.push({
|
|
100
99
|
path: this.addPath('Cargo.toml'),
|
package/build/src/update.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GitHubFileContents } from '@google-automations/git-file-utils';
|
|
2
|
+
import { Logger } from './util/logger';
|
|
2
3
|
/**
|
|
3
4
|
* An update is a collection of data that represents changes to
|
|
4
5
|
* a file in a repository.
|
|
@@ -19,5 +20,5 @@ export interface Updater {
|
|
|
19
20
|
* @param {string} content The initial content
|
|
20
21
|
* @returns {string} The updated content
|
|
21
22
|
*/
|
|
22
|
-
updateContent(content: string | undefined): string;
|
|
23
|
+
updateContent(content: string | undefined, logger?: Logger): string;
|
|
23
24
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Logger } from '../../util/logger';
|
|
1
2
|
import { DefaultUpdater } from '../default';
|
|
2
3
|
/**
|
|
3
4
|
* Updates a Dart pubspec.yaml file.
|
|
@@ -8,5 +9,5 @@ export declare class PubspecYaml extends DefaultUpdater {
|
|
|
8
9
|
* @param {string} content The initial content
|
|
9
10
|
* @returns {string} The updated content
|
|
10
11
|
*/
|
|
11
|
-
updateContent(content: string): string;
|
|
12
|
+
updateContent(content: string, logger?: Logger): string;
|
|
12
13
|
}
|
|
@@ -25,7 +25,7 @@ class PubspecYaml extends default_1.DefaultUpdater {
|
|
|
25
25
|
* @param {string} content The initial content
|
|
26
26
|
* @returns {string} The updated content
|
|
27
27
|
*/
|
|
28
|
-
updateContent(content) {
|
|
28
|
+
updateContent(content, logger = logger_1.logger) {
|
|
29
29
|
const oldVersion = content.match(/^version: ([0-9.]+)\+?(.*$)/m);
|
|
30
30
|
let buildNumber = '';
|
|
31
31
|
if (oldVersion) {
|
|
@@ -33,14 +33,14 @@ class PubspecYaml extends default_1.DefaultUpdater {
|
|
|
33
33
|
const parsedBuild = parseInt(buildNumber);
|
|
34
34
|
if (!isNaN(parsedBuild)) {
|
|
35
35
|
buildNumber = `+${parsedBuild + 1}`;
|
|
36
|
-
|
|
36
|
+
logger.info(`updating from ${oldVersion[1]}+${oldVersion[2]} to ${this.version}${buildNumber}`);
|
|
37
37
|
}
|
|
38
38
|
else if (buildNumber.length > 0) {
|
|
39
39
|
buildNumber = `+${buildNumber}`;
|
|
40
|
-
|
|
40
|
+
logger.info(`updating from ${oldVersion[1]}+${oldVersion[2]} to ${this.version}${buildNumber}`);
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
|
|
43
|
+
logger.info(`updating from ${oldVersion[1]} to ${this.version}`);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
return content.replace(/^version: .*$/m, `version: ${this.version}${buildNumber}`);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Updater } from '../../update';
|
|
2
2
|
import { Version } from '../../version';
|
|
3
|
+
import { Logger } from '../../util/logger';
|
|
3
4
|
/**
|
|
4
5
|
* Updates the apis.json format. See
|
|
5
6
|
* https://github.com/googleapis/google-cloud-dotnet/blob/main/apis/README.md.
|
|
@@ -13,5 +14,5 @@ export declare class Apis implements Updater {
|
|
|
13
14
|
* @param {string} content The initial content
|
|
14
15
|
* @returns {string} The updated content
|
|
15
16
|
*/
|
|
16
|
-
updateContent(content: string): string;
|
|
17
|
+
updateContent(content: string, logger?: Logger): string;
|
|
17
18
|
}
|
|
@@ -30,11 +30,11 @@ class Apis {
|
|
|
30
30
|
* @param {string} content The initial content
|
|
31
31
|
* @returns {string} The updated content
|
|
32
32
|
*/
|
|
33
|
-
updateContent(content) {
|
|
33
|
+
updateContent(content, logger = logger_1.logger) {
|
|
34
34
|
const data = JSON.parse(content);
|
|
35
35
|
const api = data.apis.find(api => api.id === this.component);
|
|
36
36
|
if (!api) {
|
|
37
|
-
|
|
37
|
+
logger.warn(`Failed to find component: ${this.component} in apis.json`);
|
|
38
38
|
return content;
|
|
39
39
|
}
|
|
40
40
|
api.version = this.version.toString();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Logger } from '../../util/logger';
|
|
1
2
|
import { DefaultUpdater } from '../default';
|
|
2
3
|
/**
|
|
3
4
|
* Updates an Elixir mix.exs file and looks for a version string.
|
|
@@ -8,5 +9,5 @@ export declare class ElixirMixExs extends DefaultUpdater {
|
|
|
8
9
|
* @param {string} content The initial content
|
|
9
10
|
* @returns {string} The updated content
|
|
10
11
|
*/
|
|
11
|
-
updateContent(content: string): string;
|
|
12
|
+
updateContent(content: string, logger?: Logger): string;
|
|
12
13
|
}
|
|
@@ -25,10 +25,10 @@ class ElixirMixExs extends default_1.DefaultUpdater {
|
|
|
25
25
|
* @param {string} content The initial content
|
|
26
26
|
* @returns {string} The updated content
|
|
27
27
|
*/
|
|
28
|
-
updateContent(content) {
|
|
28
|
+
updateContent(content, logger = logger_1.logger) {
|
|
29
29
|
const oldVersion = content.match(/version: "([A-Za-z0-9_\-+.~]+)",/);
|
|
30
30
|
if (oldVersion) {
|
|
31
|
-
|
|
31
|
+
logger.info(`updating from ${oldVersion[1]} to ${this.version}`);
|
|
32
32
|
}
|
|
33
33
|
return content.replace(/version: "[A-Za-z0-9_\-+.~]+",/, `version: "${this.version}",`);
|
|
34
34
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Updater } from '../update';
|
|
2
2
|
import { Version } from '../version';
|
|
3
|
+
import { Logger } from '../util/logger';
|
|
3
4
|
export declare class GenericJson implements Updater {
|
|
4
5
|
readonly jsonpath: string;
|
|
5
6
|
readonly version: Version;
|
|
@@ -9,5 +10,5 @@ export declare class GenericJson implements Updater {
|
|
|
9
10
|
* @param {string} content The initial content
|
|
10
11
|
* @returns {string} The updated content
|
|
11
12
|
*/
|
|
12
|
-
updateContent(content: string): string;
|
|
13
|
+
updateContent(content: string, logger?: Logger): string;
|
|
13
14
|
}
|
|
@@ -27,13 +27,13 @@ class GenericJson {
|
|
|
27
27
|
* @param {string} content The initial content
|
|
28
28
|
* @returns {string} The updated content
|
|
29
29
|
*/
|
|
30
|
-
updateContent(content) {
|
|
30
|
+
updateContent(content, logger = logger_1.logger) {
|
|
31
31
|
const data = JSON.parse(content);
|
|
32
32
|
const nodes = jp.apply(data, this.jsonpath, _val => {
|
|
33
33
|
return this.version.toString();
|
|
34
34
|
});
|
|
35
35
|
if (!nodes) {
|
|
36
|
-
|
|
36
|
+
logger.warn(`No entries modified in ${this.jsonpath}`);
|
|
37
37
|
return content;
|
|
38
38
|
}
|
|
39
39
|
return (0, json_stringify_1.jsonStringify)(data, content);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Updater } from '../update';
|
|
2
2
|
import { Version } from '../version';
|
|
3
|
+
import { Logger } from '../util/logger';
|
|
3
4
|
/**
|
|
4
5
|
* Updates YAML document according to given JSONPath.
|
|
5
6
|
*
|
|
@@ -18,5 +19,5 @@ export declare class GenericYaml implements Updater {
|
|
|
18
19
|
* @param {string} content The initial content
|
|
19
20
|
* @returns {string} The updated content
|
|
20
21
|
*/
|
|
21
|
-
updateContent(content: string): string;
|
|
22
|
+
updateContent(content: string, logger?: Logger): string;
|
|
22
23
|
}
|
|
@@ -37,14 +37,14 @@ class GenericYaml {
|
|
|
37
37
|
* @param {string} content The initial content
|
|
38
38
|
* @returns {string} The updated content
|
|
39
39
|
*/
|
|
40
|
-
updateContent(content) {
|
|
40
|
+
updateContent(content, logger = logger_1.logger) {
|
|
41
41
|
// Parse possibly multi-document file
|
|
42
42
|
let docs;
|
|
43
43
|
try {
|
|
44
44
|
docs = yaml.loadAll(content, null, { json: true });
|
|
45
45
|
}
|
|
46
46
|
catch (e) {
|
|
47
|
-
|
|
47
|
+
logger.warn('Invalid yaml, cannot be parsed', e);
|
|
48
48
|
return content;
|
|
49
49
|
}
|
|
50
50
|
// Update each document
|
|
@@ -59,7 +59,7 @@ class GenericYaml {
|
|
|
59
59
|
});
|
|
60
60
|
// If nothing was modified, return original content
|
|
61
61
|
if (!modified) {
|
|
62
|
-
|
|
62
|
+
logger.warn(`No entries modified in ${this.jsonpath}`);
|
|
63
63
|
return content;
|
|
64
64
|
}
|
|
65
65
|
// Stringify documents
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DefaultUpdater, UpdateOptions } from './default';
|
|
2
|
+
import { Logger } from '../util/logger';
|
|
2
3
|
/**
|
|
3
4
|
* Options for the Generic updater.
|
|
4
5
|
*/
|
|
@@ -40,5 +41,5 @@ export declare class Generic extends DefaultUpdater {
|
|
|
40
41
|
* @param {string} content The initial content
|
|
41
42
|
* @returns {string} The updated content
|
|
42
43
|
*/
|
|
43
|
-
updateContent(content: string | undefined): string;
|
|
44
|
+
updateContent(content: string | undefined, logger?: Logger): string;
|
|
44
45
|
}
|
|
@@ -57,7 +57,7 @@ class Generic extends default_1.DefaultUpdater {
|
|
|
57
57
|
* @param {string} content The initial content
|
|
58
58
|
* @returns {string} The updated content
|
|
59
59
|
*/
|
|
60
|
-
updateContent(content) {
|
|
60
|
+
updateContent(content, logger = logger_1.logger) {
|
|
61
61
|
if (!content) {
|
|
62
62
|
return '';
|
|
63
63
|
}
|
|
@@ -78,7 +78,7 @@ class Generic extends default_1.DefaultUpdater {
|
|
|
78
78
|
newLines.push(line.replace(VERSION_REGEX, version.toString()));
|
|
79
79
|
return;
|
|
80
80
|
default:
|
|
81
|
-
|
|
81
|
+
logger.warn(`unknown block scope: ${scope}`);
|
|
82
82
|
newLines.push(line);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Logger } from '../../util/logger';
|
|
1
2
|
import { DefaultUpdater } from '../default';
|
|
2
3
|
/**
|
|
3
4
|
* Updates a Helm chart.yaml file.
|
|
@@ -8,5 +9,5 @@ export declare class ChartYaml extends DefaultUpdater {
|
|
|
8
9
|
* @param {string} content The initial content
|
|
9
10
|
* @returns {string} The updated content
|
|
10
11
|
*/
|
|
11
|
-
updateContent(content: string): string;
|
|
12
|
+
updateContent(content: string, logger?: Logger): string;
|
|
12
13
|
}
|
|
@@ -26,13 +26,13 @@ class ChartYaml extends default_1.DefaultUpdater {
|
|
|
26
26
|
* @param {string} content The initial content
|
|
27
27
|
* @returns {string} The updated content
|
|
28
28
|
*/
|
|
29
|
-
updateContent(content) {
|
|
29
|
+
updateContent(content, logger = logger_1.logger) {
|
|
30
30
|
const data = yaml.load(content, { json: true });
|
|
31
31
|
if (data === null || data === undefined) {
|
|
32
32
|
return '';
|
|
33
33
|
}
|
|
34
34
|
const parsed = JSON.parse(JSON.stringify(data));
|
|
35
|
-
|
|
35
|
+
logger.info(`updating from ${parsed.version} to ${this.version}`);
|
|
36
36
|
parsed.version = this.version.toString();
|
|
37
37
|
return yaml.dump(parsed);
|
|
38
38
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DefaultUpdater, UpdateOptions } from '../default';
|
|
2
|
+
import { Logger } from '../../util/logger';
|
|
2
3
|
interface JavaUpdateOptions extends UpdateOptions {
|
|
3
4
|
isSnapshot?: boolean;
|
|
4
5
|
}
|
|
@@ -15,6 +16,6 @@ export declare class JavaUpdate extends DefaultUpdater {
|
|
|
15
16
|
* @param {string} content The initial content
|
|
16
17
|
* @returns {string} The updated content
|
|
17
18
|
*/
|
|
18
|
-
updateContent(content: string): string;
|
|
19
|
+
updateContent(content: string, logger?: Logger): string;
|
|
19
20
|
}
|
|
20
21
|
export {};
|
|
@@ -35,9 +35,9 @@ class JavaUpdate extends default_1.DefaultUpdater {
|
|
|
35
35
|
* @param {string} content The initial content
|
|
36
36
|
* @returns {string} The updated content
|
|
37
37
|
*/
|
|
38
|
-
updateContent(content) {
|
|
38
|
+
updateContent(content, logger = logger_1.logger) {
|
|
39
39
|
if (!this.versionsMap) {
|
|
40
|
-
|
|
40
|
+
logger.warn('missing versions map');
|
|
41
41
|
return content;
|
|
42
42
|
}
|
|
43
43
|
const newLines = [];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JavaUpdate } from './java-update';
|
|
2
2
|
import { VersionsMap } from '../../version';
|
|
3
|
+
import { Logger } from '../../util/logger';
|
|
3
4
|
/**
|
|
4
5
|
* Updates a versions.txt file which contains current versions of
|
|
5
6
|
* components within a Java repo.
|
|
@@ -11,7 +12,7 @@ export declare class VersionsManifest extends JavaUpdate {
|
|
|
11
12
|
* @param {string} content The initial content
|
|
12
13
|
* @returns {string} The updated content
|
|
13
14
|
*/
|
|
14
|
-
updateContent(content: string): string;
|
|
15
|
+
updateContent(content: string, logger?: Logger): string;
|
|
15
16
|
protected updateSingleVersion(content: string, packageName: string, version: string): string;
|
|
16
17
|
static parseVersions(content: string): VersionsMap;
|
|
17
18
|
static needsSnapshot(content: string): boolean;
|
|
@@ -28,9 +28,9 @@ class VersionsManifest extends java_update_1.JavaUpdate {
|
|
|
28
28
|
* @param {string} content The initial content
|
|
29
29
|
* @returns {string} The updated content
|
|
30
30
|
*/
|
|
31
|
-
updateContent(content) {
|
|
31
|
+
updateContent(content, logger = logger_1.logger) {
|
|
32
32
|
if (!this.versionsMap) {
|
|
33
|
-
|
|
33
|
+
logger.warn('missing versions map');
|
|
34
34
|
return content;
|
|
35
35
|
}
|
|
36
36
|
let newContent = content;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Logger } from '../../util/logger';
|
|
1
2
|
import { DefaultUpdater } from '../default';
|
|
2
3
|
/**
|
|
3
4
|
* Updates KMR blueprint yaml file.
|
|
@@ -8,5 +9,5 @@ export declare class KRMBlueprintVersion extends DefaultUpdater {
|
|
|
8
9
|
* @param {string} content The initial content
|
|
9
10
|
* @returns {string} The updated content
|
|
10
11
|
*/
|
|
11
|
-
updateContent(content: string): string;
|
|
12
|
+
updateContent(content: string, logger?: Logger): string;
|
|
12
13
|
}
|
|
@@ -25,7 +25,7 @@ class KRMBlueprintVersion extends default_1.DefaultUpdater {
|
|
|
25
25
|
* @param {string} content The initial content
|
|
26
26
|
* @returns {string} The updated content
|
|
27
27
|
*/
|
|
28
|
-
updateContent(content) {
|
|
28
|
+
updateContent(content, logger = logger_1.logger) {
|
|
29
29
|
var _a;
|
|
30
30
|
// js-yaml(and kpt TS SDK) does not preserve comments hence regex match
|
|
31
31
|
// match starting cnrm/ ending with semver to prevent wrong updates like pinned config.kubernetes.io/function
|
|
@@ -36,7 +36,7 @@ class KRMBlueprintVersion extends default_1.DefaultUpdater {
|
|
|
36
36
|
}
|
|
37
37
|
const oldVersion = content.match(new RegExp(matchRegex));
|
|
38
38
|
if (oldVersion) {
|
|
39
|
-
|
|
39
|
+
logger.info(`updating from ${oldVersion[2]} to v${this.version}`);
|
|
40
40
|
}
|
|
41
41
|
const newVersion = content.replace(new RegExp(matchRegex, 'g'), `$1v${this.version}`);
|
|
42
42
|
return newVersion;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Logger } from '../../util/logger';
|
|
1
2
|
import { DefaultUpdater } from '../default';
|
|
2
3
|
/**
|
|
3
4
|
* This updates a Node.js package.json file's main version.
|
|
@@ -8,5 +9,5 @@ export declare class PackageJson extends DefaultUpdater {
|
|
|
8
9
|
* @param {string} content The initial content
|
|
9
10
|
* @returns {string} The updated content
|
|
10
11
|
*/
|
|
11
|
-
updateContent(content: string): string;
|
|
12
|
+
updateContent(content: string, logger?: Logger): string;
|
|
12
13
|
}
|
|
@@ -26,9 +26,9 @@ class PackageJson extends default_1.DefaultUpdater {
|
|
|
26
26
|
* @param {string} content The initial content
|
|
27
27
|
* @returns {string} The updated content
|
|
28
28
|
*/
|
|
29
|
-
updateContent(content) {
|
|
29
|
+
updateContent(content, logger = logger_1.logger) {
|
|
30
30
|
const parsed = JSON.parse(content);
|
|
31
|
-
|
|
31
|
+
logger.info(`updating from ${parsed.version} to ${this.version}`);
|
|
32
32
|
parsed.version = this.version.toString();
|
|
33
33
|
return (0, json_stringify_1.jsonStringify)(parsed, content);
|
|
34
34
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { Logger } from '../../util/logger';
|
|
1
2
|
import { DefaultUpdater } from '../default';
|
|
2
3
|
/**
|
|
3
4
|
* Updates a Node.js package-lock.json file's version and '' package
|
|
4
5
|
* version (for a v2 lock file).
|
|
5
6
|
*/
|
|
6
7
|
export declare class PackageLockJson extends DefaultUpdater {
|
|
7
|
-
updateContent(content: string): string;
|
|
8
|
+
updateContent(content: string, logger?: Logger): string;
|
|
8
9
|
}
|