npm-update-package 0.17.0 → 0.17.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/dist/app.js +1 -1
- package/dist/ncu/NcuResultConverter.js +23 -12
- package/package.json +3 -2
package/dist/app.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NcuResultConverter = void 0;
|
|
4
|
+
const type_guards_1 = require("type-guards");
|
|
4
5
|
const PackageVersion_1 = require("./PackageVersion");
|
|
5
6
|
const toUpdateType_1 = require("./toUpdateType");
|
|
6
7
|
// TODO: add test
|
|
@@ -9,18 +10,28 @@ class NcuResultConverter {
|
|
|
9
10
|
this.currentDependencies = currentDependencies;
|
|
10
11
|
}
|
|
11
12
|
toOutdatedPackages(result) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
name,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
newVersion
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
const resultEntries = Object.entries(result);
|
|
14
|
+
const outdatedPackages = resultEntries
|
|
15
|
+
.map(([name, newVersionString]) => {
|
|
16
|
+
const currentVersionString = this.currentDependencies[name];
|
|
17
|
+
if (currentVersionString === undefined) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const currentVersion = PackageVersion_1.PackageVersion.of(currentVersionString);
|
|
21
|
+
const newVersion = PackageVersion_1.PackageVersion.of(newVersionString);
|
|
22
|
+
const type = (0, toUpdateType_1.toUpdateType)(currentVersion, newVersion);
|
|
23
|
+
return {
|
|
24
|
+
name,
|
|
25
|
+
currentVersion,
|
|
26
|
+
newVersion,
|
|
27
|
+
type
|
|
28
|
+
};
|
|
29
|
+
})
|
|
30
|
+
.filter(type_guards_1.isNotUndefined);
|
|
31
|
+
if (resultEntries.length !== outdatedPackages.length) {
|
|
32
|
+
throw new Error('Failed to convert to outdatedPackages from NcuResult.');
|
|
33
|
+
}
|
|
34
|
+
return outdatedPackages;
|
|
24
35
|
}
|
|
25
36
|
}
|
|
26
37
|
exports.NcuResultConverter = NcuResultConverter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-update-package",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "CLI tool for creating pull request to update npm packages",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc --project tsconfig.build.json",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"mustache": "4.1.0",
|
|
27
27
|
"npm-check-updates": "12.0.5",
|
|
28
28
|
"parse-github-url": "1.0.2",
|
|
29
|
-
"semver": "7.3.5"
|
|
29
|
+
"semver": "7.3.5",
|
|
30
|
+
"type-guards": "0.15.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@jest/types": "27.0.6",
|