release-please 17.7.0 → 17.8.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/build/src/factory.js +4 -0
- package/build/src/index.d.ts +1 -1
- package/build/src/index.js +1 -1
- package/build/src/strategies/go-librarian.d.ts +9 -0
- package/build/src/strategies/go-librarian.js +70 -0
- package/build/src/strategies/java-yoshi-mono-repo.js +1 -1
- package/build/src/strategies/node-librarian.js +1 -1
- package/build/src/strategies/python-librarian.d.ts +6 -0
- package/build/src/strategies/python-librarian.js +35 -0
- package/build/src/updaters/go/version-go.js +1 -1
- package/build/src/updaters/{node/librarian-yaml.d.ts → librarian-yaml.d.ts} +16 -7
- package/build/src/updaters/librarian-yaml.js +120 -0
- package/package.json +1 -1
- package/build/src/updaters/java/librarian-yaml.d.ts +0 -29
- package/build/src/updaters/java/librarian-yaml.js +0 -81
- package/build/src/updaters/node/librarian-yaml.js +0 -73
package/build/src/factory.js
CHANGED
|
@@ -38,6 +38,7 @@ const elixir_1 = require("./strategies/elixir");
|
|
|
38
38
|
const expo_1 = require("./strategies/expo");
|
|
39
39
|
const go_1 = require("./strategies/go");
|
|
40
40
|
const go_yoshi_1 = require("./strategies/go-yoshi");
|
|
41
|
+
const go_librarian_1 = require("./strategies/go-librarian");
|
|
41
42
|
const helm_1 = require("./strategies/helm");
|
|
42
43
|
const java_1 = require("./strategies/java");
|
|
43
44
|
const java_yoshi_1 = require("./strategies/java-yoshi");
|
|
@@ -50,6 +51,7 @@ const ocaml_1 = require("./strategies/ocaml");
|
|
|
50
51
|
const php_1 = require("./strategies/php");
|
|
51
52
|
const php_yoshi_1 = require("./strategies/php-yoshi");
|
|
52
53
|
const python_1 = require("./strategies/python");
|
|
54
|
+
const python_librarian_1 = require("./strategies/python-librarian");
|
|
53
55
|
const r_1 = require("./strategies/r");
|
|
54
56
|
const ruby_1 = require("./strategies/ruby");
|
|
55
57
|
const ruby_yoshi_1 = require("./strategies/ruby-yoshi");
|
|
@@ -67,6 +69,7 @@ const releasers = {
|
|
|
67
69
|
'dotnet-yoshi': options => new dotnet_yoshi_1.DotnetYoshi(options),
|
|
68
70
|
go: options => new go_1.Go(options),
|
|
69
71
|
'go-yoshi': options => new go_yoshi_1.GoYoshi(options),
|
|
72
|
+
'go-librarian': options => new go_librarian_1.GoLibrarian(options),
|
|
70
73
|
java: options => new java_1.Java(options),
|
|
71
74
|
maven: options => new maven_1.Maven(options),
|
|
72
75
|
'java-yoshi': options => new java_yoshi_1.JavaYoshi(options),
|
|
@@ -94,6 +97,7 @@ const releasers = {
|
|
|
94
97
|
php: options => new php_1.PHP(options),
|
|
95
98
|
'php-yoshi': options => new php_yoshi_1.PHPYoshi(options),
|
|
96
99
|
python: options => new python_1.Python(options),
|
|
100
|
+
'python-librarian': options => new python_librarian_1.PythonLibrarian(options),
|
|
97
101
|
r: options => new r_1.R(options),
|
|
98
102
|
ruby: options => new ruby_1.Ruby(options),
|
|
99
103
|
'ruby-yoshi': options => new ruby_yoshi_1.RubyYoshi(options),
|
package/build/src/index.d.ts
CHANGED
package/build/src/index.js
CHANGED
|
@@ -36,6 +36,6 @@ Object.defineProperty(exports, "GitHub", { enumerable: true, get: function () {
|
|
|
36
36
|
exports.configSchema = require('../../schemas/config.json');
|
|
37
37
|
exports.manifestSchema = require('../../schemas/manifest.json');
|
|
38
38
|
// x-release-please-start-version
|
|
39
|
-
exports.VERSION = '17.
|
|
39
|
+
exports.VERSION = '17.8.0';
|
|
40
40
|
// x-release-please-end
|
|
41
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
|
|
2
|
+
import { Update } from '../update';
|
|
3
|
+
import { Version } from '../version';
|
|
4
|
+
export declare class GoLibrarian extends BaseStrategy {
|
|
5
|
+
readonly versionFile: string;
|
|
6
|
+
constructor(options: BaseStrategyOptions);
|
|
7
|
+
protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
|
|
8
|
+
protected initialReleaseVersion(): Version;
|
|
9
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2026 Google LLC
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.GoLibrarian = void 0;
|
|
17
|
+
const base_1 = require("./base");
|
|
18
|
+
const changelog_1 = require("../updaters/changelog");
|
|
19
|
+
const librarian_yaml_1 = require("../updaters/librarian-yaml");
|
|
20
|
+
const version_1 = require("../version");
|
|
21
|
+
const version_go_1 = require("../updaters/go/version-go");
|
|
22
|
+
class GoLibrarian extends base_1.BaseStrategy {
|
|
23
|
+
constructor(options) {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
options.changelogPath = (_a = options.changelogPath) !== null && _a !== void 0 ? _a : 'CHANGES.md';
|
|
26
|
+
super(options);
|
|
27
|
+
this.versionFile = (_b = options.versionFile) !== null && _b !== void 0 ? _b : 'internal/version.go';
|
|
28
|
+
}
|
|
29
|
+
async buildUpdates(options) {
|
|
30
|
+
const updates = [];
|
|
31
|
+
const version = options.newVersion;
|
|
32
|
+
if (!this.skipChangelog) {
|
|
33
|
+
updates.push({
|
|
34
|
+
path: this.addPath(this.changelogPath),
|
|
35
|
+
createIfMissing: true,
|
|
36
|
+
updater: new changelog_1.Changelog({
|
|
37
|
+
version,
|
|
38
|
+
changelogEntry: options.changelogEntry,
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (this.versionFile) {
|
|
43
|
+
updates.push({
|
|
44
|
+
path: this.addPath(this.versionFile),
|
|
45
|
+
createIfMissing: false,
|
|
46
|
+
updater: new version_go_1.VersionGo({
|
|
47
|
+
version,
|
|
48
|
+
}),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
updates.push({
|
|
52
|
+
path: 'librarian.yaml',
|
|
53
|
+
createIfMissing: false,
|
|
54
|
+
updater: new librarian_yaml_1.LibrarianYamlUpdater({
|
|
55
|
+
version,
|
|
56
|
+
packagePath: this.path,
|
|
57
|
+
component: this.component,
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
60
|
+
return updates;
|
|
61
|
+
}
|
|
62
|
+
initialReleaseVersion() {
|
|
63
|
+
if (this.initialVersion) {
|
|
64
|
+
return version_1.Version.parse(this.initialVersion);
|
|
65
|
+
}
|
|
66
|
+
return version_1.Version.parse('1.0.0');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.GoLibrarian = GoLibrarian;
|
|
70
|
+
//# sourceMappingURL=go-librarian.js.map
|
|
@@ -23,7 +23,7 @@ const composite_1 = require("../updaters/composite");
|
|
|
23
23
|
const errors_1 = require("../errors");
|
|
24
24
|
const java_1 = require("./java");
|
|
25
25
|
const java_update_1 = require("../updaters/java/java-update");
|
|
26
|
-
const librarian_yaml_1 = require("../updaters/
|
|
26
|
+
const librarian_yaml_1 = require("../updaters/librarian-yaml");
|
|
27
27
|
const filter_commits_1 = require("../util/filter-commits");
|
|
28
28
|
class JavaYoshiMonoRepo extends java_1.Java {
|
|
29
29
|
/**
|
|
@@ -20,7 +20,7 @@ const package_lock_json_1 = require("../updaters/node/package-lock-json");
|
|
|
20
20
|
const samples_package_json_1 = require("../updaters/node/samples-package-json");
|
|
21
21
|
const changelog_1 = require("../updaters/changelog");
|
|
22
22
|
const package_json_1 = require("../updaters/node/package-json");
|
|
23
|
-
const librarian_yaml_1 = require("../updaters/
|
|
23
|
+
const librarian_yaml_1 = require("../updaters/librarian-yaml");
|
|
24
24
|
const errors_1 = require("../errors");
|
|
25
25
|
const filter_commits_1 = require("../util/filter-commits");
|
|
26
26
|
class NodeLibrarian extends base_1.BaseStrategy {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2026 Google LLC
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.PythonLibrarian = void 0;
|
|
17
|
+
const python_1 = require("./python");
|
|
18
|
+
const librarian_yaml_1 = require("../updaters/librarian-yaml");
|
|
19
|
+
class PythonLibrarian extends python_1.Python {
|
|
20
|
+
async buildUpdates(options) {
|
|
21
|
+
const updates = await super.buildUpdates(options);
|
|
22
|
+
// Update librarian.yaml if this package exists within it.
|
|
23
|
+
updates.push({
|
|
24
|
+
path: 'librarian.yaml',
|
|
25
|
+
createIfMissing: false,
|
|
26
|
+
updater: new librarian_yaml_1.LibrarianYamlUpdater({
|
|
27
|
+
version: options.newVersion,
|
|
28
|
+
packagePath: this.path,
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
return updates;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.PythonLibrarian = PythonLibrarian;
|
|
35
|
+
//# sourceMappingURL=python-librarian.js.map
|
|
@@ -17,7 +17,7 @@ exports.VersionGo = void 0;
|
|
|
17
17
|
const default_1 = require("../default");
|
|
18
18
|
class VersionGo extends default_1.DefaultUpdater {
|
|
19
19
|
updateContent(content) {
|
|
20
|
-
return content.replace(/const Version = "[0-9]+\.[0-9]+\.[0-9](
|
|
20
|
+
return content.replace(/const Version = "[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?"/, `const Version = "${this.version.toString()}"`);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
exports.VersionGo = VersionGo;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { DefaultUpdater, UpdateOptions } from '
|
|
2
|
-
import { Logger } from '
|
|
1
|
+
import { DefaultUpdater, UpdateOptions } from './default';
|
|
2
|
+
import { Logger } from '../util/logger';
|
|
3
|
+
export interface JavaModule {
|
|
4
|
+
artifact_id: string;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
3
7
|
export interface LibrarianLibrary {
|
|
4
8
|
name: string;
|
|
5
|
-
output: string;
|
|
6
9
|
version: string;
|
|
10
|
+
output?: string;
|
|
11
|
+
java?: JavaModule;
|
|
7
12
|
[key: string]: any;
|
|
8
13
|
}
|
|
9
14
|
export interface LibrarianYamlSchema {
|
|
@@ -11,19 +16,23 @@ export interface LibrarianYamlSchema {
|
|
|
11
16
|
[key: string]: any;
|
|
12
17
|
}
|
|
13
18
|
export interface LibrarianUpdateOptions extends UpdateOptions {
|
|
14
|
-
packagePath
|
|
19
|
+
packagePath?: string;
|
|
20
|
+
component?: string;
|
|
15
21
|
}
|
|
16
22
|
/**
|
|
17
23
|
* Updates a librarian.yaml file.
|
|
18
24
|
*/
|
|
19
25
|
export declare class LibrarianYamlUpdater extends DefaultUpdater {
|
|
20
|
-
private readonly packagePath
|
|
26
|
+
private readonly packagePath?;
|
|
27
|
+
private readonly component?;
|
|
28
|
+
private readonly specialArtifacts;
|
|
21
29
|
constructor(options: LibrarianUpdateOptions);
|
|
22
30
|
/**
|
|
23
31
|
* Given initial file contents, return updated contents.
|
|
24
32
|
* @param {string} content The initial content
|
|
25
33
|
* @returns {string} The updated content
|
|
26
34
|
*/
|
|
27
|
-
updateContent(content: string,
|
|
28
|
-
deriveOutputDirectory
|
|
35
|
+
updateContent(content: string, _logger?: Logger): string;
|
|
36
|
+
private deriveOutputDirectory;
|
|
37
|
+
private findArtifactID;
|
|
29
38
|
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2026 Google LLC
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.LibrarianYamlUpdater = void 0;
|
|
17
|
+
const default_1 = require("./default");
|
|
18
|
+
const yaml = require("yaml");
|
|
19
|
+
const logger_1 = require("../util/logger");
|
|
20
|
+
/**
|
|
21
|
+
* Updates a librarian.yaml file.
|
|
22
|
+
*/
|
|
23
|
+
class LibrarianYamlUpdater extends default_1.DefaultUpdater {
|
|
24
|
+
constructor(options) {
|
|
25
|
+
super(options);
|
|
26
|
+
this.specialArtifacts = new Map([
|
|
27
|
+
['google-cloud-java', 'google-cloud-java'],
|
|
28
|
+
]);
|
|
29
|
+
this.packagePath = options.packagePath;
|
|
30
|
+
this.component = options.component;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Given initial file contents, return updated contents.
|
|
34
|
+
* @param {string} content The initial content
|
|
35
|
+
* @returns {string} The updated content
|
|
36
|
+
*/
|
|
37
|
+
updateContent(content, _logger = logger_1.logger) {
|
|
38
|
+
const doc = yaml.parseDocument(content);
|
|
39
|
+
if (!doc || doc.errors.length > 0) {
|
|
40
|
+
throw new Error(`Invalid yaml, cannot be parsed: ${doc.errors
|
|
41
|
+
.map(e => e.message)
|
|
42
|
+
.join(', ')}`);
|
|
43
|
+
}
|
|
44
|
+
const libraries = doc.get('libraries');
|
|
45
|
+
if (!libraries || !yaml.isSeq(libraries)) {
|
|
46
|
+
return content;
|
|
47
|
+
}
|
|
48
|
+
let modified = false;
|
|
49
|
+
for (const library of libraries.items) {
|
|
50
|
+
if (!yaml.isMap(library))
|
|
51
|
+
continue;
|
|
52
|
+
const libraryJSON = library.toJSON();
|
|
53
|
+
let newVersion = undefined;
|
|
54
|
+
if (this.versionsMap) {
|
|
55
|
+
// Multi-version (Java style)
|
|
56
|
+
const artifactID = this.findArtifactID(libraryJSON);
|
|
57
|
+
if (this.versionsMap.has(artifactID)) {
|
|
58
|
+
newVersion = this.versionsMap.get(artifactID);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// Single version (Go, Python, Node style)
|
|
63
|
+
const isGoMatch = (this.packagePath && libraryJSON.name === this.packagePath) ||
|
|
64
|
+
(this.component && libraryJSON.name === this.component);
|
|
65
|
+
const isPythonNodeMatch = this.packagePath &&
|
|
66
|
+
this.deriveOutputDirectory(libraryJSON) === this.packagePath;
|
|
67
|
+
if (isGoMatch || isPythonNodeMatch) {
|
|
68
|
+
newVersion = this.version;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (newVersion) {
|
|
72
|
+
const newVersionStr = newVersion.toString();
|
|
73
|
+
if (library.get('version') !== newVersionStr) {
|
|
74
|
+
library.set('version', newVersionStr);
|
|
75
|
+
modified = true;
|
|
76
|
+
}
|
|
77
|
+
if (this.versionsMap) {
|
|
78
|
+
const isSnapshot = newVersion.preRelease === 'SNAPSHOT';
|
|
79
|
+
if (!isSnapshot) {
|
|
80
|
+
let java = library.get('java');
|
|
81
|
+
if (!yaml.isMap(java)) {
|
|
82
|
+
const javaNode = doc.createNode({});
|
|
83
|
+
library.set('java', javaNode);
|
|
84
|
+
java = javaNode;
|
|
85
|
+
modified = true;
|
|
86
|
+
}
|
|
87
|
+
if (yaml.isMap(java)) {
|
|
88
|
+
if (java.get('released_version') !== newVersionStr) {
|
|
89
|
+
java.set('released_version', newVersionStr);
|
|
90
|
+
modified = true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (modified) {
|
|
98
|
+
return doc.toString({ lineWidth: 0 });
|
|
99
|
+
}
|
|
100
|
+
return content;
|
|
101
|
+
}
|
|
102
|
+
deriveOutputDirectory(library) {
|
|
103
|
+
if (library.output) {
|
|
104
|
+
return library.output;
|
|
105
|
+
}
|
|
106
|
+
return `packages/${library.name}`;
|
|
107
|
+
}
|
|
108
|
+
findArtifactID(library) {
|
|
109
|
+
const artifact = this.specialArtifacts.get(library.name);
|
|
110
|
+
if (artifact) {
|
|
111
|
+
return artifact;
|
|
112
|
+
}
|
|
113
|
+
if (library.java && library.java.artifact_id) {
|
|
114
|
+
return library.java.artifact_id;
|
|
115
|
+
}
|
|
116
|
+
return `google-cloud-${library.name}`;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.LibrarianYamlUpdater = LibrarianYamlUpdater;
|
|
120
|
+
//# sourceMappingURL=librarian-yaml.js.map
|
package/package.json
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { DefaultUpdater } from '../default';
|
|
2
|
-
import { Logger } from '../../util/logger';
|
|
3
|
-
export interface JavaModule {
|
|
4
|
-
artifact_id: string;
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
}
|
|
7
|
-
export interface LibrarianLibrary {
|
|
8
|
-
name: string;
|
|
9
|
-
version: string;
|
|
10
|
-
java: JavaModule;
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
}
|
|
13
|
-
export interface LibrarianYamlSchema {
|
|
14
|
-
libraries: LibrarianLibrary[];
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Updates a librarian.yaml file.
|
|
19
|
-
*/
|
|
20
|
-
export declare class LibrarianYamlUpdater extends DefaultUpdater {
|
|
21
|
-
specialArtifacts: ReadonlyMap<string, string>;
|
|
22
|
-
/**
|
|
23
|
-
* Given initial file contents, return updated contents.
|
|
24
|
-
* @param {string} content The initial content
|
|
25
|
-
* @returns {string} The updated content
|
|
26
|
-
*/
|
|
27
|
-
updateContent(content: string, logger?: Logger): string;
|
|
28
|
-
findArtifactID(library: LibrarianLibrary): string;
|
|
29
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2026 Google LLC
|
|
3
|
-
//
|
|
4
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
// you may not use this file except in compliance with the License.
|
|
6
|
-
// You may obtain a copy of the License at
|
|
7
|
-
//
|
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
//
|
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
// See the License for the specific language governing permissions and
|
|
14
|
-
// limitations under the License.
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.LibrarianYamlUpdater = void 0;
|
|
17
|
-
const default_1 = require("../default");
|
|
18
|
-
const yaml = require("yaml");
|
|
19
|
-
const logger_1 = require("../../util/logger");
|
|
20
|
-
/**
|
|
21
|
-
* Updates a librarian.yaml file.
|
|
22
|
-
*/
|
|
23
|
-
class LibrarianYamlUpdater extends default_1.DefaultUpdater {
|
|
24
|
-
constructor() {
|
|
25
|
-
super(...arguments);
|
|
26
|
-
this.specialArtifacts = new Map([
|
|
27
|
-
['google-cloud-java', 'google-cloud-java'],
|
|
28
|
-
]);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Given initial file contents, return updated contents.
|
|
32
|
-
* @param {string} content The initial content
|
|
33
|
-
* @returns {string} The updated content
|
|
34
|
-
*/
|
|
35
|
-
updateContent(content, logger = logger_1.logger) {
|
|
36
|
-
if (!this.versionsMap) {
|
|
37
|
-
logger.warn('missing versions map');
|
|
38
|
-
return content;
|
|
39
|
-
}
|
|
40
|
-
// Use yaml package to make sure librarian.yaml is not reformatted because
|
|
41
|
-
// we use different tool to format librarian.yaml.
|
|
42
|
-
const doc = yaml.parseDocument(content);
|
|
43
|
-
if (!doc || doc.errors.length > 0) {
|
|
44
|
-
logger.warn('Invalid yaml, cannot be parsed');
|
|
45
|
-
return content;
|
|
46
|
-
}
|
|
47
|
-
const libraries = doc.get('libraries');
|
|
48
|
-
if (!libraries || !yaml.isSeq(libraries)) {
|
|
49
|
-
return content;
|
|
50
|
-
}
|
|
51
|
-
let modified = false;
|
|
52
|
-
for (const library of libraries.items) {
|
|
53
|
-
if (!yaml.isMap(library))
|
|
54
|
-
continue;
|
|
55
|
-
const artifactID = this.findArtifactID(library.toJSON());
|
|
56
|
-
if (this.versionsMap.has(artifactID)) {
|
|
57
|
-
const newVersion = this.versionsMap.get(artifactID);
|
|
58
|
-
if (newVersion && library.get('version') !== newVersion.toString()) {
|
|
59
|
-
library.set('version', newVersion.toString());
|
|
60
|
-
modified = true;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (modified) {
|
|
65
|
-
return doc.toString({ lineWidth: 0 });
|
|
66
|
-
}
|
|
67
|
-
return content;
|
|
68
|
-
}
|
|
69
|
-
findArtifactID(library) {
|
|
70
|
-
const artifact = this.specialArtifacts.get(library.name);
|
|
71
|
-
if (artifact) {
|
|
72
|
-
return artifact;
|
|
73
|
-
}
|
|
74
|
-
if (library.java && library.java.artifact_id) {
|
|
75
|
-
return library.java.artifact_id;
|
|
76
|
-
}
|
|
77
|
-
return `google-cloud-${library.name}`;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
exports.LibrarianYamlUpdater = LibrarianYamlUpdater;
|
|
81
|
-
//# sourceMappingURL=librarian-yaml.js.map
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2026 Google LLC
|
|
3
|
-
//
|
|
4
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
// you may not use this file except in compliance with the License.
|
|
6
|
-
// You may obtain a copy of the License at
|
|
7
|
-
//
|
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
//
|
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
// See the License for the specific language governing permissions and
|
|
14
|
-
// limitations under the License.
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.LibrarianYamlUpdater = void 0;
|
|
17
|
-
const default_1 = require("../default");
|
|
18
|
-
const yaml = require("yaml");
|
|
19
|
-
const logger_1 = require("../../util/logger");
|
|
20
|
-
/**
|
|
21
|
-
* Updates a librarian.yaml file.
|
|
22
|
-
*/
|
|
23
|
-
class LibrarianYamlUpdater extends default_1.DefaultUpdater {
|
|
24
|
-
constructor(options) {
|
|
25
|
-
super(options);
|
|
26
|
-
this.packagePath = options.packagePath;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Given initial file contents, return updated contents.
|
|
30
|
-
* @param {string} content The initial content
|
|
31
|
-
* @returns {string} The updated content
|
|
32
|
-
*/
|
|
33
|
-
updateContent(content, logger = logger_1.logger) {
|
|
34
|
-
// Use yaml package to make sure librarian.yaml is not reformatted because
|
|
35
|
-
// we use different tool to format librarian.yaml.
|
|
36
|
-
const doc = yaml.parseDocument(content);
|
|
37
|
-
if (!doc || doc.errors.length > 0) {
|
|
38
|
-
logger.warn('Invalid yaml, cannot be parsed');
|
|
39
|
-
return content;
|
|
40
|
-
}
|
|
41
|
-
const libraries = doc.get('libraries');
|
|
42
|
-
if (!libraries || !yaml.isSeq(libraries)) {
|
|
43
|
-
return content;
|
|
44
|
-
}
|
|
45
|
-
let modified = false;
|
|
46
|
-
for (const library of libraries.items) {
|
|
47
|
-
if (!yaml.isMap(library))
|
|
48
|
-
continue;
|
|
49
|
-
// The release-please version map key is the output directory (explicit or
|
|
50
|
-
// derived) in librarian.yaml.
|
|
51
|
-
const outputDirectory = this.deriveOutputDirectory(library.toJSON());
|
|
52
|
-
if (outputDirectory === this.packagePath) {
|
|
53
|
-
const newVersion = this.version.toString();
|
|
54
|
-
if (library.get('version') !== newVersion) {
|
|
55
|
-
library.set('version', newVersion);
|
|
56
|
-
modified = true;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (modified) {
|
|
61
|
-
return doc.toString({ lineWidth: 0 });
|
|
62
|
-
}
|
|
63
|
-
return content;
|
|
64
|
-
}
|
|
65
|
-
deriveOutputDirectory(library) {
|
|
66
|
-
if (library.output) {
|
|
67
|
-
return library.output;
|
|
68
|
-
}
|
|
69
|
-
return `packages/${library.name}`;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.LibrarianYamlUpdater = LibrarianYamlUpdater;
|
|
73
|
-
//# sourceMappingURL=librarian-yaml.js.map
|