release-please 16.6.0 → 16.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/index.d.ts +1 -1
- package/build/src/index.js +1 -1
- package/build/src/plugins/node-workspace.js +41 -1
- package/build/src/strategies/node.js +2 -0
- package/build/src/updaters/node/package-json.d.ts +20 -1
- package/build/src/updaters/node/package-json.js +4 -3
- package/build/src/updaters/node/package-lock-json.d.ts +7 -2
- package/build/src/updaters/node/package-lock-json.js +44 -5
- package/package.json +2 -2
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 = '16.
|
|
39
|
+
exports.VERSION = '16.7.0';
|
|
40
40
|
// x-release-please-end
|
|
41
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.NodeWorkspace = void 0;
|
|
17
|
+
const package_lock_json_1 = require("../updaters/node/package-lock-json");
|
|
17
18
|
const version_1 = require("../version");
|
|
18
19
|
const pull_request_title_1 = require("../util/pull-request-title");
|
|
19
20
|
const pull_request_body_1 = require("../util/pull-request-body");
|
|
@@ -120,6 +121,12 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
|
|
|
120
121
|
if (update.path === (0, workspace_1.addPath)(existingCandidate.path, 'package.json')) {
|
|
121
122
|
update.updater = new composite_1.CompositeUpdater(update.updater, updater);
|
|
122
123
|
}
|
|
124
|
+
else if (update.path === (0, workspace_1.addPath)(existingCandidate.path, 'package-lock.json')) {
|
|
125
|
+
update.updater = new package_lock_json_1.PackageLockJson({
|
|
126
|
+
version: newVersion,
|
|
127
|
+
versionsMap: updatedVersions,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
123
130
|
else if (update.updater instanceof changelog_1.Changelog) {
|
|
124
131
|
if (dependencyNotes) {
|
|
125
132
|
update.updater.changelogEntry =
|
|
@@ -189,6 +196,14 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
|
|
|
189
196
|
versionsMap: updatedVersions,
|
|
190
197
|
}),
|
|
191
198
|
},
|
|
199
|
+
{
|
|
200
|
+
path: (0, workspace_1.addPath)(updatedPackage.path, 'package-lock.json'),
|
|
201
|
+
createIfMissing: false,
|
|
202
|
+
updater: new package_json_1.PackageJson({
|
|
203
|
+
version: newVersion,
|
|
204
|
+
versionsMap: updatedVersions,
|
|
205
|
+
}),
|
|
206
|
+
},
|
|
192
207
|
{
|
|
193
208
|
path: (0, workspace_1.addPath)(updatedPackage.path, 'CHANGELOG.md'),
|
|
194
209
|
createIfMissing: false,
|
|
@@ -212,7 +227,32 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
|
|
|
212
227
|
};
|
|
213
228
|
}
|
|
214
229
|
postProcessCandidates(candidates, _updatedVersions) {
|
|
215
|
-
|
|
230
|
+
if (candidates.length === 0) {
|
|
231
|
+
return candidates;
|
|
232
|
+
}
|
|
233
|
+
const [candidate] = candidates;
|
|
234
|
+
// check for root lock file in pull request
|
|
235
|
+
let hasRootLockFile;
|
|
236
|
+
for (let i = 0; i < candidate.pullRequest.updates.length; i++) {
|
|
237
|
+
if (candidate.pullRequest.updates[i].path === '.package-lock.json' ||
|
|
238
|
+
candidate.pullRequest.updates[i].path === './package-lock.json' ||
|
|
239
|
+
candidate.pullRequest.updates[i].path === 'package-lock.json' ||
|
|
240
|
+
candidate.pullRequest.updates[i].path === '/package-lock.json') {
|
|
241
|
+
hasRootLockFile = true;
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// if there is a root lock file, then there is no additional pull request update necessary.
|
|
246
|
+
if (hasRootLockFile) {
|
|
247
|
+
return candidates;
|
|
248
|
+
}
|
|
249
|
+
candidate.pullRequest.updates.push({
|
|
250
|
+
path: 'package-lock.json',
|
|
251
|
+
createIfMissing: false,
|
|
252
|
+
updater: new package_lock_json_1.PackageLockJson({
|
|
253
|
+
versionsMap: _updatedVersions,
|
|
254
|
+
}),
|
|
255
|
+
});
|
|
216
256
|
return candidates;
|
|
217
257
|
}
|
|
218
258
|
async buildGraph(allPackages) {
|
|
@@ -27,6 +27,7 @@ class Node extends base_1.BaseStrategy {
|
|
|
27
27
|
var _a;
|
|
28
28
|
const updates = [];
|
|
29
29
|
const version = options.newVersion;
|
|
30
|
+
const versionsMap = options.versionsMap;
|
|
30
31
|
const packageName = (_a = (await this.getPackageName())) !== null && _a !== void 0 ? _a : '';
|
|
31
32
|
const lockFiles = ['package-lock.json', 'npm-shrinkwrap.json'];
|
|
32
33
|
lockFiles.forEach(lockFile => {
|
|
@@ -35,6 +36,7 @@ class Node extends base_1.BaseStrategy {
|
|
|
35
36
|
createIfMissing: false,
|
|
36
37
|
updater: new package_lock_json_1.PackageLockJson({
|
|
37
38
|
version,
|
|
39
|
+
versionsMap,
|
|
38
40
|
}),
|
|
39
41
|
});
|
|
40
42
|
});
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { Logger } from '../../util/logger';
|
|
2
|
+
import { Version, VersionsMap } from '../../version';
|
|
2
3
|
import { DefaultUpdater } from '../default';
|
|
3
|
-
|
|
4
|
+
export type PackageJsonDescriptor = {
|
|
5
|
+
name?: string;
|
|
6
|
+
resolved?: string;
|
|
7
|
+
link?: boolean;
|
|
8
|
+
version: string;
|
|
9
|
+
dependencies?: Record<string, string>;
|
|
10
|
+
devDependencies?: Record<string, string>;
|
|
11
|
+
peerDependencies?: Record<string, string>;
|
|
12
|
+
optionalDependencies?: Record<string, string>;
|
|
13
|
+
};
|
|
4
14
|
/**
|
|
5
15
|
* This updates a Node.js package.json file's main version.
|
|
6
16
|
*/
|
|
@@ -8,6 +18,7 @@ export declare class PackageJson extends DefaultUpdater {
|
|
|
8
18
|
/**
|
|
9
19
|
* Given initial file contents, return updated contents.
|
|
10
20
|
* @param {string} content The initial content
|
|
21
|
+
* @param logger
|
|
11
22
|
* @returns {string} The updated content
|
|
12
23
|
*/
|
|
13
24
|
updateContent(content: string, logger?: Logger): string;
|
|
@@ -19,3 +30,11 @@ export declare class PackageJson extends DefaultUpdater {
|
|
|
19
30
|
* @param {Version} newVersion The new version to update with
|
|
20
31
|
*/
|
|
21
32
|
export declare function newVersionWithRange(oldVersion: string, newVersion: Version): string;
|
|
33
|
+
/**
|
|
34
|
+
* Helper function to update dependency versions for all new versions specified
|
|
35
|
+
* in the updated versions map. Note that this mutates the existing input.
|
|
36
|
+
* @param {Record<string, string>} dependencies Entries in package.json dependencies
|
|
37
|
+
* where the key is the dependency name and the value is the dependency range
|
|
38
|
+
* @param {VersionsMap} updatedVersions Map of new versions (without dependency range prefixes)
|
|
39
|
+
*/
|
|
40
|
+
export declare function updateDependencies(dependencies: Record<string, string>, updatedVersions: VersionsMap): void;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// See the License for the specific language governing permissions and
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.newVersionWithRange = exports.PackageJson = void 0;
|
|
16
|
+
exports.updateDependencies = exports.newVersionWithRange = exports.PackageJson = void 0;
|
|
17
17
|
const json_stringify_1 = require("../../util/json-stringify");
|
|
18
18
|
const logger_1 = require("../../util/logger");
|
|
19
19
|
const default_1 = require("../default");
|
|
@@ -24,6 +24,7 @@ class PackageJson extends default_1.DefaultUpdater {
|
|
|
24
24
|
/**
|
|
25
25
|
* Given initial file contents, return updated contents.
|
|
26
26
|
* @param {string} content The initial content
|
|
27
|
+
* @param logger
|
|
27
28
|
* @returns {string} The updated content
|
|
28
29
|
*/
|
|
29
30
|
updateContent(content, logger = logger_1.logger) {
|
|
@@ -88,9 +89,9 @@ function updateDependencies(dependencies, updatedVersions) {
|
|
|
88
89
|
const newVersion = updatedVersions.get(depName);
|
|
89
90
|
if (newVersion) {
|
|
90
91
|
const oldVersion = dependencies[depName];
|
|
91
|
-
|
|
92
|
-
dependencies[depName] = newVersionString;
|
|
92
|
+
dependencies[depName] = newVersionWithRange(oldVersion, newVersion);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
exports.updateDependencies = updateDependencies;
|
|
96
97
|
//# sourceMappingURL=package-json.js.map
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { Updater } from '../../update';
|
|
1
2
|
import { Logger } from '../../util/logger';
|
|
2
|
-
import {
|
|
3
|
+
import { Version, VersionsMap } from '../../version';
|
|
4
|
+
import { UpdateOptions } from '../default';
|
|
3
5
|
/**
|
|
4
6
|
* Updates a Node.js package-lock.json file's version and '' package
|
|
5
7
|
* version (for a v2 lock file).
|
|
6
8
|
*/
|
|
7
|
-
export declare class PackageLockJson
|
|
9
|
+
export declare class PackageLockJson implements Updater {
|
|
10
|
+
version?: Version;
|
|
11
|
+
versionsMap?: VersionsMap;
|
|
12
|
+
constructor(options: Partial<UpdateOptions>);
|
|
8
13
|
updateContent(content: string, logger?: Logger): string;
|
|
9
14
|
}
|
|
@@ -16,21 +16,60 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.PackageLockJson = void 0;
|
|
17
17
|
const json_stringify_1 = require("../../util/json-stringify");
|
|
18
18
|
const logger_1 = require("../../util/logger");
|
|
19
|
-
const
|
|
19
|
+
const package_json_1 = require("./package-json");
|
|
20
20
|
/**
|
|
21
21
|
* Updates a Node.js package-lock.json file's version and '' package
|
|
22
22
|
* version (for a v2 lock file).
|
|
23
23
|
*/
|
|
24
|
-
class PackageLockJson
|
|
24
|
+
class PackageLockJson {
|
|
25
|
+
constructor(options) {
|
|
26
|
+
this.version = options.version;
|
|
27
|
+
this.versionsMap = options.versionsMap;
|
|
28
|
+
}
|
|
25
29
|
updateContent(content, logger = logger_1.logger) {
|
|
26
30
|
const parsed = JSON.parse(content);
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
if (this.version) {
|
|
32
|
+
logger.info(`updating from ${parsed.version} to ${this.version}`);
|
|
33
|
+
parsed.version = this.version.toString();
|
|
34
|
+
}
|
|
29
35
|
if (parsed.lockfileVersion === 2 || parsed.lockfileVersion === 3) {
|
|
30
|
-
|
|
36
|
+
if (this.version) {
|
|
37
|
+
parsed.packages[''].version = this.version.toString();
|
|
38
|
+
}
|
|
39
|
+
if (this.versionsMap) {
|
|
40
|
+
this.versionsMap.forEach((version, name) => {
|
|
41
|
+
let pkg = parsed.packages['node_modules/' + name];
|
|
42
|
+
if (!pkg) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
// @see https://docs.npmjs.com/cli/v10/configuring-npm/package-lock-json#packages
|
|
46
|
+
if (pkg.link && pkg.resolved) {
|
|
47
|
+
pkg = parsed.packages[pkg.resolved];
|
|
48
|
+
if (!pkg) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
pkg.version = version.toString();
|
|
53
|
+
if (pkg.dependencies) {
|
|
54
|
+
(0, package_json_1.updateDependencies)(pkg.dependencies, this.versionsMap);
|
|
55
|
+
}
|
|
56
|
+
if (pkg.devDependencies) {
|
|
57
|
+
(0, package_json_1.updateDependencies)(pkg.devDependencies, this.versionsMap);
|
|
58
|
+
}
|
|
59
|
+
if (pkg.peerDependencies) {
|
|
60
|
+
(0, package_json_1.updateDependencies)(pkg.peerDependencies, this.versionsMap);
|
|
61
|
+
}
|
|
62
|
+
if (pkg.optionalDependencies) {
|
|
63
|
+
(0, package_json_1.updateDependencies)(pkg.optionalDependencies, this.versionsMap);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
31
67
|
}
|
|
32
68
|
if (this.versionsMap) {
|
|
33
69
|
for (const [, obj] of Object.entries(parsed.packages)) {
|
|
70
|
+
if (!obj.name) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
34
73
|
const ver = this.versionsMap.get(obj.name);
|
|
35
74
|
if (ver) {
|
|
36
75
|
obj.version = ver.toString();
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-please",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.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",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "cross-env ENVIRONMENT=test LC_ALL=en c8 mocha --node-option no-experimental-fetch --recursive --timeout=5000 build/test",
|
|
9
9
|
"docs": "echo add docs tests",
|
|
10
|
-
"test:snap": "SNAPSHOT_UPDATE=1 LC_ALL=en npm test",
|
|
10
|
+
"test:snap": "cross-env SNAPSHOT_UPDATE=1 LC_ALL=en npm test",
|
|
11
11
|
"clean": "gts clean",
|
|
12
12
|
"prepare": "npm run compile",
|
|
13
13
|
"lint": "gts check",
|