npm-update-package 1.4.8 → 1.4.10
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 +4 -9
- package/dist/src/github/GitHub.js +3 -6
- package/dist/src/github/pull-request/creator/AssigneesAdder.js +2 -5
- package/dist/src/github/pull-request/creator/ReviewersAdder.js +2 -5
- package/dist/src/github/releases/fetcher/ReleasesFetcher.js +3 -2
- package/dist/src/util/index.js +19 -0
- package/dist/src/util/range.js +9 -0
- package/dist/src/util/sampleSize.js +11 -0
- package/dist/src/util/sleep.js +7 -0
- package/package.json +4 -9
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-update-package",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.10",
|
|
4
4
|
"description": "CLI tool for creating pull requests to update npm packages",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc --project tsconfig.build.json",
|
|
@@ -16,43 +16,38 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@octokit/rest": "19.0.4",
|
|
19
|
+
"array-shuffle": "2.0.0",
|
|
19
20
|
"commander": "9.4.0",
|
|
20
21
|
"execa": "5.1.1",
|
|
21
22
|
"fp-ts": "2.12.3",
|
|
22
23
|
"http-status-codes": "2.2.0",
|
|
23
24
|
"io-ts": "2.2.18",
|
|
24
|
-
"lodash": "4.14.2",
|
|
25
25
|
"log4js": "6.6.1",
|
|
26
26
|
"mustache": "4.2.0",
|
|
27
27
|
"node-fetch": "2.6.7",
|
|
28
28
|
"npm-check-updates": "16.3.2",
|
|
29
29
|
"parse-github-url": "1.0.2",
|
|
30
30
|
"semver": "7.3.7",
|
|
31
|
-
"sleep-promise": "9.1.0",
|
|
32
31
|
"type-guards": "0.15.0"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@tsconfig/node14": "1.0.3",
|
|
36
|
-
"@types/lodash": "4.14.185",
|
|
37
35
|
"@types/mustache": "4.2.1",
|
|
38
|
-
"@types/node": "14.18.
|
|
36
|
+
"@types/node": "14.18.31",
|
|
39
37
|
"@types/node-fetch": "2.6.2",
|
|
40
38
|
"@types/parse-github-url": "1.0.0",
|
|
41
39
|
"@types/semver": "7.3.12",
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "5.38.
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "5.38.1",
|
|
43
41
|
"eslint": "8.24.0",
|
|
44
|
-
"eslint-config-lodash": "1.1.0",
|
|
45
42
|
"eslint-config-standard-with-typescript": "23.0.0",
|
|
46
43
|
"eslint-plugin-eslint-comments": "3.2.0",
|
|
47
44
|
"eslint-plugin-import": "2.26.0",
|
|
48
45
|
"eslint-plugin-import-newlines": "1.2.3",
|
|
49
46
|
"eslint-plugin-jest": "27.0.4",
|
|
50
|
-
"eslint-plugin-lodash": "7.4.0",
|
|
51
47
|
"eslint-plugin-n": "15.3.0",
|
|
52
48
|
"eslint-plugin-promise": "6.0.1",
|
|
53
49
|
"eslint-plugin-tsdoc": "0.2.17",
|
|
54
50
|
"eslint-plugin-unicorn": "43.0.2",
|
|
55
|
-
"eslint-plugin-you-dont-need-lodash-underscore": "6.12.0",
|
|
56
51
|
"jest": "29.0.3",
|
|
57
52
|
"npm-run-all": "4.1.5",
|
|
58
53
|
"rimraf": "3.0.2",
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.GitHub = void 0;
|
|
7
|
-
const
|
|
4
|
+
const util_1 = require("../util");
|
|
8
5
|
class GitHub {
|
|
9
6
|
constructor(octokit) {
|
|
10
7
|
this.octokit = octokit;
|
|
@@ -62,7 +59,7 @@ class GitHub {
|
|
|
62
59
|
}
|
|
63
60
|
async fetchBranches({ owner, repo }) {
|
|
64
61
|
const branches = [];
|
|
65
|
-
for (const page of (0,
|
|
62
|
+
for (const page of (0, util_1.range)(1, 11)) {
|
|
66
63
|
const { data } = await this.octokit.repos.listBranches({
|
|
67
64
|
owner,
|
|
68
65
|
repo,
|
|
@@ -86,7 +83,7 @@ class GitHub {
|
|
|
86
83
|
}
|
|
87
84
|
async fetchPullRequests({ owner, repo }) {
|
|
88
85
|
const pullRequests = [];
|
|
89
|
-
for (const page of (0,
|
|
86
|
+
for (const page of (0, util_1.range)(1, 11)) {
|
|
90
87
|
const { data } = await this.octokit.pulls.list({
|
|
91
88
|
owner,
|
|
92
89
|
repo,
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.AssigneesAdder = void 0;
|
|
7
|
-
const
|
|
4
|
+
const util_1 = require("../../../util");
|
|
8
5
|
class AssigneesAdder {
|
|
9
6
|
constructor({ github, gitRepo }) {
|
|
10
7
|
this.github = github;
|
|
@@ -15,7 +12,7 @@ class AssigneesAdder {
|
|
|
15
12
|
owner: this.gitRepo.owner,
|
|
16
13
|
repo: this.gitRepo.name,
|
|
17
14
|
issueNumber,
|
|
18
|
-
assignees: size !== undefined ? (0,
|
|
15
|
+
assignees: size !== undefined ? (0, util_1.sampleSize)(assignees, size) : assignees
|
|
19
16
|
});
|
|
20
17
|
}
|
|
21
18
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.ReviewersAdder = void 0;
|
|
7
|
-
const
|
|
4
|
+
const util_1 = require("../../../util");
|
|
8
5
|
class ReviewersAdder {
|
|
9
6
|
constructor({ github, gitRepo }) {
|
|
10
7
|
this.github = github;
|
|
@@ -15,7 +12,7 @@ class ReviewersAdder {
|
|
|
15
12
|
owner: this.gitRepo.owner,
|
|
16
13
|
repo: this.gitRepo.name,
|
|
17
14
|
pullNumber,
|
|
18
|
-
reviewers: size !== undefined ? (0,
|
|
15
|
+
reviewers: size !== undefined ? (0, util_1.sampleSize)(reviewers, size) : reviewers
|
|
19
16
|
});
|
|
20
17
|
}
|
|
21
18
|
}
|
|
@@ -4,9 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ReleasesFetcher = void 0;
|
|
7
|
+
// TODO [engine:node@>=18]: Replace with global fetch and remove node-fetch from dependencies when the minimum supported Node.js version becomes v18 or later.
|
|
7
8
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
8
9
|
const semver_1 = require("semver");
|
|
9
|
-
const
|
|
10
|
+
const util_1 = require("../../../util");
|
|
10
11
|
// TODO: Split into multiple classes and functions
|
|
11
12
|
class ReleasesFetcher {
|
|
12
13
|
constructor({ options, packageManager }) {
|
|
@@ -39,7 +40,7 @@ class ReleasesFetcher {
|
|
|
39
40
|
const releases = [];
|
|
40
41
|
for (const [i, tag] of tags.entries()) {
|
|
41
42
|
if (i > 0) {
|
|
42
|
-
await (0,
|
|
43
|
+
await (0, util_1.sleep)(this.options.fetchSleepTime);
|
|
43
44
|
}
|
|
44
45
|
const release = await this.fetchReleaseByTag({
|
|
45
46
|
gitRepo,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./range"), exports);
|
|
18
|
+
__exportStar(require("./sampleSize"), exports);
|
|
19
|
+
__exportStar(require("./sleep"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.sampleSize = void 0;
|
|
7
|
+
const array_shuffle_1 = __importDefault(require("array-shuffle"));
|
|
8
|
+
const sampleSize = (array, size) => {
|
|
9
|
+
return (0, array_shuffle_1.default)(array).slice(0, size);
|
|
10
|
+
};
|
|
11
|
+
exports.sampleSize = sampleSize;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-update-package",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.10",
|
|
4
4
|
"description": "CLI tool for creating pull requests to update npm packages",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc --project tsconfig.build.json",
|
|
@@ -16,43 +16,38 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@octokit/rest": "19.0.4",
|
|
19
|
+
"array-shuffle": "2.0.0",
|
|
19
20
|
"commander": "9.4.0",
|
|
20
21
|
"execa": "5.1.1",
|
|
21
22
|
"fp-ts": "2.12.3",
|
|
22
23
|
"http-status-codes": "2.2.0",
|
|
23
24
|
"io-ts": "2.2.18",
|
|
24
|
-
"lodash": "4.14.2",
|
|
25
25
|
"log4js": "6.6.1",
|
|
26
26
|
"mustache": "4.2.0",
|
|
27
27
|
"node-fetch": "2.6.7",
|
|
28
28
|
"npm-check-updates": "16.3.2",
|
|
29
29
|
"parse-github-url": "1.0.2",
|
|
30
30
|
"semver": "7.3.7",
|
|
31
|
-
"sleep-promise": "9.1.0",
|
|
32
31
|
"type-guards": "0.15.0"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@tsconfig/node14": "1.0.3",
|
|
36
|
-
"@types/lodash": "4.14.185",
|
|
37
35
|
"@types/mustache": "4.2.1",
|
|
38
|
-
"@types/node": "14.18.
|
|
36
|
+
"@types/node": "14.18.31",
|
|
39
37
|
"@types/node-fetch": "2.6.2",
|
|
40
38
|
"@types/parse-github-url": "1.0.0",
|
|
41
39
|
"@types/semver": "7.3.12",
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "5.38.
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "5.38.1",
|
|
43
41
|
"eslint": "8.24.0",
|
|
44
|
-
"eslint-config-lodash": "1.1.0",
|
|
45
42
|
"eslint-config-standard-with-typescript": "23.0.0",
|
|
46
43
|
"eslint-plugin-eslint-comments": "3.2.0",
|
|
47
44
|
"eslint-plugin-import": "2.26.0",
|
|
48
45
|
"eslint-plugin-import-newlines": "1.2.3",
|
|
49
46
|
"eslint-plugin-jest": "27.0.4",
|
|
50
|
-
"eslint-plugin-lodash": "7.4.0",
|
|
51
47
|
"eslint-plugin-n": "15.3.0",
|
|
52
48
|
"eslint-plugin-promise": "6.0.1",
|
|
53
49
|
"eslint-plugin-tsdoc": "0.2.17",
|
|
54
50
|
"eslint-plugin-unicorn": "43.0.2",
|
|
55
|
-
"eslint-plugin-you-dont-need-lodash-underscore": "6.12.0",
|
|
56
51
|
"jest": "29.0.3",
|
|
57
52
|
"npm-run-all": "4.1.5",
|
|
58
53
|
"rimraf": "3.0.2",
|