release-please 16.11.0 → 16.12.1

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
@@ -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.11.0";
17
+ export declare const VERSION = "16.12.1";
@@ -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.11.0';
39
+ exports.VERSION = '16.12.1';
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
  };
@@ -687,7 +687,11 @@ class Manifest {
687
687
  this.logger.info(`Creating ${releases.length} releases for pull #${pullRequest.number}`);
688
688
  const duplicateReleases = [];
689
689
  const githubReleases = [];
690
+ let error;
690
691
  for (const release of releases) {
692
+ // stop releasing once we hit an error
693
+ if (error)
694
+ continue;
691
695
  try {
692
696
  githubReleases.push(await this.createRelease(release));
693
697
  }
@@ -697,10 +701,21 @@ class Manifest {
697
701
  duplicateReleases.push(err);
698
702
  }
699
703
  else {
700
- throw err;
704
+ error = err;
701
705
  }
702
706
  }
703
707
  }
708
+ if (githubReleases.length > 0) {
709
+ // comment on pull request about the successful releases
710
+ const releaseList = githubReleases
711
+ .map(({ tagName, url }) => `- [${tagName}](${url})`)
712
+ .join('\n');
713
+ const comment = `🤖 Created releases:\n\n${releaseList}\n\n:sunflower:`;
714
+ await this.github.commentOnIssue(comment, pullRequest.number);
715
+ }
716
+ if (error) {
717
+ throw error;
718
+ }
704
719
  if (duplicateReleases.length > 0) {
705
720
  if (duplicateReleases.length + githubReleases.length ===
706
721
  releases.length) {
@@ -726,9 +741,6 @@ class Manifest {
726
741
  draft: release.draft,
727
742
  prerelease: release.prerelease,
728
743
  });
729
- // comment on pull request
730
- const comment = `:robot: Release is at ${githubRelease.url} :sunflower:`;
731
- await this.github.commentOnIssue(comment, release.pullRequest.number);
732
744
  return {
733
745
  ...githubRelease,
734
746
  path: release.path,
@@ -814,7 +826,6 @@ function extractReleaserConfig(config) {
814
826
  skipSnapshot: config['skip-snapshot'],
815
827
  initialVersion: config['initial-version'],
816
828
  excludePaths: config['exclude-paths'],
817
- signoff: config['signoff'],
818
829
  };
819
830
  }
820
831
  /**
@@ -850,6 +861,7 @@ async function parseConfig(github, configFile, branch, onlyPath, releaseAs) {
850
861
  separatePullRequests: config['separate-pull-requests'],
851
862
  groupPullRequestTitlePattern: config['group-pull-request-title-pattern'],
852
863
  plugins: config['plugins'],
864
+ signoff: config['signoff'],
853
865
  labels: configLabel === null || configLabel === void 0 ? void 0 : configLabel.split(','),
854
866
  releaseLabels: configReleaseLabel === null || configReleaseLabel === void 0 ? void 0 : configReleaseLabel.split(','),
855
867
  snapshotLabels: configSnapshotLabel === null || configSnapshotLabel === void 0 ? void 0 : configSnapshotLabel.split(','),
@@ -956,7 +968,7 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, config,
956
968
  for await (const commitWithPullRequest of generator) {
957
969
  commitShas.add(commitWithPullRequest.sha);
958
970
  const mergedPullRequest = commitWithPullRequest.pullRequest;
959
- if (!mergedPullRequest) {
971
+ if (!(mergedPullRequest === null || mergedPullRequest === void 0 ? void 0 : mergedPullRequest.mergeCommitOid)) {
960
972
  logger.trace(`skipping commit: ${commitWithPullRequest.sha} missing merged pull request`);
961
973
  continue;
962
974
  }
@@ -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}`);
@@ -35,6 +35,7 @@ export declare class PackageJson extends DefaultUpdater {
35
35
  * @param {Version} newVersion The new version to update with
36
36
  */
37
37
  export declare function newVersionWithRange(oldVersion: string, newVersion: Version): string;
38
+ export declare const NPM_PROTOCOL_REGEXP: RegExp;
38
39
  /**
39
40
  * Helper function to update dependency versions for all new versions specified
40
41
  * in the updated versions map. Note that this mutates the existing input.
@@ -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.updateDependencies = exports.newVersionWithRange = exports.PackageJson = void 0;
16
+ exports.updateDependencies = exports.NPM_PROTOCOL_REGEXP = 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");
@@ -82,6 +82,7 @@ function newVersionWithRange(oldVersion, newVersion) {
82
82
  return newVersion.toString();
83
83
  }
84
84
  exports.newVersionWithRange = newVersionWithRange;
85
+ exports.NPM_PROTOCOL_REGEXP = /^[a-z]+:/;
85
86
  /**
86
87
  * Helper function to update dependency versions for all new versions specified
87
88
  * in the updated versions map. Note that this mutates the existing input.
@@ -91,9 +92,12 @@ exports.newVersionWithRange = newVersionWithRange;
91
92
  */
92
93
  function updateDependencies(dependencies, updatedVersions) {
93
94
  for (const depName of Object.keys(dependencies)) {
95
+ const oldVersion = dependencies[depName];
96
+ if (exports.NPM_PROTOCOL_REGEXP.test(oldVersion)) {
97
+ continue;
98
+ }
94
99
  const newVersion = updatedVersions.get(depName);
95
100
  if (newVersion) {
96
- const oldVersion = dependencies[depName];
97
101
  dependencies[depName] = newVersionWithRange(oldVersion, newVersion);
98
102
  }
99
103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "16.11.0",
3
+ "version": "16.12.1",
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,7 +55,7 @@
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",
@@ -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,