release-please 15.13.0 → 16.1.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 CHANGED
@@ -4,6 +4,41 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ## [16.1.0](https://github.com/googleapis/release-please/compare/v16.0.0...v16.1.0) (2023-10-26)
8
+
9
+
10
+ ### Features
11
+
12
+ * Implement custom prerelease type ([#2083](https://github.com/googleapis/release-please/issues/2083)) ([97b0542](https://github.com/googleapis/release-please/commit/97b05421168316a23592897c8853893adf08d24c))
13
+ * Update package-lock.json workspace entry versions ([#2088](https://github.com/googleapis/release-please/issues/2088)) ([dbb11bc](https://github.com/googleapis/release-please/commit/dbb11bc62d6c8135b5b168354e8f235398ffab03)), closes [#1993](https://github.com/googleapis/release-please/issues/1993)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * Releasable units should use version from pull-request body ([#2102](https://github.com/googleapis/release-please/issues/2102)) ([db035b7](https://github.com/googleapis/release-please/commit/db035b798f33c5ce0ddf2a43dcf2458c170c8fe3)), closes [#2101](https://github.com/googleapis/release-please/issues/2101)
19
+
20
+ ## [16.0.0](https://github.com/googleapis/release-please/compare/v15.13.0...v16.0.0) (2023-09-18)
21
+
22
+
23
+ ### ⚠ BREAKING CHANGES
24
+
25
+ * require node 18+ ([#2069](https://github.com/googleapis/release-please/issues/2069))
26
+
27
+ ### Features
28
+
29
+ * Fallback to root package version if package ignores github release ([#1935](https://github.com/googleapis/release-please/issues/1935)) ([0e11d4c](https://github.com/googleapis/release-please/commit/0e11d4c019f1e33cd713a237e037f31397d5371a))
30
+ * Require node 18+ ([#2069](https://github.com/googleapis/release-please/issues/2069)) ([5a50247](https://github.com/googleapis/release-please/commit/5a5024727b93d0ba557b6f7ee5c6c1bab8d723d6))
31
+ * Support pnpm workspaces ([#2058](https://github.com/googleapis/release-please/issues/2058)) ([13cba14](https://github.com/googleapis/release-please/commit/13cba14225cb836c74199d726a996f83122fab07))
32
+ * Use default updaters based on file extension ([#2072](https://github.com/googleapis/release-please/issues/2072)) ([1ee162b](https://github.com/googleapis/release-please/commit/1ee162b3344e986afd09275f6762624e4a49faae))
33
+
34
+
35
+ ### Bug Fixes
36
+
37
+ * **deps:** Bump semver dependency version ([#2068](https://github.com/googleapis/release-please/issues/2068)) ([cd0bd85](https://github.com/googleapis/release-please/commit/cd0bd853ac23087e5d5348c22f032fe0e533451d))
38
+ * **deps:** Replace lerna dependency with lerna-lite ([13cba14](https://github.com/googleapis/release-please/commit/13cba14225cb836c74199d726a996f83122fab07))
39
+ * **deps:** Upgrade http-proxy-agent to v7 ([#2071](https://github.com/googleapis/release-please/issues/2071)) ([cc50a34](https://github.com/googleapis/release-please/commit/cc50a34dee16115c07e574b05552678108f9e0c3))
40
+ * **deps:** Upgrade https-proxy-agent to v7 ([cc50a34](https://github.com/googleapis/release-please/commit/cc50a34dee16115c07e574b05552678108f9e0c3))
41
+
7
42
  ## [15.13.0](https://github.com/googleapis/release-please/compare/v15.12.0...v15.13.0) (2023-08-18)
8
43
 
9
44
 
package/README.md CHANGED
@@ -139,7 +139,7 @@ recommend using squash-merge instead](#linear-git-commit-history-use-squash-merg
139
139
 
140
140
  ## Release Please bot does not create a release PR. Why?
141
141
 
142
- ### Releasable Units
142
+ ### Step 1: Ensure releasable units are merged
143
143
 
144
144
  Release Please creates a release pull request after it notices the default branch
145
145
  contains "releasable units" since the last release.
@@ -150,15 +150,15 @@ prefixes: "feat", "fix", and "deps".
150
150
  Some languages have their specific releasable unit configuration. For example,
151
151
  "docs" is a prefix for releasable units in Java and Python.
152
152
 
153
- ### Re-run Release Please
153
+ ### Step 2: Ensure no `autorelease: pending` or `autorelease: triggered` label in an old PR
154
154
 
155
- If you think Release Please missed creating a release PR after a pull request
156
- with a releasable unit has been merged, please re-run `release-please`. If you are using
157
- the GitHub application, add `release-please:force-run` label to the merged pull request. If
158
- you are using the action, look for the failed invocation and retry the workflow run.
159
- Release Please will process the pull request immediately to find releasable units.
160
-
161
- ### Existing Pull Requests with "autorelease: pending" label
155
+ Check existing pull requests labelled with `autorelease: pending` or
156
+ `autorelease: triggered` label.
157
+ Due to GitHub API failures, it's possible that the tag was not removed
158
+ correctly upon a previous release and Release Please thinks that the previous release is
159
+ still pending.
160
+ If you're certain that there's no pending release, remove the
161
+ `autorelease: pending` or `autorelease: triggered` label.
162
162
 
163
163
  For the GitHub application users, Release Please will not create a new pull request
164
164
  if there's an existing pull request labeled as `autorelease: pending`.
@@ -168,6 +168,14 @@ If you find a release pull request with the label and it is not going to be rele
168
168
  (or already released), then remove the `autorelease: pending` label and re-run Release
169
169
  Please.
170
170
 
171
+ ### Step 3: Rerun Release Please
172
+
173
+ If you think Release Please missed creating a release PR after a pull request
174
+ with a releasable unit has been merged, please re-run `release-please`. If you are using
175
+ the GitHub application, add `release-please:force-run` label to the merged pull request. If
176
+ you are using the action, look for the failed invocation and retry the workflow run.
177
+ Release Please will process the pull request immediately to find releasable units.
178
+
171
179
  ## Strategy (Language) types supported
172
180
 
173
181
  Release Please automates releases for the following flavors of repositories:
@@ -182,7 +190,7 @@ Release Please automates releases for the following flavors of repositories:
182
190
  | `krm-blueprint` | [A kpt package, with 1 or more KRM files and a CHANGELOG.md](https://github.com/GoogleCloudPlatform/blueprints/tree/main/catalog/project) |
183
191
  | `maven` | [Strategy for Maven projects, generates SNAPSHOT version after each release and updates `pom.xml` automatically](docs/java.md) |
184
192
  | `node` | [A Node.js repository, with a package.json and CHANGELOG.md](https://github.com/yargs/yargs) |
185
- | `expo` | [An Expo based React Native repository, with a package.json, app.json and CHANGELOG.md](https://github.com/yargs/yargs) |
193
+ | `expo` | An Expo based React Native repository, with a package.json, app.json and CHANGELOG.md |
186
194
  | `ocaml` | [An OCaml repository, containing 1 or more opam or esy files and a CHANGELOG.md](https://github.com/grain-lang/binaryen.ml) |
187
195
  | `php` | A repository with a composer.json and a CHANGELOG.md |
188
196
  | `python` | [A Python repository, with a setup.py, setup.cfg, CHANGELOG.md](https://github.com/googleapis/python-storage) and optionally a pyproject.toml and a <project>/\_\_init\_\_.py |
@@ -142,6 +142,10 @@ function pullRequestStrategyOptions(yargs) {
142
142
  ' changes prior to the first major release',
143
143
  default: false,
144
144
  type: 'boolean',
145
+ })
146
+ .option('prerelease-type', {
147
+ describe: 'type of the prerelease, e.g., alpha',
148
+ type: 'string',
145
149
  })
146
150
  .option('extra-files', {
147
151
  describe: 'extra files for the strategy to consider',
@@ -290,6 +294,7 @@ const createReleasePullRequestCommand = {
290
294
  draftPullRequest: argv.draftPullRequest,
291
295
  bumpMinorPreMajor: argv.bumpMinorPreMajor,
292
296
  bumpPatchForMinorPreMajor: argv.bumpPatchForMinorPreMajor,
297
+ prereleaseType: argv.prereleaseType,
293
298
  changelogPath: argv.changelogPath,
294
299
  changelogType: argv.changelogType,
295
300
  changelogHost: argv.changelogHost,
@@ -481,6 +486,7 @@ const bootstrapCommand = {
481
486
  draftPullRequest: argv.draftPullRequest,
482
487
  bumpMinorPreMajor: argv.bumpMinorPreMajor,
483
488
  bumpPatchForMinorPreMajor: argv.bumpPatchForMinorPreMajor,
489
+ prereleaseType: argv.prereleaseType,
484
490
  changelogPath: argv.changelogPath,
485
491
  changelogHost: argv.changelogHost,
486
492
  changelogSections: argv.changelogSections,
@@ -5,6 +5,7 @@ export interface VersioningStrategyFactoryOptions {
5
5
  type?: VersioningStrategyType;
6
6
  bumpMinorPreMajor?: boolean;
7
7
  bumpPatchForMinorPreMajor?: boolean;
8
+ prereleaseType?: string;
8
9
  github: GitHub;
9
10
  }
10
11
  export type VersioningStrategyBuilder = (options: VersioningStrategyFactoryOptions) => VersioningStrategy;
@@ -109,6 +109,7 @@ async function buildStrategy(options) {
109
109
  type: options.versioning,
110
110
  bumpMinorPreMajor: options.bumpMinorPreMajor,
111
111
  bumpPatchForMinorPreMajor: options.bumpPatchForMinorPreMajor,
112
+ prereleaseType: options.prereleaseType,
112
113
  });
113
114
  const changelogNotes = (0, changelog_notes_factory_1.buildChangelogNotes)({
114
115
  type: options.changelogType || 'default',
@@ -11,6 +11,8 @@ import { Update } from './update';
11
11
  import { Release } from './release';
12
12
  import { GitHubFileContents } from '@google-automations/git-file-utils';
13
13
  import { Logger } from 'code-suggester/build/src/types';
14
+ import { HttpsProxyAgent } from 'https-proxy-agent';
15
+ import { HttpProxyAgent } from 'http-proxy-agent';
14
16
  import { PullRequestOverflowHandler } from './util/pull-request-overflow-handler';
15
17
  type RequestBuilderType = typeof request;
16
18
  type DefaultFunctionType = RequestBuilderType['defaults'];
@@ -87,7 +89,7 @@ export declare class GitHub {
87
89
  private fileCache;
88
90
  private logger;
89
91
  private constructor();
90
- static createDefaultAgent(baseUrl: string, defaultProxy?: ProxyOption): import("https-proxy-agent/dist/agent").default | import("http-proxy-agent/dist/agent").default | undefined;
92
+ static createDefaultAgent(baseUrl: string, defaultProxy?: ProxyOption): HttpProxyAgent<`http://${string}:${number}`> | HttpsProxyAgent<`https://${string}:${number}`> | undefined;
91
93
  /**
92
94
  * Build a new GitHub client with auto-detected default branch.
93
95
  *
@@ -369,15 +369,12 @@ class GitHub {
369
369
  return undefined;
370
370
  }
371
371
  const { host, port } = defaultProxy;
372
- return new URL(baseUrl).protocol.replace(':', '') === 'http'
373
- ? new http_proxy_agent_1.HttpProxyAgent({
374
- host,
375
- port,
376
- })
377
- : new https_proxy_agent_1.HttpsProxyAgent({
378
- host,
379
- port,
380
- });
372
+ if (new URL(baseUrl).protocol.replace(':', '') === 'http') {
373
+ return new http_proxy_agent_1.HttpProxyAgent(`http://${host}:${port}`);
374
+ }
375
+ else {
376
+ return new https_proxy_agent_1.HttpsProxyAgent(`https://${host}:${port}`);
377
+ }
381
378
  }
382
379
  /**
383
380
  * Build a new GitHub client with auto-detected default branch.
@@ -45,6 +45,7 @@ export interface ReleaserConfig {
45
45
  versioning?: VersioningStrategyType;
46
46
  bumpMinorPreMajor?: boolean;
47
47
  bumpPatchForMinorPreMajor?: boolean;
48
+ prereleaseType?: string;
48
49
  releaseAs?: string;
49
50
  skipGithubRelease?: boolean;
50
51
  draft?: boolean;
@@ -88,6 +89,7 @@ interface ReleaserConfigJson {
88
89
  versioning?: VersioningStrategyType;
89
90
  'bump-minor-pre-major'?: boolean;
90
91
  'bump-patch-for-minor-pre-major'?: boolean;
92
+ 'prerelease-type'?: string;
91
93
  'changelog-sections'?: ChangelogSection[];
92
94
  'release-as'?: string;
93
95
  'skip-github-release'?: boolean;
@@ -405,6 +405,24 @@ class Manifest {
405
405
  notes: '',
406
406
  };
407
407
  }
408
+ else {
409
+ if (strategiesByPath[exports.ROOT_PROJECT_PATH] &&
410
+ this.repositoryConfig[path].skipGithubRelease) {
411
+ this.logger.debug('could not find release, checking root package');
412
+ const rootComponent = await strategiesByPath[exports.ROOT_PROJECT_PATH].getComponent();
413
+ const rootTag = new tag_name_1.TagName(expectedVersion, rootComponent, this.repositoryConfig[exports.ROOT_PROJECT_PATH].tagSeparator, this.repositoryConfig[exports.ROOT_PROJECT_PATH].includeVInTag);
414
+ const foundTag = allTags[rootTag.toString()];
415
+ if (foundTag) {
416
+ this.logger.debug(`found rootTag: ${foundTag.name} ${foundTag.sha}`);
417
+ releasesByPath[path] = {
418
+ name: foundTag.name,
419
+ tag: rootTag,
420
+ sha: foundTag.sha,
421
+ notes: '',
422
+ };
423
+ }
424
+ }
425
+ }
408
426
  }
409
427
  return releasesByPath;
410
428
  }
@@ -754,6 +772,7 @@ function extractReleaserConfig(config) {
754
772
  releaseType: config['release-type'],
755
773
  bumpMinorPreMajor: config['bump-minor-pre-major'],
756
774
  bumpPatchForMinorPreMajor: config['bump-patch-for-minor-pre-major'],
775
+ prereleaseType: config['prerelease-type'],
757
776
  versioning: config['versioning'],
758
777
  changelogSections: config['changelog-sections'],
759
778
  changelogPath: config['changelog-path'],
@@ -992,34 +1011,35 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, config,
992
1011
  return candidateTagVersion.sort((a, b) => b.compare(a))[0];
993
1012
  }
994
1013
  function mergeReleaserConfig(defaultConfig, pathConfig) {
995
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
1014
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
996
1015
  return {
997
1016
  releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node',
998
1017
  bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor,
999
1018
  bumpPatchForMinorPreMajor: (_d = pathConfig.bumpPatchForMinorPreMajor) !== null && _d !== void 0 ? _d : defaultConfig.bumpPatchForMinorPreMajor,
1000
- versioning: (_e = pathConfig.versioning) !== null && _e !== void 0 ? _e : defaultConfig.versioning,
1001
- changelogSections: (_f = pathConfig.changelogSections) !== null && _f !== void 0 ? _f : defaultConfig.changelogSections,
1002
- changelogPath: (_g = pathConfig.changelogPath) !== null && _g !== void 0 ? _g : defaultConfig.changelogPath,
1003
- changelogHost: (_h = pathConfig.changelogHost) !== null && _h !== void 0 ? _h : defaultConfig.changelogHost,
1004
- changelogType: (_j = pathConfig.changelogType) !== null && _j !== void 0 ? _j : defaultConfig.changelogType,
1005
- releaseAs: (_k = pathConfig.releaseAs) !== null && _k !== void 0 ? _k : defaultConfig.releaseAs,
1006
- skipGithubRelease: (_l = pathConfig.skipGithubRelease) !== null && _l !== void 0 ? _l : defaultConfig.skipGithubRelease,
1007
- draft: (_m = pathConfig.draft) !== null && _m !== void 0 ? _m : defaultConfig.draft,
1008
- prerelease: (_o = pathConfig.prerelease) !== null && _o !== void 0 ? _o : defaultConfig.prerelease,
1009
- component: (_p = pathConfig.component) !== null && _p !== void 0 ? _p : defaultConfig.component,
1010
- packageName: (_q = pathConfig.packageName) !== null && _q !== void 0 ? _q : defaultConfig.packageName,
1011
- versionFile: (_r = pathConfig.versionFile) !== null && _r !== void 0 ? _r : defaultConfig.versionFile,
1012
- extraFiles: (_s = pathConfig.extraFiles) !== null && _s !== void 0 ? _s : defaultConfig.extraFiles,
1013
- includeComponentInTag: (_t = pathConfig.includeComponentInTag) !== null && _t !== void 0 ? _t : defaultConfig.includeComponentInTag,
1014
- includeVInTag: (_u = pathConfig.includeVInTag) !== null && _u !== void 0 ? _u : defaultConfig.includeVInTag,
1015
- tagSeparator: (_v = pathConfig.tagSeparator) !== null && _v !== void 0 ? _v : defaultConfig.tagSeparator,
1016
- pullRequestTitlePattern: (_w = pathConfig.pullRequestTitlePattern) !== null && _w !== void 0 ? _w : defaultConfig.pullRequestTitlePattern,
1017
- pullRequestHeader: (_x = pathConfig.pullRequestHeader) !== null && _x !== void 0 ? _x : defaultConfig.pullRequestHeader,
1018
- separatePullRequests: (_y = pathConfig.separatePullRequests) !== null && _y !== void 0 ? _y : defaultConfig.separatePullRequests,
1019
- skipSnapshot: (_z = pathConfig.skipSnapshot) !== null && _z !== void 0 ? _z : defaultConfig.skipSnapshot,
1020
- initialVersion: (_0 = pathConfig.initialVersion) !== null && _0 !== void 0 ? _0 : defaultConfig.initialVersion,
1021
- extraLabels: (_1 = pathConfig.extraLabels) !== null && _1 !== void 0 ? _1 : defaultConfig.extraLabels,
1022
- excludePaths: (_2 = pathConfig.excludePaths) !== null && _2 !== void 0 ? _2 : defaultConfig.excludePaths,
1019
+ prereleaseType: (_e = pathConfig.prereleaseType) !== null && _e !== void 0 ? _e : defaultConfig.prereleaseType,
1020
+ versioning: (_f = pathConfig.versioning) !== null && _f !== void 0 ? _f : defaultConfig.versioning,
1021
+ changelogSections: (_g = pathConfig.changelogSections) !== null && _g !== void 0 ? _g : defaultConfig.changelogSections,
1022
+ changelogPath: (_h = pathConfig.changelogPath) !== null && _h !== void 0 ? _h : defaultConfig.changelogPath,
1023
+ changelogHost: (_j = pathConfig.changelogHost) !== null && _j !== void 0 ? _j : defaultConfig.changelogHost,
1024
+ changelogType: (_k = pathConfig.changelogType) !== null && _k !== void 0 ? _k : defaultConfig.changelogType,
1025
+ releaseAs: (_l = pathConfig.releaseAs) !== null && _l !== void 0 ? _l : defaultConfig.releaseAs,
1026
+ skipGithubRelease: (_m = pathConfig.skipGithubRelease) !== null && _m !== void 0 ? _m : defaultConfig.skipGithubRelease,
1027
+ draft: (_o = pathConfig.draft) !== null && _o !== void 0 ? _o : defaultConfig.draft,
1028
+ prerelease: (_p = pathConfig.prerelease) !== null && _p !== void 0 ? _p : defaultConfig.prerelease,
1029
+ component: (_q = pathConfig.component) !== null && _q !== void 0 ? _q : defaultConfig.component,
1030
+ packageName: (_r = pathConfig.packageName) !== null && _r !== void 0 ? _r : defaultConfig.packageName,
1031
+ versionFile: (_s = pathConfig.versionFile) !== null && _s !== void 0 ? _s : defaultConfig.versionFile,
1032
+ extraFiles: (_t = pathConfig.extraFiles) !== null && _t !== void 0 ? _t : defaultConfig.extraFiles,
1033
+ includeComponentInTag: (_u = pathConfig.includeComponentInTag) !== null && _u !== void 0 ? _u : defaultConfig.includeComponentInTag,
1034
+ includeVInTag: (_v = pathConfig.includeVInTag) !== null && _v !== void 0 ? _v : defaultConfig.includeVInTag,
1035
+ tagSeparator: (_w = pathConfig.tagSeparator) !== null && _w !== void 0 ? _w : defaultConfig.tagSeparator,
1036
+ pullRequestTitlePattern: (_x = pathConfig.pullRequestTitlePattern) !== null && _x !== void 0 ? _x : defaultConfig.pullRequestTitlePattern,
1037
+ pullRequestHeader: (_y = pathConfig.pullRequestHeader) !== null && _y !== void 0 ? _y : defaultConfig.pullRequestHeader,
1038
+ separatePullRequests: (_z = pathConfig.separatePullRequests) !== null && _z !== void 0 ? _z : defaultConfig.separatePullRequests,
1039
+ skipSnapshot: (_0 = pathConfig.skipSnapshot) !== null && _0 !== void 0 ? _0 : defaultConfig.skipSnapshot,
1040
+ initialVersion: (_1 = pathConfig.initialVersion) !== null && _1 !== void 0 ? _1 : defaultConfig.initialVersion,
1041
+ extraLabels: (_2 = pathConfig.extraLabels) !== null && _2 !== void 0 ? _2 : defaultConfig.extraLabels,
1042
+ excludePaths: (_3 = pathConfig.excludePaths) !== null && _3 !== void 0 ? _3 : defaultConfig.excludePaths,
1023
1043
  };
1024
1044
  }
1025
1045
  /**
@@ -1,4 +1,4 @@
1
- import { Package as LernaPackage, RawManifest as PackageJson } from '@lerna/package';
1
+ import { Package as LernaPackage, RawManifest as PackageJson } from '@lerna-lite/core';
2
2
  import { GitHub } from '../github';
3
3
  import { CandidateReleasePullRequest, RepositoryConfig } from '../manifest';
4
4
  import { Version, VersionsMap } from '../version';
@@ -14,8 +14,8 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.NodeWorkspace = void 0;
17
- const package_graph_1 = require("@lerna/package-graph");
18
- const package_1 = require("@lerna/package");
17
+ const core_1 = require("@lerna-lite/core");
18
+ const core_2 = require("@lerna-lite/core");
19
19
  const version_1 = require("../version");
20
20
  const raw_content_1 = require("../updaters/raw-content");
21
21
  const pull_request_title_1 = require("../util/pull-request-title");
@@ -25,7 +25,7 @@ const json_stringify_1 = require("../util/json-stringify");
25
25
  const changelog_1 = require("../updaters/changelog");
26
26
  const workspace_1 = require("./workspace");
27
27
  const versioning_strategy_1 = require("../versioning-strategy");
28
- class Package extends package_1.Package {
28
+ class Package extends core_2.Package {
29
29
  constructor(rawContent, location, pkg) {
30
30
  super(pkg !== null && pkg !== void 0 ? pkg : JSON.parse(rawContent), location);
31
31
  this.rawContent = rawContent;
@@ -83,7 +83,7 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
83
83
  }
84
84
  }
85
85
  const allPackages = Array.from(packagesByPath.values());
86
- this.packageGraph = new package_graph_1.PackageGraph(allPackages, 'allDependencies', this.alwaysLinkLocal);
86
+ this.packageGraph = new core_1.PackageGraph(allPackages, 'allDependencies', this.alwaysLinkLocal);
87
87
  return {
88
88
  allPackages,
89
89
  candidatesByPackage,
@@ -249,6 +249,36 @@ class BaseStrategy {
249
249
  }
250
250
  }
251
251
  }
252
+ else if (extraFile.endsWith('.json')) {
253
+ extraFileUpdates.push({
254
+ path: this.addPath(extraFile),
255
+ createIfMissing: false,
256
+ updater: new composite_1.CompositeUpdater(new generic_json_1.GenericJson('$.version', version), new generic_1.Generic({ version, versionsMap })),
257
+ });
258
+ }
259
+ else if (extraFile.endsWith('.yaml') || extraFile.endsWith('.yml')) {
260
+ extraFileUpdates.push({
261
+ path: this.addPath(extraFile),
262
+ createIfMissing: false,
263
+ updater: new composite_1.CompositeUpdater(new generic_yaml_1.GenericYaml('$.version', version), new generic_1.Generic({ version, versionsMap })),
264
+ });
265
+ }
266
+ else if (extraFile.endsWith('.toml')) {
267
+ extraFileUpdates.push({
268
+ path: this.addPath(extraFile),
269
+ createIfMissing: false,
270
+ updater: new composite_1.CompositeUpdater(new generic_toml_1.GenericToml('$.version', version), new generic_1.Generic({ version, versionsMap })),
271
+ });
272
+ }
273
+ else if (extraFile.endsWith('.xml')) {
274
+ extraFileUpdates.push({
275
+ path: this.addPath(extraFile),
276
+ createIfMissing: false,
277
+ updater: new composite_1.CompositeUpdater(
278
+ // Updates "version" element that is a child of the root element.
279
+ new generic_xml_1.GenericXml('/*/version', version), new generic_1.Generic({ version, versionsMap })),
280
+ });
281
+ }
252
282
  else {
253
283
  extraFileUpdates.push({
254
284
  path: this.addPath(extraFile),
@@ -354,7 +384,12 @@ class BaseStrategy {
354
384
  if (notes === undefined) {
355
385
  this.logger.warn('Failed to find release notes');
356
386
  }
357
- const version = pullRequestTitle.getVersion() || (releaseData === null || releaseData === void 0 ? void 0 : releaseData.version);
387
+ let version = pullRequestTitle.getVersion();
388
+ if (!version ||
389
+ (pullRequestBody.releaseData.length > 1 && (releaseData === null || releaseData === void 0 ? void 0 : releaseData.version))) {
390
+ // prioritize pull-request body version for multi-component releases
391
+ version = releaseData === null || releaseData === void 0 ? void 0 : releaseData.version;
392
+ }
358
393
  if (!version) {
359
394
  this.logger.error('Pull request should have included version');
360
395
  return;
@@ -29,6 +29,14 @@ class PackageLockJson extends default_1.DefaultUpdater {
29
29
  if (parsed.lockfileVersion === 2 || parsed.lockfileVersion === 3) {
30
30
  parsed.packages[''].version = this.version.toString();
31
31
  }
32
+ if (this.versionsMap) {
33
+ for (const [, obj] of Object.entries(parsed.packages)) {
34
+ const ver = this.versionsMap.get(obj.name);
35
+ if (ver) {
36
+ obj.version = ver.toString();
37
+ }
38
+ }
39
+ }
32
40
  return (0, json_stringify_1.jsonStringify)(parsed, content);
33
41
  }
34
42
  }
@@ -30,5 +30,6 @@ export declare class Version {
30
30
  * @returns {string}
31
31
  */
32
32
  toString(): string;
33
+ get isPreMajor(): boolean;
33
34
  }
34
35
  export type VersionsMap = Map<string, Version>;
@@ -66,6 +66,9 @@ class Version {
66
66
  const buildPart = this.build ? `+${this.build}` : '';
67
67
  return `${this.major}.${this.minor}.${this.patch}${preReleasePart}${buildPart}`;
68
68
  }
69
+ get isPreMajor() {
70
+ return this.major < 1;
71
+ }
69
72
  }
70
73
  exports.Version = Version;
71
74
  //# sourceMappingURL=version.js.map
@@ -2,7 +2,7 @@ import { VersioningStrategy, VersionUpdater } from '../versioning-strategy';
2
2
  import { ConventionalCommit } from '../commit';
3
3
  import { Version } from '../version';
4
4
  import { Logger } from '../util/logger';
5
- interface DefaultVersioningStrategyOptions {
5
+ export interface DefaultVersioningStrategyOptions {
6
6
  bumpMinorPreMajor?: boolean;
7
7
  bumpPatchForMinorPreMajor?: boolean;
8
8
  logger?: Logger;
@@ -46,4 +46,3 @@ export declare class DefaultVersioningStrategy implements VersioningStrategy {
46
46
  */
47
47
  bump(version: Version, commits: ConventionalCommit[]): Version;
48
48
  }
49
- export {};
@@ -66,7 +66,7 @@ class DefaultVersioningStrategy {
66
66
  }
67
67
  }
68
68
  if (breaking > 0) {
69
- if (version.major < 1 && this.bumpMinorPreMajor) {
69
+ if (version.isPreMajor && this.bumpMinorPreMajor) {
70
70
  return new versioning_strategy_1.MinorVersionUpdate();
71
71
  }
72
72
  else {
@@ -74,7 +74,7 @@ class DefaultVersioningStrategy {
74
74
  }
75
75
  }
76
76
  else if (features > 0) {
77
- if (version.major < 1 && this.bumpPatchForMinorPreMajor) {
77
+ if (version.isPreMajor && this.bumpPatchForMinorPreMajor) {
78
78
  return new versioning_strategy_1.PatchVersionUpdate();
79
79
  }
80
80
  else {
@@ -46,7 +46,7 @@ class DependencyManifest extends default_1.DefaultVersioningStrategy {
46
46
  }
47
47
  let dependencyBump;
48
48
  if (breaking > 0) {
49
- if (version.major < 1 && this.bumpMinorPreMajor) {
49
+ if (version.isPreMajor && this.bumpMinorPreMajor) {
50
50
  dependencyBump = new versioning_strategy_1.MinorVersionUpdate();
51
51
  }
52
52
  else {
@@ -54,7 +54,7 @@ class DependencyManifest extends default_1.DefaultVersioningStrategy {
54
54
  }
55
55
  }
56
56
  else if (features > 0) {
57
- if (version.major < 1 && this.bumpPatchForMinorPreMajor) {
57
+ if (version.isPreMajor && this.bumpPatchForMinorPreMajor) {
58
58
  dependencyBump = new versioning_strategy_1.PatchVersionUpdate();
59
59
  }
60
60
  else {
@@ -1,12 +1,18 @@
1
- import { DefaultVersioningStrategy } from './default';
1
+ import { DefaultVersioningStrategyOptions, DefaultVersioningStrategy } from './default';
2
2
  import { Version } from '../version';
3
3
  import { ConventionalCommit } from '..';
4
4
  import { VersionUpdater } from '../versioning-strategy';
5
+ interface PrereleaseVersioningStrategyOptions extends DefaultVersioningStrategyOptions {
6
+ prereleaseType?: string;
7
+ }
5
8
  /**
6
9
  * This versioning strategy will increment the pre-release number for patch
7
10
  * bumps if there is a pre-release number (preserving any leading 0s).
8
11
  * Example: 1.2.3-beta01 -> 1.2.3-beta02.
9
12
  */
10
13
  export declare class PrereleaseVersioningStrategy extends DefaultVersioningStrategy {
14
+ readonly prereleaseType?: string;
15
+ constructor(options?: PrereleaseVersioningStrategyOptions);
11
16
  determineReleaseType(version: Version, commits: ConventionalCommit[]): VersionUpdater;
12
17
  }
18
+ export {};
@@ -17,8 +17,39 @@ exports.PrereleaseVersioningStrategy = void 0;
17
17
  const default_1 = require("./default");
18
18
  const version_1 = require("../version");
19
19
  const versioning_strategy_1 = require("../versioning-strategy");
20
- const PRERELEASE_PATTERN = /^(?<type>[a-z]+)(?<number>\d+)$/;
21
- class PrereleasePatchVersionUpdate {
20
+ /**
21
+ * Regex to match the last set of numbers in a string
22
+ * Example: 1.2.3-beta01-01 -> 01
23
+ */
24
+ const PRERELEASE_NUMBER = /(?<number>\d+)(?=\D*$)/;
25
+ class AbstractPrereleaseVersionUpdate {
26
+ constructor(prereleaseType) {
27
+ this.prereleaseType = prereleaseType;
28
+ }
29
+ /**
30
+ * Returns the new bumped prerelease version
31
+ *
32
+ * That is, if the current version is 1.2.3-beta01, the next prerelease version
33
+ * will be 1.2.3-beta02. If no number is found, the prerelease version will be
34
+ * 1.2.3-beta. If multiple numbers are found, the last set of numbers will be
35
+ * incremented, e.g. 1.2.3-beta01-01 -> 1.2.3-beta01-02.
36
+ *
37
+ * @param {prerelease} string The current version
38
+ * @returns {Version} The bumped version
39
+ */
40
+ bumpPrerelease(prerelease) {
41
+ const match = prerelease.match(PRERELEASE_NUMBER);
42
+ let nextPrerelease = `${prerelease}.1`;
43
+ if (match === null || match === void 0 ? void 0 : match.groups) {
44
+ const numberLength = match.groups.number.length;
45
+ const nextPrereleaseNumber = Number(match.groups.number) + 1;
46
+ const paddedNextPrereleaseNumber = `${nextPrereleaseNumber}`.padStart(numberLength, '0');
47
+ nextPrerelease = prerelease.replace(PRERELEASE_NUMBER, paddedNextPrereleaseNumber);
48
+ }
49
+ return nextPrerelease;
50
+ }
51
+ }
52
+ class PrereleasePatchVersionUpdate extends AbstractPrereleaseVersionUpdate {
22
53
  /**
23
54
  * Returns the new bumped version
24
55
  *
@@ -27,19 +58,13 @@ class PrereleasePatchVersionUpdate {
27
58
  */
28
59
  bump(version) {
29
60
  if (version.preRelease) {
30
- const match = version.preRelease.match(PRERELEASE_PATTERN);
31
- if (match === null || match === void 0 ? void 0 : match.groups) {
32
- const numberLength = match.groups.number.length;
33
- const nextPrereleaseNumber = Number(match.groups.number) + 1;
34
- const paddedNextPrereleaseNumber = `${nextPrereleaseNumber}`.padStart(numberLength, '0');
35
- const nextPrerelease = `${match.groups.type}${paddedNextPrereleaseNumber}`;
36
- return new version_1.Version(version.major, version.minor, version.patch, nextPrerelease, version.build);
37
- }
61
+ const nextPrerelease = this.bumpPrerelease(version.preRelease);
62
+ return new version_1.Version(version.major, version.minor, version.patch, nextPrerelease, version.build);
38
63
  }
39
- return new version_1.Version(version.major, version.minor, version.patch + 1, version.preRelease, version.build);
64
+ return new version_1.Version(version.major, version.minor, version.patch + 1, this.prereleaseType, version.build);
40
65
  }
41
66
  }
42
- class PrereleaseMinorVersionUpdate {
67
+ class PrereleaseMinorVersionUpdate extends AbstractPrereleaseVersionUpdate {
43
68
  /**
44
69
  * Returns the new bumped version
45
70
  *
@@ -48,28 +73,16 @@ class PrereleaseMinorVersionUpdate {
48
73
  */
49
74
  bump(version) {
50
75
  if (version.preRelease) {
51
- const match = version.preRelease.match(PRERELEASE_PATTERN);
52
- if (match === null || match === void 0 ? void 0 : match.groups) {
53
- const numberLength = match.groups.number.length;
54
- const prereleaseNumber = Number(match.groups.number);
55
- let nextPrereleaseNumber = 1;
56
- let nextMinorNumber = version.minor + 1;
57
- let nextPatchNumber = 0;
58
- if (version.patch === 0) {
59
- // this is already the next minor candidate, then bump the pre-release number
60
- nextPrereleaseNumber = prereleaseNumber + 1;
61
- nextMinorNumber = version.minor;
62
- nextPatchNumber = version.patch;
63
- }
64
- const paddedNextPrereleaseNumber = `${nextPrereleaseNumber}`.padStart(numberLength, '0');
65
- const nextPrerelease = `${match.groups.type}${paddedNextPrereleaseNumber}`;
66
- return new version_1.Version(version.major, nextMinorNumber, nextPatchNumber, nextPrerelease, version.build);
76
+ if (version.patch === 0) {
77
+ const nextPrerelease = this.bumpPrerelease(version.preRelease);
78
+ return new version_1.Version(version.major, version.minor, version.patch, nextPrerelease, version.build);
67
79
  }
80
+ return new versioning_strategy_1.MinorVersionUpdate().bump(version);
68
81
  }
69
- return new version_1.Version(version.major, version.minor + 1, 0, version.preRelease, version.build);
82
+ return new version_1.Version(version.major, version.minor + 1, 0, this.prereleaseType, version.build);
70
83
  }
71
84
  }
72
- class PrereleaseMajorVersionUpdate {
85
+ class PrereleaseMajorVersionUpdate extends AbstractPrereleaseVersionUpdate {
73
86
  /**
74
87
  * Returns the new bumped version
75
88
  *
@@ -78,27 +91,13 @@ class PrereleaseMajorVersionUpdate {
78
91
  */
79
92
  bump(version) {
80
93
  if (version.preRelease) {
81
- const match = version.preRelease.match(PRERELEASE_PATTERN);
82
- if (match === null || match === void 0 ? void 0 : match.groups) {
83
- const numberLength = match.groups.number.length;
84
- const prereleaseNumber = Number(match.groups.number);
85
- let nextPrereleaseNumber = 1;
86
- let nextMajorNumber = version.major + 1;
87
- let nextMinorNumber = 0;
88
- let nextPatchNumber = 0;
89
- if (version.patch === 0 && version.minor === 0) {
90
- // this is already the next major candidate, then bump the pre-release number
91
- nextPrereleaseNumber = prereleaseNumber + 1;
92
- nextMajorNumber = version.major;
93
- nextMinorNumber = version.minor;
94
- nextPatchNumber = version.patch;
95
- }
96
- const paddedNextPrereleaseNumber = `${nextPrereleaseNumber}`.padStart(numberLength, '0');
97
- const nextPrerelease = `${match.groups.type}${paddedNextPrereleaseNumber}`;
98
- return new version_1.Version(nextMajorNumber, nextMinorNumber, nextPatchNumber, nextPrerelease, version.build);
94
+ if (version.patch === 0 && version.minor === 0) {
95
+ const nextPrerelease = this.bumpPrerelease(version.preRelease);
96
+ return new version_1.Version(version.major, version.minor, version.patch, nextPrerelease, version.build);
99
97
  }
98
+ return new versioning_strategy_1.MajorVersionUpdate().bump(version);
100
99
  }
101
- return new version_1.Version(version.major + 1, 0, 0, version.preRelease, version.build);
100
+ return new version_1.Version(version.major + 1, 0, 0, this.prereleaseType, version.build);
102
101
  }
103
102
  }
104
103
  /**
@@ -107,6 +106,10 @@ class PrereleaseMajorVersionUpdate {
107
106
  * Example: 1.2.3-beta01 -> 1.2.3-beta02.
108
107
  */
109
108
  class PrereleaseVersioningStrategy extends default_1.DefaultVersioningStrategy {
109
+ constructor(options = {}) {
110
+ super(options);
111
+ this.prereleaseType = options.prereleaseType;
112
+ }
110
113
  determineReleaseType(version, commits) {
111
114
  // iterate through list of commits and find biggest commit type
112
115
  let breaking = 0;
@@ -126,22 +129,22 @@ class PrereleaseVersioningStrategy extends default_1.DefaultVersioningStrategy {
126
129
  }
127
130
  }
128
131
  if (breaking > 0) {
129
- if (version.major < 1 && this.bumpMinorPreMajor) {
130
- return new PrereleaseMinorVersionUpdate();
132
+ if (version.isPreMajor && this.bumpMinorPreMajor) {
133
+ return new PrereleaseMinorVersionUpdate(this.prereleaseType);
131
134
  }
132
135
  else {
133
- return new PrereleaseMajorVersionUpdate();
136
+ return new PrereleaseMajorVersionUpdate(this.prereleaseType);
134
137
  }
135
138
  }
136
139
  else if (features > 0) {
137
- if (version.major < 1 && this.bumpPatchForMinorPreMajor) {
138
- return new PrereleasePatchVersionUpdate();
140
+ if (version.isPreMajor && this.bumpPatchForMinorPreMajor) {
141
+ return new PrereleasePatchVersionUpdate(this.prereleaseType);
139
142
  }
140
143
  else {
141
- return new PrereleaseMinorVersionUpdate();
144
+ return new PrereleaseMinorVersionUpdate(this.prereleaseType);
142
145
  }
143
146
  }
144
- return new PrereleasePatchVersionUpdate();
147
+ return new PrereleasePatchVersionUpdate(this.prereleaseType);
145
148
  }
146
149
  }
147
150
  exports.PrereleaseVersioningStrategy = PrereleaseVersioningStrategy;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "15.13.0",
3
+ "version": "16.1.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
- "test": "cross-env ENVIRONMENT=test LC_ALL=en c8 mocha --recursive --timeout=5000 build/test",
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
10
  "test:snap": "SNAPSHOT_UPDATE=1 LC_ALL=en npm test",
11
11
  "clean": "gts clean",
@@ -42,14 +42,12 @@
42
42
  "@types/chai": "^4.1.7",
43
43
  "@types/diff": "^5.0.2",
44
44
  "@types/iarna__toml": "^2.0.1",
45
+ "@types/inquirer": "^9.0.3",
45
46
  "@types/js-yaml": "^4.0.0",
46
47
  "@types/jsonpath": "^0.2.0",
47
- "@types/lerna__collect-updates": "^5.1.0",
48
- "@types/lerna__package": "^5.1.0",
49
- "@types/lerna__package-graph": "^5.1.0",
50
- "@types/lerna__run-topologically": "^5.1.0",
51
48
  "@types/mocha": "^9.0.0",
52
49
  "@types/node": "^18.0.0",
50
+ "@types/npmlog": "^4.1.4",
53
51
  "@types/pino": "^7.0.0",
54
52
  "@types/semver": "^7.0.0",
55
53
  "@types/sinon": "^10.0.0",
@@ -59,21 +57,19 @@
59
57
  "ajv-formats": "^2.1.1",
60
58
  "c8": "^8.0.0",
61
59
  "chai": "^4.2.0",
60
+ "config-chain": "^1.1.13",
62
61
  "cross-env": "^7.0.0",
63
62
  "gts": "^3.1.0",
64
63
  "mocha": "^9.2.2",
65
64
  "nock": "^13.0.0",
66
- "sinon": "15.2.0",
65
+ "sinon": "16.0.0",
67
66
  "snap-shot-it": "^7.0.0"
68
67
  },
69
68
  "dependencies": {
70
69
  "@conventional-commits/parser": "^0.4.1",
71
70
  "@google-automations/git-file-utils": "^1.2.5",
72
71
  "@iarna/toml": "^3.0.0",
73
- "@lerna/collect-updates": "^6.4.1",
74
- "@lerna/package": "^6.4.1",
75
- "@lerna/package-graph": "^6.4.1",
76
- "@lerna/run-topologically": "^6.4.1",
72
+ "@lerna-lite/core": "1.17.0",
77
73
  "@octokit/graphql": "^5.0.0",
78
74
  "@octokit/request": "^6.0.0",
79
75
  "@octokit/request-error": "^3.0.0",
@@ -88,13 +84,13 @@
88
84
  "detect-indent": "^6.1.0",
89
85
  "diff": "^5.0.0",
90
86
  "figures": "^3.0.0",
91
- "http-proxy-agent": "^5.0.0",
92
- "https-proxy-agent": "^5.0.1",
87
+ "http-proxy-agent": "^7.0.0",
88
+ "https-proxy-agent": "^7.0.0",
93
89
  "js-yaml": "^4.0.0",
94
90
  "jsonpath": "^1.1.1",
95
91
  "node-html-parser": "^6.0.0",
96
92
  "parse-github-repo-url": "^1.4.1",
97
- "semver": "^7.0.0",
93
+ "semver": "^7.5.3",
98
94
  "type-fest": "^3.0.0",
99
95
  "typescript": "^4.6.4",
100
96
  "unist-util-visit": "^2.0.3",
@@ -104,6 +100,6 @@
104
100
  "yargs": "^17.0.0"
105
101
  },
106
102
  "engines": {
107
- "node": ">=14.0.0"
103
+ "node": ">=18.0.0"
108
104
  }
109
105
  }
@@ -20,6 +20,10 @@
20
20
  "description": "Feature changes only bump semver patch if version < 1.0.0",
21
21
  "type": "boolean"
22
22
  },
23
+ "prerelease-type": {
24
+ "description": "Configuration option for the prerelese versioning strategy. If prerelease strategy used and type set, will set the prerelese part of the version to the provided value in case prerelease part is not present.",
25
+ "type": "string"
26
+ },
23
27
  "versioning": {
24
28
  "description": "Versioning strategy. Defaults to `default`",
25
29
  "type": "string"
@@ -290,7 +294,11 @@
290
294
  "type": {
291
295
  "description": "The name of the plugin.",
292
296
  "type": "string",
293
- "enum": ["cargo-workspace", "maven-workspace", "node-workspace"]
297
+ "enum": [
298
+ "cargo-workspace",
299
+ "maven-workspace",
300
+ "node-workspace"
301
+ ]
294
302
  },
295
303
  "updateAllPackages": {
296
304
  "description": "Whether to force updating all packages regardless of the dependency tree. Defaults to `false`.",