release-please 17.6.0 → 17.7.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 +2 -0
- package/build/src/github-api.js +13 -0
- package/build/src/github.js +13 -0
- package/build/src/index.d.ts +1 -1
- package/build/src/index.js +1 -1
- package/build/src/strategies/node-librarian.d.ts +10 -0
- package/build/src/strategies/node-librarian.js +121 -0
- package/build/src/updaters/java/librarian-yaml.d.ts +1 -1
- package/build/src/updaters/java/librarian-yaml.js +2 -2
- package/build/src/updaters/node/librarian-yaml.d.ts +29 -0
- package/build/src/updaters/node/librarian-yaml.js +73 -0
- package/package.json +2 -2
package/build/src/factory.js
CHANGED
|
@@ -45,6 +45,7 @@ const java_yoshi_mono_repo_1 = require("./strategies/java-yoshi-mono-repo");
|
|
|
45
45
|
const krm_blueprint_1 = require("./strategies/krm-blueprint");
|
|
46
46
|
const maven_1 = require("./strategies/maven");
|
|
47
47
|
const node_1 = require("./strategies/node");
|
|
48
|
+
const node_librarian_1 = require("./strategies/node-librarian");
|
|
48
49
|
const ocaml_1 = require("./strategies/ocaml");
|
|
49
50
|
const php_1 = require("./strategies/php");
|
|
50
51
|
const php_yoshi_1 = require("./strategies/php-yoshi");
|
|
@@ -87,6 +88,7 @@ const releasers = {
|
|
|
87
88
|
}),
|
|
88
89
|
'krm-blueprint': options => new krm_blueprint_1.KRMBlueprint(options),
|
|
89
90
|
node: options => new node_1.Node(options),
|
|
91
|
+
'node-librarian': options => new node_librarian_1.NodeLibrarian(options),
|
|
90
92
|
expo: options => new expo_1.Expo(options),
|
|
91
93
|
ocaml: options => new ocaml_1.OCaml(options),
|
|
92
94
|
php: options => new php_1.PHP(options),
|
package/build/src/github-api.js
CHANGED
|
@@ -50,6 +50,19 @@ class GitHubApi {
|
|
|
50
50
|
throw err;
|
|
51
51
|
}
|
|
52
52
|
this.logger.info(`received 502 error, ${maxRetries} attempts remaining`);
|
|
53
|
+
if (typeof opts.num === 'number') {
|
|
54
|
+
if (maxRetries === 1) {
|
|
55
|
+
this.logger.info('last retry, forcing batch size to 1');
|
|
56
|
+
opts.num = 1;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const nextNum = Math.floor(opts.num / 2);
|
|
60
|
+
if (nextNum >= 1) {
|
|
61
|
+
this.logger.info(`halving batch size from ${opts.num} to ${nextNum}`);
|
|
62
|
+
opts.num = nextNum;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
53
66
|
}
|
|
54
67
|
maxRetries -= 1;
|
|
55
68
|
if (maxRetries >= 0) {
|
package/build/src/github.js
CHANGED
|
@@ -80,6 +80,19 @@ class GitHub {
|
|
|
80
80
|
throw err;
|
|
81
81
|
}
|
|
82
82
|
this.logger.info(`received 502 error, ${maxRetries} attempts remaining`);
|
|
83
|
+
if (typeof opts.num === 'number') {
|
|
84
|
+
if (maxRetries === 1) {
|
|
85
|
+
this.logger.info('last retry, forcing batch size to 1');
|
|
86
|
+
opts.num = 1;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
const nextNum = Math.floor(opts.num / 2);
|
|
90
|
+
if (nextNum >= 1) {
|
|
91
|
+
this.logger.info(`halving batch size from ${opts.num} to ${nextNum}`);
|
|
92
|
+
opts.num = nextNum;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
83
96
|
}
|
|
84
97
|
maxRetries -= 1;
|
|
85
98
|
if (maxRetries >= 0) {
|
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.7.0';
|
|
40
40
|
// x-release-please-end
|
|
41
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseStrategy, BuildUpdatesOptions } from './base';
|
|
2
|
+
import { Update } from '../update';
|
|
3
|
+
import { GitHubFileContents } from '@google-automations/git-file-utils';
|
|
4
|
+
export declare class NodeLibrarian extends BaseStrategy {
|
|
5
|
+
private pkgJsonContents?;
|
|
6
|
+
protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
|
|
7
|
+
getDefaultPackageName(): Promise<string | undefined>;
|
|
8
|
+
protected normalizeComponent(component: string | undefined): string;
|
|
9
|
+
protected getPkgJsonContents(): Promise<GitHubFileContents>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
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.NodeLibrarian = void 0;
|
|
17
|
+
const base_1 = require("./base");
|
|
18
|
+
const changelog_json_1 = require("../updaters/changelog-json");
|
|
19
|
+
const package_lock_json_1 = require("../updaters/node/package-lock-json");
|
|
20
|
+
const samples_package_json_1 = require("../updaters/node/samples-package-json");
|
|
21
|
+
const changelog_1 = require("../updaters/changelog");
|
|
22
|
+
const package_json_1 = require("../updaters/node/package-json");
|
|
23
|
+
const librarian_yaml_1 = require("../updaters/node/librarian-yaml");
|
|
24
|
+
const errors_1 = require("../errors");
|
|
25
|
+
const filter_commits_1 = require("../util/filter-commits");
|
|
26
|
+
class NodeLibrarian extends base_1.BaseStrategy {
|
|
27
|
+
async buildUpdates(options) {
|
|
28
|
+
var _a;
|
|
29
|
+
const updates = [];
|
|
30
|
+
const version = options.newVersion;
|
|
31
|
+
const versionsMap = options.versionsMap;
|
|
32
|
+
const packageName = (_a = (await this.getPackageName())) !== null && _a !== void 0 ? _a : '';
|
|
33
|
+
const lockFiles = ['package-lock.json', 'npm-shrinkwrap.json'];
|
|
34
|
+
lockFiles.forEach(lockFile => {
|
|
35
|
+
updates.push({
|
|
36
|
+
path: this.addPath(lockFile),
|
|
37
|
+
createIfMissing: false,
|
|
38
|
+
updater: new package_lock_json_1.PackageLockJson({
|
|
39
|
+
version,
|
|
40
|
+
versionsMap,
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
updates.push({
|
|
45
|
+
path: this.addPath('samples/package.json'),
|
|
46
|
+
createIfMissing: false,
|
|
47
|
+
updater: new samples_package_json_1.SamplesPackageJson({
|
|
48
|
+
version,
|
|
49
|
+
packageName,
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
!this.skipChangelog &&
|
|
53
|
+
updates.push({
|
|
54
|
+
path: this.addPath(this.changelogPath),
|
|
55
|
+
createIfMissing: true,
|
|
56
|
+
updater: new changelog_1.Changelog({
|
|
57
|
+
version,
|
|
58
|
+
changelogEntry: options.changelogEntry,
|
|
59
|
+
}),
|
|
60
|
+
});
|
|
61
|
+
updates.push({
|
|
62
|
+
path: this.addPath('package.json'),
|
|
63
|
+
createIfMissing: false,
|
|
64
|
+
cachedFileContents: this.pkgJsonContents,
|
|
65
|
+
updater: new package_json_1.PackageJson({
|
|
66
|
+
version,
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
// If a machine readable changelog.json exists update it:
|
|
70
|
+
if (options.commits && packageName && !this.skipChangelog) {
|
|
71
|
+
const commits = (0, filter_commits_1.filterCommits)(options.commits, this.changelogSections);
|
|
72
|
+
updates.push({
|
|
73
|
+
path: 'changelog.json',
|
|
74
|
+
createIfMissing: false,
|
|
75
|
+
updater: new changelog_json_1.ChangelogJson({
|
|
76
|
+
artifactName: packageName,
|
|
77
|
+
version,
|
|
78
|
+
commits,
|
|
79
|
+
language: 'JAVASCRIPT',
|
|
80
|
+
}),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
// Update librarian.yaml if this package exists within it.
|
|
84
|
+
updates.push({
|
|
85
|
+
path: 'librarian.yaml',
|
|
86
|
+
createIfMissing: false,
|
|
87
|
+
updater: new librarian_yaml_1.LibrarianYamlUpdater({
|
|
88
|
+
version,
|
|
89
|
+
packagePath: this.path,
|
|
90
|
+
}),
|
|
91
|
+
});
|
|
92
|
+
return updates;
|
|
93
|
+
}
|
|
94
|
+
async getDefaultPackageName() {
|
|
95
|
+
const pkgJsonContents = await this.getPkgJsonContents();
|
|
96
|
+
const pkg = JSON.parse(pkgJsonContents.parsedContent);
|
|
97
|
+
return pkg.name;
|
|
98
|
+
}
|
|
99
|
+
normalizeComponent(component) {
|
|
100
|
+
if (!component) {
|
|
101
|
+
return '';
|
|
102
|
+
}
|
|
103
|
+
return component.match(/^@[\w-]+\//) ? component.split('/')[1] : component;
|
|
104
|
+
}
|
|
105
|
+
async getPkgJsonContents() {
|
|
106
|
+
if (!this.pkgJsonContents) {
|
|
107
|
+
try {
|
|
108
|
+
this.pkgJsonContents = await this.github.getFileContentsOnBranch(this.addPath('package.json'), this.targetBranch);
|
|
109
|
+
}
|
|
110
|
+
catch (e) {
|
|
111
|
+
if (e instanceof errors_1.FileNotFoundError) {
|
|
112
|
+
throw new errors_1.MissingRequiredFileError(this.addPath('package.json'), 'node', `${this.repository.owner}/${this.repository.repo}`);
|
|
113
|
+
}
|
|
114
|
+
throw e;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return this.pkgJsonContents;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.NodeLibrarian = NodeLibrarian;
|
|
121
|
+
//# sourceMappingURL=node-librarian.js.map
|
|
@@ -71,8 +71,8 @@ class LibrarianYamlUpdater extends default_1.DefaultUpdater {
|
|
|
71
71
|
if (artifact) {
|
|
72
72
|
return artifact;
|
|
73
73
|
}
|
|
74
|
-
if (library.java && library.java.
|
|
75
|
-
return library.java.
|
|
74
|
+
if (library.java && library.java.artifact_id) {
|
|
75
|
+
return library.java.artifact_id;
|
|
76
76
|
}
|
|
77
77
|
return `google-cloud-${library.name}`;
|
|
78
78
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DefaultUpdater, UpdateOptions } from '../default';
|
|
2
|
+
import { Logger } from '../../util/logger';
|
|
3
|
+
export interface LibrarianLibrary {
|
|
4
|
+
name: string;
|
|
5
|
+
output: string;
|
|
6
|
+
version: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
export interface LibrarianYamlSchema {
|
|
10
|
+
libraries: LibrarianLibrary[];
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
export interface LibrarianUpdateOptions extends UpdateOptions {
|
|
14
|
+
packagePath: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Updates a librarian.yaml file.
|
|
18
|
+
*/
|
|
19
|
+
export declare class LibrarianYamlUpdater extends DefaultUpdater {
|
|
20
|
+
private readonly packagePath;
|
|
21
|
+
constructor(options: LibrarianUpdateOptions);
|
|
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
|
+
deriveOutputDirectory(library: LibrarianLibrary): string;
|
|
29
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-please",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.7.0",
|
|
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",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"node": ">=20.0.0"
|
|
103
103
|
},
|
|
104
104
|
"overrides": {
|
|
105
|
-
"tmp": "0.2.
|
|
105
|
+
"tmp": "0.2.6",
|
|
106
106
|
"serialize-javascript": "^7.0.5"
|
|
107
107
|
}
|
|
108
108
|
}
|