release-please 16.1.0 → 16.3.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.
@@ -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.PackageJson = void 0;
16
+ 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");
@@ -30,8 +30,67 @@ class PackageJson extends default_1.DefaultUpdater {
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
+ // If additional dependency versions specified, then update dependency versions
34
+ // while preserving any valid version range prefixes.
35
+ if (this.versionsMap) {
36
+ if (parsed.dependencies) {
37
+ updateDependencies(parsed.dependencies, this.versionsMap);
38
+ }
39
+ if (parsed.devDependencies) {
40
+ updateDependencies(parsed.devDependencies, this.versionsMap);
41
+ }
42
+ if (parsed.peerDependencies) {
43
+ updateDependencies(parsed.peerDependencies, this.versionsMap);
44
+ }
45
+ if (parsed.optionalDependencies) {
46
+ updateDependencies(parsed.optionalDependencies, this.versionsMap);
47
+ }
48
+ }
33
49
  return (0, json_stringify_1.jsonStringify)(parsed, content);
34
50
  }
35
51
  }
36
52
  exports.PackageJson = PackageJson;
53
+ var SUPPORTED_RANGE_PREFIXES;
54
+ (function (SUPPORTED_RANGE_PREFIXES) {
55
+ SUPPORTED_RANGE_PREFIXES["CARET"] = "^";
56
+ SUPPORTED_RANGE_PREFIXES["TILDE"] = "~";
57
+ SUPPORTED_RANGE_PREFIXES["GREATER_THAN"] = ">";
58
+ SUPPORTED_RANGE_PREFIXES["LESS_THAN"] = "<";
59
+ SUPPORTED_RANGE_PREFIXES["EQUAL_OR_GREATER_THAN"] = ">=";
60
+ SUPPORTED_RANGE_PREFIXES["EQUAL_OR_LESS_THAN"] = "<=";
61
+ })(SUPPORTED_RANGE_PREFIXES || (SUPPORTED_RANGE_PREFIXES = {}));
62
+ function detectRangePrefix(version) {
63
+ return (Object.values(SUPPORTED_RANGE_PREFIXES).find(supportedRangePrefix => version.startsWith(supportedRangePrefix)) || '');
64
+ }
65
+ /**
66
+ * Helper to coerce a new version value into a version range that preserves the
67
+ * version range prefix of the original version.
68
+ * @param {string} oldVersion Old semver with range
69
+ * @param {Version} newVersion The new version to update with
70
+ */
71
+ function newVersionWithRange(oldVersion, newVersion) {
72
+ const prefix = detectRangePrefix(oldVersion);
73
+ if (prefix) {
74
+ return `${prefix}${newVersion}`;
75
+ }
76
+ return newVersion.toString();
77
+ }
78
+ exports.newVersionWithRange = newVersionWithRange;
79
+ /**
80
+ * Helper function to update dependency versions for all new versions specified
81
+ * in the updated versions map. Note that this mutates the existing input.
82
+ * @param {Record<string, string>} dependencies Entries in package.json dependencies
83
+ * where the key is the dependency name and the value is the dependency range
84
+ * @param {VersionsMap} updatedVersions Map of new versions (without dependency range prefixes)
85
+ */
86
+ function updateDependencies(dependencies, updatedVersions) {
87
+ for (const depName of Object.keys(dependencies)) {
88
+ const newVersion = updatedVersions.get(depName);
89
+ if (newVersion) {
90
+ const oldVersion = dependencies[depName];
91
+ const newVersionString = newVersionWithRange(oldVersion, newVersion);
92
+ dependencies[depName] = newVersionString;
93
+ }
94
+ }
95
+ }
37
96
  //# sourceMappingURL=package-json.js.map
@@ -64,6 +64,7 @@ function releaserConfigToJsonConfig(config) {
64
64
  'changelog-host': config.changelogHost,
65
65
  'pull-request-title-pattern': config.pullRequestTitlePattern,
66
66
  'pull-request-header': config.pullRequestHeader,
67
+ 'pull-request-footer': config.pullRequestFooter,
67
68
  'separate-pull-requests': config.separatePullRequests,
68
69
  'tag-separator': config.tagSeparator,
69
70
  'extra-files': config.extraFiles,
@@ -127,7 +127,7 @@ function extractMultipleReleases(notes, logger) {
127
127
  }
128
128
  return data;
129
129
  }
130
- const COMPARE_REGEX = /^#{2,} \[?(?<version>\d+\.\d+\.\d+.*)\]?/;
130
+ const COMPARE_REGEX = /^#{2,} \[?(?<version>\d+\.\d+\.\d+[^\]]*)\]?/;
131
131
  function extractSingleRelease(body, logger) {
132
132
  var _a;
133
133
  body = body.trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "16.1.0",
3
+ "version": "16.3.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",
@@ -69,7 +69,6 @@
69
69
  "@conventional-commits/parser": "^0.4.1",
70
70
  "@google-automations/git-file-utils": "^1.2.5",
71
71
  "@iarna/toml": "^3.0.0",
72
- "@lerna-lite/core": "1.17.0",
73
72
  "@octokit/graphql": "^5.0.0",
74
73
  "@octokit/request": "^6.0.0",
75
74
  "@octokit/request-error": "^3.0.0",
@@ -103,6 +103,10 @@
103
103
  "description": "Customize the release pull request header.",
104
104
  "type": "string"
105
105
  },
106
+ "pull-request-footer": {
107
+ "description": "Customize the release pull request footer.",
108
+ "type": "string"
109
+ },
106
110
  "separate-pull-requests": {
107
111
  "description": "Open a separate release pull request for each component. Defaults to `false`.",
108
112
  "type": "boolean"
@@ -404,6 +408,7 @@
404
408
  "changelog-path": true,
405
409
  "pull-request-title-pattern": true,
406
410
  "pull-request-header": true,
411
+ "pull-request-footer": true,
407
412
  "separate-pull-requests": true,
408
413
  "tag-separator": true,
409
414
  "extra-files": true,