npm-update-package 0.48.4 → 0.49.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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-update-package",
3
- "version": "0.48.4",
3
+ "version": "0.49.0",
4
4
  "description": "CLI tool for creating pull requests to update npm packages",
5
5
  "scripts": {
6
6
  "build": "tsc --project tsconfig.build.json",
@@ -53,9 +53,9 @@
53
53
  "lint-staged": "12.3.7",
54
54
  "npm-run-all": "4.1.5",
55
55
  "rimraf": "3.0.2",
56
- "ts-jest": "27.1.3",
56
+ "ts-jest": "27.1.4",
57
57
  "ts-node": "10.7.0",
58
- "typescript": "4.6.2",
58
+ "typescript": "4.6.3",
59
59
  "utility-types": "3.10.0"
60
60
  },
61
61
  "repository": {
@@ -10,6 +10,7 @@ const json_1 = require("../../../json");
10
10
  const package_json_2 = require("../../../package-json");
11
11
  const metadata_1 = require("../metadata");
12
12
  const optimizeGitHubUrl_1 = require("./optimizeGitHubUrl");
13
+ // TODO: Split into multiple classes and functions
13
14
  class PullRequestBodyCreator {
14
15
  constructor({ options, releasesFetcher }) {
15
16
  this.options = options;
@@ -19,9 +20,12 @@ class PullRequestBodyCreator {
19
20
  const sections = [];
20
21
  const outdatedPackagesTable = this.createOutdatedPackagesTable(outdatedPackage);
21
22
  sections.push(`This PR updates these packages:\n\n${outdatedPackagesTable}`);
22
- const diffSection = this.createDiffSection(outdatedPackage);
23
- sections.push(diffSection);
24
23
  const gitRepo = await this.extractRepository(outdatedPackage);
24
+ const diffSection = this.createDiffSection({
25
+ outdatedPackage,
26
+ gitRepo
27
+ });
28
+ sections.push(diffSection);
25
29
  if ((gitRepo === null || gitRepo === void 0 ? void 0 : gitRepo.isGitHub) === true) {
26
30
  const releaseNotesSection = await this.createReleaseNotesSection({
27
31
  outdatedPackage,
@@ -41,14 +45,19 @@ class PullRequestBodyCreator {
41
45
  sections.push(`---\n${footer}`);
42
46
  return sections.join('\n\n');
43
47
  }
44
- createDiffSection(outdatedPackage) {
48
+ createDiffSection({ outdatedPackage, gitRepo }) {
45
49
  const packageName = outdatedPackage.name;
46
50
  const currentVersion = outdatedPackage.currentVersion.version;
47
51
  const newVersion = outdatedPackage.newVersion.version;
52
+ const links = [];
53
+ if ((gitRepo === null || gitRepo === void 0 ? void 0 : gitRepo.isGitHub) === true) {
54
+ links.push(`- [GitHub](${gitRepo.url.toString()}/compare/v${currentVersion}...v${newVersion})`);
55
+ }
56
+ links.push(`- [npmfs](https://npmfs.com/compare/${packageName}/${currentVersion}/${newVersion})`);
57
+ links.push(`- [Renovate Bot Package Diff](https://renovatebot.com/diffs/npm/${packageName}/${currentVersion}/${newVersion})`);
48
58
  return `## Package diffs
49
59
 
50
- - [npmfs](https://npmfs.com/compare/${packageName}/${currentVersion}/${newVersion})
51
- - [Renovate Bot Package Diff](https://renovatebot.com/diffs/npm/${packageName}/${currentVersion}/${newVersion})`;
60
+ ${links.join('\n')}`;
52
61
  }
53
62
  createFooter() {
54
63
  return `This PR has been generated by [${package_json_1.default.name}](${package_json_1.default.homepage}) v${package_json_1.default.version}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-update-package",
3
- "version": "0.48.4",
3
+ "version": "0.49.0",
4
4
  "description": "CLI tool for creating pull requests to update npm packages",
5
5
  "scripts": {
6
6
  "build": "tsc --project tsconfig.build.json",
@@ -53,9 +53,9 @@
53
53
  "lint-staged": "12.3.7",
54
54
  "npm-run-all": "4.1.5",
55
55
  "rimraf": "3.0.2",
56
- "ts-jest": "27.1.3",
56
+ "ts-jest": "27.1.4",
57
57
  "ts-node": "10.7.0",
58
- "typescript": "4.6.2",
58
+ "typescript": "4.6.3",
59
59
  "utility-types": "3.10.0"
60
60
  },
61
61
  "repository": {