npm-update-package 0.48.3 → 0.49.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.
package/README.md
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
[](https://standardjs.com)
|
|
3
3
|
[](https://github.com/npm-update-package/npm-update-package/actions/workflows/eslint.yml)
|
|
4
4
|
[](https://github.com/npm-update-package/npm-update-package/actions/workflows/test.yml)
|
|
5
|
-

|
|
6
|
-

|
|
7
|
-

|
|
8
|
-

|
|
9
5
|
|
|
10
6
|
# npm-update-package
|
|
11
7
|
|
package/dist/package.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-update-package",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.1",
|
|
4
4
|
"description": "CLI tool for creating pull requests to update npm packages",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"badges": "jest-coverage-badges output docs",
|
|
7
6
|
"build": "tsc --project tsconfig.build.json",
|
|
8
7
|
"clean": "rimraf dist",
|
|
9
8
|
"lint": "eslint '**/*.{js,ts}'",
|
|
10
|
-
"posttest": "npm run badges",
|
|
11
9
|
"prebuild": "npm run clean",
|
|
12
10
|
"prepare": "husky install",
|
|
13
11
|
"prepublish": "npm-run-all lint test build",
|
|
@@ -46,19 +44,18 @@
|
|
|
46
44
|
"eslint": "8.11.0",
|
|
47
45
|
"eslint-config-standard-with-typescript": "21.0.1",
|
|
48
46
|
"eslint-plugin-import": "2.25.4",
|
|
49
|
-
"eslint-plugin-jest": "26.1.
|
|
47
|
+
"eslint-plugin-jest": "26.1.3",
|
|
50
48
|
"eslint-plugin-node": "11.1.0",
|
|
51
49
|
"eslint-plugin-promise": "6.0.0",
|
|
52
50
|
"eslint-plugin-tsdoc": "0.2.14",
|
|
53
51
|
"husky": "7.0.4",
|
|
54
52
|
"jest": "27.4.7",
|
|
55
|
-
"jest-coverage-badges": "1.1.2",
|
|
56
53
|
"lint-staged": "12.3.7",
|
|
57
54
|
"npm-run-all": "4.1.5",
|
|
58
55
|
"rimraf": "3.0.2",
|
|
59
|
-
"ts-jest": "27.1.
|
|
56
|
+
"ts-jest": "27.1.4",
|
|
60
57
|
"ts-node": "10.7.0",
|
|
61
|
-
"typescript": "4.6.
|
|
58
|
+
"typescript": "4.6.3",
|
|
62
59
|
"utility-types": "3.10.0"
|
|
63
60
|
},
|
|
64
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,21 @@ 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
|
+
const url = `${gitRepo.url.toString()}/compare/v${currentVersion}...v${newVersion}`;
|
|
55
|
+
const optimizedUrl = (0, optimizeGitHubUrl_1.optimizeGitHubUrl)(url).toString();
|
|
56
|
+
links.push(`- [GitHub](${optimizedUrl})`);
|
|
57
|
+
}
|
|
58
|
+
links.push(`- [npmfs](https://npmfs.com/compare/${packageName}/${currentVersion}/${newVersion})`);
|
|
59
|
+
links.push(`- [Renovate Bot Package Diff](https://renovatebot.com/diffs/npm/${packageName}/${currentVersion}/${newVersion})`);
|
|
48
60
|
return `## Package diffs
|
|
49
61
|
|
|
50
|
-
|
|
51
|
-
- [Renovate Bot Package Diff](https://renovatebot.com/diffs/npm/${packageName}/${currentVersion}/${newVersion})`;
|
|
62
|
+
${links.join('\n')}`;
|
|
52
63
|
}
|
|
53
64
|
createFooter() {
|
|
54
65
|
return `This PR has been generated by [${package_json_1.default.name}](${package_json_1.default.homepage}) v${package_json_1.default.version}`;
|
|
@@ -85,7 +96,7 @@ ${this.options.prBodyNotes}`;
|
|
|
85
96
|
return undefined;
|
|
86
97
|
}
|
|
87
98
|
const items = releases.map(({ tag, url }) => {
|
|
88
|
-
const optimizedUrl = (0, optimizeGitHubUrl_1.optimizeGitHubUrl)(url);
|
|
99
|
+
const optimizedUrl = (0, optimizeGitHubUrl_1.optimizeGitHubUrl)(url).toString();
|
|
89
100
|
return `- [${tag}](${optimizedUrl})`;
|
|
90
101
|
});
|
|
91
102
|
return `## Release notes
|
|
@@ -6,10 +6,10 @@ const url_1 = require("url");
|
|
|
6
6
|
* Convert URL to prevent linking to other repositories.
|
|
7
7
|
*/
|
|
8
8
|
const optimizeGitHubUrl = (url) => {
|
|
9
|
-
const newUrl = new url_1.URL(url);
|
|
9
|
+
const newUrl = url instanceof url_1.URL ? url : new url_1.URL(url);
|
|
10
10
|
if (newUrl.host === 'github.com') {
|
|
11
11
|
newUrl.host = 'togithub.com';
|
|
12
12
|
}
|
|
13
|
-
return newUrl
|
|
13
|
+
return newUrl;
|
|
14
14
|
};
|
|
15
15
|
exports.optimizeGitHubUrl = optimizeGitHubUrl;
|
package/package.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-update-package",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.1",
|
|
4
4
|
"description": "CLI tool for creating pull requests to update npm packages",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"badges": "jest-coverage-badges output docs",
|
|
7
6
|
"build": "tsc --project tsconfig.build.json",
|
|
8
7
|
"clean": "rimraf dist",
|
|
9
8
|
"lint": "eslint '**/*.{js,ts}'",
|
|
10
|
-
"posttest": "npm run badges",
|
|
11
9
|
"prebuild": "npm run clean",
|
|
12
10
|
"prepare": "husky install",
|
|
13
11
|
"prepublish": "npm-run-all lint test build",
|
|
@@ -46,19 +44,18 @@
|
|
|
46
44
|
"eslint": "8.11.0",
|
|
47
45
|
"eslint-config-standard-with-typescript": "21.0.1",
|
|
48
46
|
"eslint-plugin-import": "2.25.4",
|
|
49
|
-
"eslint-plugin-jest": "26.1.
|
|
47
|
+
"eslint-plugin-jest": "26.1.3",
|
|
50
48
|
"eslint-plugin-node": "11.1.0",
|
|
51
49
|
"eslint-plugin-promise": "6.0.0",
|
|
52
50
|
"eslint-plugin-tsdoc": "0.2.14",
|
|
53
51
|
"husky": "7.0.4",
|
|
54
52
|
"jest": "27.4.7",
|
|
55
|
-
"jest-coverage-badges": "1.1.2",
|
|
56
53
|
"lint-staged": "12.3.7",
|
|
57
54
|
"npm-run-all": "4.1.5",
|
|
58
55
|
"rimraf": "3.0.2",
|
|
59
|
-
"ts-jest": "27.1.
|
|
56
|
+
"ts-jest": "27.1.4",
|
|
60
57
|
"ts-node": "10.7.0",
|
|
61
|
-
"typescript": "4.6.
|
|
58
|
+
"typescript": "4.6.3",
|
|
62
59
|
"utility-types": "3.10.0"
|
|
63
60
|
},
|
|
64
61
|
"repository": {
|