release-please 16.12.0 → 16.12.2

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.
@@ -79,6 +79,6 @@ function replaceIssueLink(note, host, owner, repo) {
79
79
  return note;
80
80
  }
81
81
  function htmlEscape(message) {
82
- return message.replace('<', '&lt;').replace('>', '&gt;');
82
+ return message.replace(/``[^`].*[^`]``|`[^`]*`|<|>/g, match => match.length > 1 ? match : match === '<' ? '&lt;' : '&gt;');
83
83
  }
84
84
  //# sourceMappingURL=default.js.map
@@ -331,6 +331,7 @@ function parseConventionalCommits(commits, logger = logger_1.logger) {
331
331
  }
332
332
  catch (_err) {
333
333
  logger.debug(`commit could not be parsed: ${commit.sha} ${commit.message.split('\n')[0]}`);
334
+ logger.debug(`error message: ${_err}`);
334
335
  }
335
336
  }
336
337
  }
@@ -510,8 +510,8 @@ class GitHub {
510
510
  }
511
511
  }
512
512
  async mergeCommitsGraphQL(targetBranch, cursor, options = {}) {
513
- var _a, _b, _c, _d, _e, _f, _g;
514
- var _h;
513
+ var _a, _b, _c, _d, _e, _f, _g, _h;
514
+ var _j;
515
515
  this.logger.debug(`Fetching merge commits on branch ${targetBranch} with cursor: ${cursor}`);
516
516
  const query = `query pullRequestsSince($owner: String!, $repo: String!, $num: Int!, $maxFilesChanged: Int, $targetBranch: String!, $cursor: String) {
517
517
  repository(owner: $owner, name: $repo) {
@@ -589,7 +589,7 @@ class GitHub {
589
589
  for (const commit of commits) {
590
590
  for (const pr of commit.associatedPullRequests.nodes) {
591
591
  if ((_b = pr.mergeCommit) === null || _b === void 0 ? void 0 : _b.oid) {
592
- (_c = mergeCommitCount[_h = pr.mergeCommit.oid]) !== null && _c !== void 0 ? _c : (mergeCommitCount[_h] = 0);
592
+ (_c = mergeCommitCount[_j = pr.mergeCommit.oid]) !== null && _c !== void 0 ? _c : (mergeCommitCount[_j] = 0);
593
593
  mergeCommitCount[pr.mergeCommit.oid]++;
594
594
  }
595
595
  }
@@ -619,14 +619,15 @@ class GitHub {
619
619
  number: pullRequest.number,
620
620
  baseBranchName: pullRequest.baseRefName,
621
621
  headBranchName: pullRequest.headRefName,
622
+ mergeCommitOid: (_d = pullRequest.mergeCommit) === null || _d === void 0 ? void 0 : _d.oid,
622
623
  title: pullRequest.title,
623
624
  body: pullRequest.body,
624
625
  labels: pullRequest.labels.nodes.map(node => node.name),
625
- files: (((_d = pullRequest.files) === null || _d === void 0 ? void 0 : _d.nodes) || []).map(node => node.path),
626
+ files: (((_e = pullRequest.files) === null || _e === void 0 ? void 0 : _e.nodes) || []).map(node => node.path),
626
627
  };
627
628
  }
628
629
  if (mergePullRequest) {
629
- if (((_f = (_e = mergePullRequest.files) === null || _e === void 0 ? void 0 : _e.pageInfo) === null || _f === void 0 ? void 0 : _f.hasNextPage) &&
630
+ if (((_g = (_f = mergePullRequest.files) === null || _f === void 0 ? void 0 : _f.pageInfo) === null || _g === void 0 ? void 0 : _g.hasNextPage) &&
630
631
  options.backfillFiles) {
631
632
  this.logger.info(`PR #${mergePullRequest.number} has many files, backfilling`);
632
633
  commit.files = await this.getCommitFiles(graphCommit.sha);
@@ -634,7 +635,7 @@ class GitHub {
634
635
  else {
635
636
  // We cannot directly fetch files on commits via graphql, only provide file
636
637
  // information for commits with associated pull requests
637
- commit.files = (((_g = mergePullRequest.files) === null || _g === void 0 ? void 0 : _g.nodes) || []).map(node => node.path);
638
+ commit.files = (((_h = mergePullRequest.files) === null || _h === void 0 ? void 0 : _h.nodes) || []).map(node => node.path);
638
639
  }
639
640
  }
640
641
  else if (options.backfillFiles) {
@@ -14,4 +14,4 @@ export { Logger, setLogger } from './util/logger';
14
14
  export { GitHub } from './github';
15
15
  export declare const configSchema: any;
16
16
  export declare const manifestSchema: any;
17
- export declare const VERSION = "16.12.0";
17
+ export declare const VERSION = "16.12.2";
@@ -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.12.0';
39
+ exports.VERSION = '16.12.2';
40
40
  // x-release-please-end
41
41
  //# sourceMappingURL=index.js.map
@@ -69,7 +69,6 @@ export interface ReleaserConfig {
69
69
  releaseLabels?: string[];
70
70
  extraLabels?: string[];
71
71
  initialVersion?: string;
72
- signoff?: string;
73
72
  changelogSections?: ChangelogSection[];
74
73
  changelogPath?: string;
75
74
  changelogType?: ChangelogNotesType;
@@ -100,7 +99,6 @@ interface ReleaserConfigJson {
100
99
  'changelog-sections'?: ChangelogSection[];
101
100
  'release-as'?: string;
102
101
  'skip-github-release'?: boolean;
103
- signoff?: string;
104
102
  draft?: boolean;
105
103
  prerelease?: boolean;
106
104
  'draft-pull-request'?: boolean;
@@ -183,6 +181,7 @@ export interface ManifestConfig extends ReleaserConfigJson {
183
181
  'last-release-sha'?: string;
184
182
  'always-link-local'?: boolean;
185
183
  plugins?: PluginType[];
184
+ signoff?: string;
186
185
  'group-pull-request-title-pattern'?: string;
187
186
  'release-search-depth'?: number;
188
187
  'commit-search-depth'?: number;
@@ -321,7 +321,7 @@ class Manifest {
321
321
  const component = await strategy.getComponent();
322
322
  this.logger.info(`No latest release found for path: ${path}, component: ${component}, but a previous version (${version.toString()}) was specified in the manifest.`);
323
323
  releasesByPath[path] = {
324
- tag: new tag_name_1.TagName(version, component),
324
+ tag: new tag_name_1.TagName(version, component, this.repositoryConfig[path].tagSeparator, this.repositoryConfig[path].includeVInTag),
325
325
  sha: '',
326
326
  notes: '',
327
327
  };
@@ -710,7 +710,7 @@ class Manifest {
710
710
  const releaseList = githubReleases
711
711
  .map(({ tagName, url }) => `- [${tagName}](${url})`)
712
712
  .join('\n');
713
- const comment = `:robot: Created releases:\n${releaseList}\n:sunflower:`;
713
+ const comment = `🤖 Created releases:\n\n${releaseList}\n\n:sunflower:`;
714
714
  await this.github.commentOnIssue(comment, pullRequest.number);
715
715
  }
716
716
  if (error) {
@@ -826,7 +826,6 @@ function extractReleaserConfig(config) {
826
826
  skipSnapshot: config['skip-snapshot'],
827
827
  initialVersion: config['initial-version'],
828
828
  excludePaths: config['exclude-paths'],
829
- signoff: config['signoff'],
830
829
  };
831
830
  }
832
831
  /**
@@ -862,6 +861,7 @@ async function parseConfig(github, configFile, branch, onlyPath, releaseAs) {
862
861
  separatePullRequests: config['separate-pull-requests'],
863
862
  groupPullRequestTitlePattern: config['group-pull-request-title-pattern'],
864
863
  plugins: config['plugins'],
864
+ signoff: config['signoff'],
865
865
  labels: configLabel === null || configLabel === void 0 ? void 0 : configLabel.split(','),
866
866
  releaseLabels: configReleaseLabel === null || configReleaseLabel === void 0 ? void 0 : configReleaseLabel.split(','),
867
867
  snapshotLabels: configSnapshotLabel === null || configSnapshotLabel === void 0 ? void 0 : configSnapshotLabel.split(','),
@@ -968,7 +968,7 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, config,
968
968
  for await (const commitWithPullRequest of generator) {
969
969
  commitShas.add(commitWithPullRequest.sha);
970
970
  const mergedPullRequest = commitWithPullRequest.pullRequest;
971
- if (!mergedPullRequest) {
971
+ if (!(mergedPullRequest === null || mergedPullRequest === void 0 ? void 0 : mergedPullRequest.mergeCommitOid)) {
972
972
  logger.trace(`skipping commit: ${commitWithPullRequest.sha} missing merged pull request`);
973
973
  continue;
974
974
  }
@@ -2,6 +2,9 @@ import { CandidateReleasePullRequest } from '../manifest';
2
2
  import { WorkspacePlugin, DependencyGraph } from './workspace';
3
3
  import { CargoManifest } from '../updaters/rust/common';
4
4
  import { VersionsMap, Version } from '../version';
5
+ import { Strategy } from '../strategy';
6
+ import { Commit } from '../commit';
7
+ import { Release } from '../release';
5
8
  interface CrateInfo {
6
9
  /**
7
10
  * e.g. `crates/crate-a`
@@ -36,6 +39,8 @@ interface CrateInfo {
36
39
  * into a single rust package.
37
40
  */
38
41
  export declare class CargoWorkspace extends WorkspacePlugin<CrateInfo> {
42
+ private strategiesByPath;
43
+ private releasesByPath;
39
44
  protected buildAllPackages(candidates: CandidateReleasePullRequest[]): Promise<{
40
45
  allPackages: CrateInfo[];
41
46
  candidatesByPackage: Record<string, CandidateReleasePullRequest>;
@@ -48,5 +53,6 @@ export declare class CargoWorkspace extends WorkspacePlugin<CrateInfo> {
48
53
  protected inScope(candidate: CandidateReleasePullRequest): boolean;
49
54
  protected packageNameFromPackage(pkg: CrateInfo): string;
50
55
  protected pathFromPackage(pkg: CrateInfo): string;
56
+ preconfigure(strategiesByPath: Record<string, Strategy>, _commitsByPath: Record<string, Commit[]>, _releasesByPath: Record<string, Release>): Promise<Record<string, Strategy>>;
51
57
  }
52
58
  export {};
@@ -35,6 +35,11 @@ const errors_1 = require("../errors");
35
35
  * into a single rust package.
36
36
  */
37
37
  class CargoWorkspace extends workspace_1.WorkspacePlugin {
38
+ constructor() {
39
+ super(...arguments);
40
+ this.strategiesByPath = {};
41
+ this.releasesByPath = {};
42
+ }
38
43
  async buildAllPackages(candidates) {
39
44
  var _a, _b, _c, _d;
40
45
  const cargoManifestContent = await this.github.getFileContentsOnBranch('Cargo.toml', this.targetBranch);
@@ -143,6 +148,26 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin {
143
148
  const originalManifest = (0, common_1.parseCargoManifest)(pkg.manifestContent);
144
149
  const updatedManifest = (0, common_1.parseCargoManifest)(updatedContent);
145
150
  const dependencyNotes = getChangelogDepsNotes(originalManifest, updatedManifest);
151
+ const updatedPackage = {
152
+ ...pkg,
153
+ version: version.toString(),
154
+ };
155
+ const strategy = this.strategiesByPath[updatedPackage.path];
156
+ const latestRelease = this.releasesByPath[updatedPackage.path];
157
+ const basePullRequest = strategy
158
+ ? await strategy.buildReleasePullRequest([], latestRelease, false, [], {
159
+ newVersion: version,
160
+ })
161
+ : undefined;
162
+ if (basePullRequest) {
163
+ return this.updateCandidate({
164
+ path: pkg.path,
165
+ pullRequest: basePullRequest,
166
+ config: {
167
+ releaseType: 'rust',
168
+ },
169
+ }, pkg, updatedVersions);
170
+ }
146
171
  const pullRequest = {
147
172
  title: pull_request_title_1.PullRequestTitle.ofTargetBranch(this.targetBranch),
148
173
  body: new pull_request_body_1.PullRequestBody([
@@ -236,6 +261,12 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin {
236
261
  pathFromPackage(pkg) {
237
262
  return pkg.path;
238
263
  }
264
+ async preconfigure(strategiesByPath, _commitsByPath, _releasesByPath) {
265
+ // Using preconfigure to siphon releases and strategies.
266
+ this.strategiesByPath = strategiesByPath;
267
+ this.releasesByPath = _releasesByPath;
268
+ return strategiesByPath;
269
+ }
239
270
  }
240
271
  exports.CargoWorkspace = CargoWorkspace;
241
272
  function getChangelogDepsNotes(originalManifest, updatedManifest) {
@@ -21,9 +21,9 @@ const pull_request_body_1 = require("../util/pull-request-body");
21
21
  const branch_name_1 = require("../util/branch-name");
22
22
  const changelog_1 = require("../updaters/changelog");
23
23
  const workspace_1 = require("./workspace");
24
- const versioning_strategy_1 = require("../versioning-strategy");
25
24
  const composite_1 = require("../updaters/composite");
26
25
  const package_json_1 = require("../updaters/node/package-json");
26
+ const versioning_strategy_1 = require("../versioning-strategy");
27
27
  /**
28
28
  * The plugin analyzed a cargo workspace and will bump dependencies
29
29
  * of managed packages if those dependencies are being updated.
@@ -99,6 +99,9 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
99
99
  }
100
100
  bumpVersion(pkg) {
101
101
  const version = version_1.Version.parse(pkg.version);
102
+ const strategy = this.strategiesByPath[pkg.path];
103
+ if (strategy)
104
+ return strategy.versioningStrategy.bump(version, []);
102
105
  return new versioning_strategy_1.PatchVersionUpdate().bump(version);
103
106
  }
104
107
  updateCandidate(existingCandidate, pkg, updatedVersions) {
@@ -2,6 +2,7 @@ export interface PullRequest {
2
2
  readonly headBranchName: string;
3
3
  readonly baseBranchName: string;
4
4
  readonly number: number;
5
+ readonly mergeCommitOid?: string;
5
6
  readonly title: string;
6
7
  readonly body: string;
7
8
  readonly labels: string[];
@@ -71,7 +71,7 @@ class PHPYoshi extends base_1.BaseStrategy {
71
71
  const versionsMap = new Map();
72
72
  const directoryVersionContents = {};
73
73
  const component = await this.getComponent();
74
- const newVersionTag = new tag_name_1.TagName(newVersion, component);
74
+ const newVersionTag = new tag_name_1.TagName(newVersion, component, this.tagSeparator, this.includeVInTag);
75
75
  let releaseNotesBody = `## ${newVersion.toString()}`;
76
76
  for (const directory of topLevelDirectories) {
77
77
  try {
@@ -17,6 +17,7 @@ exports.GenericJson = void 0;
17
17
  const jp = require("jsonpath");
18
18
  const json_stringify_1 = require("../util/json-stringify");
19
19
  const logger_1 = require("../util/logger");
20
+ const VERSION_REGEX = /(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(-(?<preRelease>[\w.]+))?(\+(?<build>[-\w.]+))?/;
20
21
  class GenericJson {
21
22
  constructor(jsonpath, version) {
22
23
  this.jsonpath = jsonpath;
@@ -29,8 +30,16 @@ class GenericJson {
29
30
  */
30
31
  updateContent(content, logger = logger_1.logger) {
31
32
  const data = JSON.parse(content);
32
- const nodes = jp.apply(data, this.jsonpath, _val => {
33
- return this.version.toString();
33
+ const nodes = jp.apply(data, this.jsonpath, value => {
34
+ if (typeof value !== 'string') {
35
+ logger.warn(`No string in ${this.jsonpath}. Skipping.`);
36
+ return value;
37
+ }
38
+ if (!value.match(VERSION_REGEX)) {
39
+ logger.warn(`No version found in ${this.jsonpath}. Skipping.`);
40
+ return value;
41
+ }
42
+ return value.replace(VERSION_REGEX, this.version.toString());
34
43
  });
35
44
  if (!nodes) {
36
45
  logger.warn(`No entries modified in ${this.jsonpath}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "16.12.0",
3
+ "version": "16.12.2",
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",
@@ -55,14 +55,14 @@
55
55
  "@types/yargs": "^17.0.0",
56
56
  "ajv": "^8.11.0",
57
57
  "ajv-formats": "^3.0.0",
58
- "c8": "^9.0.0",
58
+ "c8": "^10.0.0",
59
59
  "chai": "^4.2.0",
60
60
  "config-chain": "^1.1.13",
61
61
  "cross-env": "^7.0.0",
62
62
  "gts": "^3.1.0",
63
63
  "mocha": "^9.2.2",
64
64
  "nock": "^13.0.0",
65
- "sinon": "18.0.0",
65
+ "sinon": "18.0.1",
66
66
  "snap-shot-it": "^7.0.0"
67
67
  },
68
68
  "dependencies": {
@@ -81,7 +81,7 @@
81
81
  "conventional-changelog-writer": "^6.0.0",
82
82
  "conventional-commits-filter": "^3.0.0",
83
83
  "detect-indent": "^6.1.0",
84
- "diff": "^5.0.0",
84
+ "diff": "^7.0.0",
85
85
  "figures": "^3.0.0",
86
86
  "http-proxy-agent": "^7.0.0",
87
87
  "https-proxy-agent": "^7.0.0",
@@ -188,6 +188,25 @@
188
188
  }
189
189
  },
190
190
  "required": ["type", "path"]
191
+ },
192
+ {
193
+ "description": "An extra arbitrary file that includes release-please generic updater's annotation.",
194
+ "type": "object",
195
+ "properties": {
196
+ "type": {
197
+ "description": "The file format type.",
198
+ "enum": ["generic"]
199
+ },
200
+ "path": {
201
+ "description": "The path to the file.",
202
+ "type": "string"
203
+ },
204
+ "glob": {
205
+ "description": "Whether to treat the path as a glob. Defaults to `false`.",
206
+ "type": "boolean"
207
+ }
208
+ },
209
+ "required": ["type", "path"]
191
210
  }
192
211
  ]
193
212
  }
@@ -377,6 +396,10 @@
377
396
  ]
378
397
  }
379
398
  },
399
+ "signoff": {
400
+ "description": "Text to be used as Signed-off-by in the commit.",
401
+ "type": "string"
402
+ },
380
403
  "group-pull-request-title-pattern": {
381
404
  "description": "When grouping multiple release pull requests use this pattern for the title.",
382
405
  "type": "string"
@@ -412,6 +435,7 @@
412
435
  "last-release-sha": true,
413
436
  "always-link-local": true,
414
437
  "plugins": true,
438
+ "signoff": true,
415
439
  "group-pull-request-title-pattern": true,
416
440
  "release-search-depth": true,
417
441
  "commit-search-depth": true,