npm-update-package 1.0.2 → 1.2.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/package.json +17 -15
- package/dist/src/git/GitRepository.js +2 -2
- package/dist/src/github/label/creator/LabelCreator.js +4 -4
- package/dist/src/github/pull-request/creator/PackageDiffsSectionCreator.js +1 -3
- package/dist/src/github/pull-request/finder/PullRequestFinder.js +1 -1
- package/dist/src/github/pull-request/metadata/extractPullRequestMetadata.js +1 -1
- package/dist/src/json/toJSON.js +1 -6
- package/dist/src/main.js +8 -2
- package/dist/src/ncu/Ncu.js +1 -0
- package/dist/src/options/createOptions.js +1 -1
- package/package.json +17 -15
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-update-package",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "CLI tool for creating pull requests to update npm packages",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc --project tsconfig.build.json",
|
|
@@ -23,44 +23,46 @@
|
|
|
23
23
|
"http-status-codes": "2.2.0",
|
|
24
24
|
"io-ts": "2.2.16",
|
|
25
25
|
"lodash": "4.14.2",
|
|
26
|
-
"log4js": "6.4.
|
|
26
|
+
"log4js": "6.4.7",
|
|
27
27
|
"mustache": "4.1.0",
|
|
28
28
|
"node-fetch": "2.6.7",
|
|
29
|
-
"npm-check-updates": "
|
|
29
|
+
"npm-check-updates": "13.0.1",
|
|
30
30
|
"parse-github-url": "1.0.2",
|
|
31
31
|
"semver": "7.3.7",
|
|
32
32
|
"sleep-promise": "9.1.0",
|
|
33
33
|
"type-guards": "0.15.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@jest/types": "27.
|
|
37
|
-
"@tsconfig/
|
|
38
|
-
"@types/jest": "27.
|
|
36
|
+
"@jest/types": "27.5.1",
|
|
37
|
+
"@tsconfig/node14": "1.0.1",
|
|
38
|
+
"@types/jest": "27.5.1",
|
|
39
39
|
"@types/lodash": "4.14.182",
|
|
40
40
|
"@types/mustache": "4.1.2",
|
|
41
|
-
"@types/node": "
|
|
41
|
+
"@types/node": "14.18.18",
|
|
42
42
|
"@types/node-fetch": "2.6.1",
|
|
43
43
|
"@types/parse-github-url": "1.0.0",
|
|
44
44
|
"@types/semver": "7.3.9",
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
46
|
-
"eslint": "8.
|
|
47
|
-
"eslint-config-lodash": "1.0
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "5.25.0",
|
|
46
|
+
"eslint": "8.15.0",
|
|
47
|
+
"eslint-config-lodash": "1.1.0",
|
|
48
48
|
"eslint-config-standard-with-typescript": "21.0.1",
|
|
49
|
+
"eslint-plugin-eslint-comments": "3.2.0",
|
|
49
50
|
"eslint-plugin-import": "2.26.0",
|
|
50
|
-
"eslint-plugin-jest": "26.
|
|
51
|
+
"eslint-plugin-jest": "26.2.2",
|
|
51
52
|
"eslint-plugin-lodash": "7.4.0",
|
|
52
53
|
"eslint-plugin-node": "11.1.0",
|
|
53
54
|
"eslint-plugin-promise": "6.0.0",
|
|
54
55
|
"eslint-plugin-tsdoc": "0.2.16",
|
|
56
|
+
"eslint-plugin-unicorn": "42.0.0",
|
|
55
57
|
"eslint-plugin-you-dont-need-lodash-underscore": "6.12.0",
|
|
56
|
-
"husky": "
|
|
57
|
-
"jest": "27.
|
|
58
|
+
"husky": "8.0.1",
|
|
59
|
+
"jest": "27.5.1",
|
|
58
60
|
"lint-staged": "12.4.1",
|
|
59
61
|
"npm-run-all": "4.1.5",
|
|
60
62
|
"rimraf": "3.0.2",
|
|
61
|
-
"ts-jest": "27.1.
|
|
63
|
+
"ts-jest": "27.1.5",
|
|
62
64
|
"ts-node": "10.7.0",
|
|
63
|
-
"typescript": "4.6.
|
|
65
|
+
"typescript": "4.6.4",
|
|
64
66
|
"utility-types": "3.10.0"
|
|
65
67
|
},
|
|
66
68
|
"repository": {
|
|
@@ -35,11 +35,11 @@ class GitRepository {
|
|
|
35
35
|
if (result === null) {
|
|
36
36
|
return undefined;
|
|
37
37
|
}
|
|
38
|
-
const { owner, name } = result;
|
|
38
|
+
const { protocol, owner, name } = result;
|
|
39
39
|
if (owner === null || name === null) {
|
|
40
40
|
return undefined;
|
|
41
41
|
}
|
|
42
|
-
const host =
|
|
42
|
+
const host = protocol === 'github:' ? HOST_GITHUB : result.host;
|
|
43
43
|
if (host === null || !host.includes('.')) {
|
|
44
44
|
return undefined;
|
|
45
45
|
}
|
|
@@ -39,13 +39,13 @@ class LabelCreator {
|
|
|
39
39
|
name
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
catch (
|
|
43
|
-
if ((0, errors_1.isNotFoundError)(
|
|
44
|
-
logger_1.logger.warn(
|
|
42
|
+
catch (error) {
|
|
43
|
+
if ((0, errors_1.isNotFoundError)(error)) {
|
|
44
|
+
logger_1.logger.warn(error);
|
|
45
45
|
return undefined;
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
|
-
throw
|
|
48
|
+
throw error;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -15,9 +15,7 @@ class PackageDiffsSectionCreator {
|
|
|
15
15
|
const optimizedUrl = this.gitHubUrlOptimizer.optimize(url).toString();
|
|
16
16
|
links.push(`- [GitHub](${optimizedUrl})`);
|
|
17
17
|
}
|
|
18
|
-
links.push(`- [npmfs](https://npmfs.com/compare/${packageName}/${currentVersion}/${newVersion})`);
|
|
19
|
-
links.push(`- [Package Diff](https://diff.intrinsic.com/${packageName}/${currentVersion}/${newVersion})`);
|
|
20
|
-
links.push(`- [Renovate Bot Package Diff](https://renovatebot.com/diffs/npm/${packageName}/${currentVersion}/${newVersion})`);
|
|
18
|
+
links.push(`- [npmfs](https://npmfs.com/compare/${packageName}/${currentVersion}/${newVersion})`, `- [Package Diff](https://diff.intrinsic.com/${packageName}/${currentVersion}/${newVersion})`, `- [Renovate Bot Package Diff](https://renovatebot.com/diffs/npm/${packageName}/${currentVersion}/${newVersion})`);
|
|
21
19
|
return `## Package diffs
|
|
22
20
|
|
|
23
21
|
${links.join('\n')}`;
|
|
@@ -9,7 +9,7 @@ class PullRequestFinder {
|
|
|
9
9
|
}
|
|
10
10
|
findByPackageName(packageName) {
|
|
11
11
|
return this.pullRequests
|
|
12
|
-
.filter(isPullRequestByNpmUpdatePackage_1.isPullRequestByNpmUpdatePackage)
|
|
12
|
+
.filter(pullRequest => (0, isPullRequestByNpmUpdatePackage_1.isPullRequestByNpmUpdatePackage)(pullRequest))
|
|
13
13
|
.filter(({ body }) => {
|
|
14
14
|
if (body === null) {
|
|
15
15
|
return false;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.extractPullRequestMetadata = void 0;
|
|
4
4
|
const PullRequestMetadata_1 = require("./PullRequestMetadata");
|
|
5
5
|
const extractPullRequestMetadata = (pullRequestBody) => {
|
|
6
|
-
const matched = pullRequestBody.match(/<div id="npm-update-package-metadata">\s*```json\s*([\s
|
|
6
|
+
const matched = pullRequestBody.match(/<div id="npm-update-package-metadata">\s*```json\s*([\S\s]+?)\s*```\s*<\/div>/);
|
|
7
7
|
if (matched === null) {
|
|
8
8
|
return undefined;
|
|
9
9
|
}
|
package/dist/src/json/toJSON.js
CHANGED
|
@@ -3,11 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toJSON = void 0;
|
|
4
4
|
const toJSON = (value, options) => {
|
|
5
5
|
const pretty = options?.pretty ?? false;
|
|
6
|
-
|
|
7
|
-
return JSON.stringify(value, null, 2);
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
return JSON.stringify(value);
|
|
11
|
-
}
|
|
6
|
+
return pretty ? JSON.stringify(value, undefined, 2) : JSON.stringify(value);
|
|
12
7
|
};
|
|
13
8
|
exports.toJSON = toJSON;
|
package/dist/src/main.js
CHANGED
|
@@ -122,7 +122,10 @@ const main = async (options) => {
|
|
|
122
122
|
const outdatedPackagesProcessor = new core_1.OutdatedPackagesProcessor(outdatedPackageProcessor);
|
|
123
123
|
const results = await outdatedPackagesProcessor.process(outdatedPackages);
|
|
124
124
|
logger_1.logger.debug(`results=${JSON.stringify(results)}`);
|
|
125
|
-
const succeededResults = results
|
|
125
|
+
const succeededResults = results
|
|
126
|
+
// eslint-disable-next-line unicorn/no-array-callback-reference
|
|
127
|
+
.filter(Either_1.isRight)
|
|
128
|
+
.map(({ right }) => right);
|
|
126
129
|
logger_1.logger.debug(`succeededResults=${JSON.stringify(succeededResults)}`);
|
|
127
130
|
const createdPackages = succeededResults
|
|
128
131
|
.filter(({ created }) => created)
|
|
@@ -132,7 +135,10 @@ const main = async (options) => {
|
|
|
132
135
|
.filter(({ skipped }) => skipped)
|
|
133
136
|
.map(({ outdatedPackage }) => outdatedPackage);
|
|
134
137
|
logger_1.logger.debug(`skippedPackages=${JSON.stringify(skippedPackages)}`);
|
|
135
|
-
const failedResults = results
|
|
138
|
+
const failedResults = results
|
|
139
|
+
// eslint-disable-next-line unicorn/no-array-callback-reference
|
|
140
|
+
.filter(Either_1.isLeft)
|
|
141
|
+
.map(({ left }) => left);
|
|
136
142
|
logger_1.logger.debug(`failedResults=${JSON.stringify(failedResults)}`);
|
|
137
143
|
const failedPackages = failedResults.map(({ outdatedPackage }) => outdatedPackage);
|
|
138
144
|
logger_1.logger.debug(`failedPackages=${JSON.stringify(failedPackages)}`);
|
package/dist/src/ncu/Ncu.js
CHANGED
|
@@ -93,6 +93,7 @@ class Ncu {
|
|
|
93
93
|
};
|
|
94
94
|
return outdatedPackage;
|
|
95
95
|
})
|
|
96
|
+
// eslint-disable-next-line unicorn/no-array-callback-reference
|
|
96
97
|
.filter(type_guards_1.isNotUndefined);
|
|
97
98
|
if (resultEntries.length !== outdatedPackages.length) {
|
|
98
99
|
throw new Error('Failed to running ncu.');
|
|
@@ -12,7 +12,7 @@ const toCommanderOption_1 = require("./toCommanderOption");
|
|
|
12
12
|
const createOptions = (cliOptions) => {
|
|
13
13
|
commander_1.program.version(package_json_1.default.version);
|
|
14
14
|
cliOptions
|
|
15
|
-
.map(toCommanderOption_1.toCommanderOption)
|
|
15
|
+
.map(option => (0, toCommanderOption_1.toCommanderOption)(option))
|
|
16
16
|
.forEach(option => commander_1.program.addOption(option));
|
|
17
17
|
commander_1.program.parse(process.argv);
|
|
18
18
|
const options = commander_1.program.opts();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-update-package",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "CLI tool for creating pull requests to update npm packages",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc --project tsconfig.build.json",
|
|
@@ -23,44 +23,46 @@
|
|
|
23
23
|
"http-status-codes": "2.2.0",
|
|
24
24
|
"io-ts": "2.2.16",
|
|
25
25
|
"lodash": "4.14.2",
|
|
26
|
-
"log4js": "6.4.
|
|
26
|
+
"log4js": "6.4.7",
|
|
27
27
|
"mustache": "4.1.0",
|
|
28
28
|
"node-fetch": "2.6.7",
|
|
29
|
-
"npm-check-updates": "
|
|
29
|
+
"npm-check-updates": "13.0.1",
|
|
30
30
|
"parse-github-url": "1.0.2",
|
|
31
31
|
"semver": "7.3.7",
|
|
32
32
|
"sleep-promise": "9.1.0",
|
|
33
33
|
"type-guards": "0.15.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@jest/types": "27.
|
|
37
|
-
"@tsconfig/
|
|
38
|
-
"@types/jest": "27.
|
|
36
|
+
"@jest/types": "27.5.1",
|
|
37
|
+
"@tsconfig/node14": "1.0.1",
|
|
38
|
+
"@types/jest": "27.5.1",
|
|
39
39
|
"@types/lodash": "4.14.182",
|
|
40
40
|
"@types/mustache": "4.1.2",
|
|
41
|
-
"@types/node": "
|
|
41
|
+
"@types/node": "14.18.18",
|
|
42
42
|
"@types/node-fetch": "2.6.1",
|
|
43
43
|
"@types/parse-github-url": "1.0.0",
|
|
44
44
|
"@types/semver": "7.3.9",
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
46
|
-
"eslint": "8.
|
|
47
|
-
"eslint-config-lodash": "1.0
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "5.25.0",
|
|
46
|
+
"eslint": "8.15.0",
|
|
47
|
+
"eslint-config-lodash": "1.1.0",
|
|
48
48
|
"eslint-config-standard-with-typescript": "21.0.1",
|
|
49
|
+
"eslint-plugin-eslint-comments": "3.2.0",
|
|
49
50
|
"eslint-plugin-import": "2.26.0",
|
|
50
|
-
"eslint-plugin-jest": "26.
|
|
51
|
+
"eslint-plugin-jest": "26.2.2",
|
|
51
52
|
"eslint-plugin-lodash": "7.4.0",
|
|
52
53
|
"eslint-plugin-node": "11.1.0",
|
|
53
54
|
"eslint-plugin-promise": "6.0.0",
|
|
54
55
|
"eslint-plugin-tsdoc": "0.2.16",
|
|
56
|
+
"eslint-plugin-unicorn": "42.0.0",
|
|
55
57
|
"eslint-plugin-you-dont-need-lodash-underscore": "6.12.0",
|
|
56
|
-
"husky": "
|
|
57
|
-
"jest": "27.
|
|
58
|
+
"husky": "8.0.1",
|
|
59
|
+
"jest": "27.5.1",
|
|
58
60
|
"lint-staged": "12.4.1",
|
|
59
61
|
"npm-run-all": "4.1.5",
|
|
60
62
|
"rimraf": "3.0.2",
|
|
61
|
-
"ts-jest": "27.1.
|
|
63
|
+
"ts-jest": "27.1.5",
|
|
62
64
|
"ts-node": "10.7.0",
|
|
63
|
-
"typescript": "4.6.
|
|
65
|
+
"typescript": "4.6.4",
|
|
64
66
|
"utility-types": "3.10.0"
|
|
65
67
|
},
|
|
66
68
|
"repository": {
|