npm-update-package 0.47.0 → 0.48.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 +2 -2
- package/dist/src/core/OutdatedPackageProcessor.js +3 -6
- package/dist/src/core/OutdatedPackagesProcessor.js +0 -1
- package/dist/src/github/pull-request/closer/PullRequestsCloser.js +16 -0
- package/dist/src/github/pull-request/closer/index.js +1 -0
- package/dist/src/main.js +5 -1
- package/dist/src/options/createOptions.js +24 -0
- package/dist/src/options/initOptions.js +2 -18
- package/package.json +2 -2
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-update-package",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "CLI tool for creating pull requests to update npm packages",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"badges": "jest-coverage-badges output docs",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"eslint": "8.11.0",
|
|
47
47
|
"eslint-config-standard-with-typescript": "21.0.1",
|
|
48
48
|
"eslint-plugin-import": "2.25.4",
|
|
49
|
-
"eslint-plugin-jest": "26.1.
|
|
49
|
+
"eslint-plugin-jest": "26.1.2",
|
|
50
50
|
"eslint-plugin-node": "11.1.0",
|
|
51
51
|
"eslint-plugin-promise": "6.0.0",
|
|
52
52
|
"eslint-plugin-tsdoc": "0.2.14",
|
|
@@ -5,7 +5,7 @@ const Either_1 = require("fp-ts/lib/Either");
|
|
|
5
5
|
const git_1 = require("../git");
|
|
6
6
|
// TODO: add test
|
|
7
7
|
class OutdatedPackageProcessor {
|
|
8
|
-
constructor({ git, packageManager, pullRequestCreator, branchFinder, logger, commitMessageCreator, pullRequestFinder,
|
|
8
|
+
constructor({ git, packageManager, pullRequestCreator, branchFinder, logger, commitMessageCreator, pullRequestFinder, pullRequestsCloser, packageUpdater }) {
|
|
9
9
|
this.git = git;
|
|
10
10
|
this.packageManager = packageManager;
|
|
11
11
|
this.pullRequestCreator = pullRequestCreator;
|
|
@@ -13,7 +13,7 @@ class OutdatedPackageProcessor {
|
|
|
13
13
|
this.logger = logger;
|
|
14
14
|
this.commitMessageCreator = commitMessageCreator;
|
|
15
15
|
this.pullRequestFinder = pullRequestFinder;
|
|
16
|
-
this.
|
|
16
|
+
this.pullRequestsCloser = pullRequestsCloser;
|
|
17
17
|
this.packageUpdater = packageUpdater;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
@@ -69,10 +69,7 @@ class OutdatedPackageProcessor {
|
|
|
69
69
|
async closeOldPullRequests(outdatedPackage) {
|
|
70
70
|
const pullRequests = this.pullRequestFinder.findByPackageName(outdatedPackage.name);
|
|
71
71
|
this.logger.debug(`pullRequests=${JSON.stringify(pullRequests)}`);
|
|
72
|
-
await
|
|
73
|
-
await this.pullRequestCloser.close(pullRequest);
|
|
74
|
-
this.logger.info(`Pull request for ${outdatedPackage.name} has closed. ${pullRequest.html_url}`);
|
|
75
|
-
}));
|
|
72
|
+
await this.pullRequestsCloser.close(pullRequests);
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
exports.OutdatedPackageProcessor = OutdatedPackageProcessor;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OutdatedPackagesProcessor = void 0;
|
|
4
|
-
// TODO: add test
|
|
5
4
|
class OutdatedPackagesProcessor {
|
|
6
5
|
constructor({ outdatedPackageProcessor, logger }) {
|
|
7
6
|
this.outdatedPackageProcessor = outdatedPackageProcessor;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PullRequestsCloser = void 0;
|
|
4
|
+
class PullRequestsCloser {
|
|
5
|
+
constructor({ pullRequestCloser, logger }) {
|
|
6
|
+
this.pullRequestCloser = pullRequestCloser;
|
|
7
|
+
this.logger = logger;
|
|
8
|
+
}
|
|
9
|
+
async close(pullRequests) {
|
|
10
|
+
await Promise.all(pullRequests.map(async (pullRequest) => {
|
|
11
|
+
await this.pullRequestCloser.close(pullRequest);
|
|
12
|
+
this.logger.info(`Pull request #${pullRequest.number} has closed. ${pullRequest.html_url}`);
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.PullRequestsCloser = PullRequestsCloser;
|
package/dist/src/main.js
CHANGED
|
@@ -86,6 +86,10 @@ const main = async ({ options, logger }) => {
|
|
|
86
86
|
const commitMessageCreator = new git_1.CommitMessageCreator(options.commitMessage);
|
|
87
87
|
const pullRequestFinder = new github_1.PullRequestFinder(pullRequests);
|
|
88
88
|
const pullRequestCloser = new github_1.PullRequestCloser(github);
|
|
89
|
+
const pullRequestsCloser = new github_1.PullRequestsCloser({
|
|
90
|
+
pullRequestCloser,
|
|
91
|
+
logger
|
|
92
|
+
});
|
|
89
93
|
const packageUpdater = new core_1.PackageUpdater({
|
|
90
94
|
packageManager,
|
|
91
95
|
ncu
|
|
@@ -98,7 +102,7 @@ const main = async ({ options, logger }) => {
|
|
|
98
102
|
logger,
|
|
99
103
|
commitMessageCreator,
|
|
100
104
|
pullRequestFinder,
|
|
101
|
-
|
|
105
|
+
pullRequestsCloser,
|
|
102
106
|
packageUpdater
|
|
103
107
|
});
|
|
104
108
|
const outdatedPackagesProcessor = new core_1.OutdatedPackagesProcessor({
|
|
@@ -0,0 +1,24 @@
|
|
|
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.createOptions = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const package_json_1 = __importDefault(require("../../package.json"));
|
|
9
|
+
const Options_1 = require("./Options");
|
|
10
|
+
const toCommanderOption_1 = require("./toCommanderOption");
|
|
11
|
+
// TODO: add test
|
|
12
|
+
const createOptions = (cliOptions) => {
|
|
13
|
+
commander_1.program.version(package_json_1.default.version);
|
|
14
|
+
cliOptions
|
|
15
|
+
.map(toCommanderOption_1.toCommanderOption)
|
|
16
|
+
.forEach(option => commander_1.program.addOption(option));
|
|
17
|
+
commander_1.program.parse(process.argv);
|
|
18
|
+
const options = commander_1.program.opts();
|
|
19
|
+
if (!(0, Options_1.isOptions)(options)) {
|
|
20
|
+
throw new Error(`Failed to parse command-line options. options=${JSON.stringify(options)}`);
|
|
21
|
+
}
|
|
22
|
+
return options;
|
|
23
|
+
};
|
|
24
|
+
exports.createOptions = createOptions;
|
|
@@ -1,25 +1,9 @@
|
|
|
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.initOptions = void 0;
|
|
7
|
-
const commander_1 = require("commander");
|
|
8
|
-
const package_json_1 = __importDefault(require("../../package.json"));
|
|
9
4
|
const cliOptions_1 = require("./cliOptions");
|
|
10
|
-
const
|
|
11
|
-
const toCommanderOption_1 = require("./toCommanderOption");
|
|
12
|
-
// TODO: add test
|
|
5
|
+
const createOptions_1 = require("./createOptions");
|
|
13
6
|
const initOptions = () => {
|
|
14
|
-
|
|
15
|
-
cliOptions_1.cliOptions
|
|
16
|
-
.map(toCommanderOption_1.toCommanderOption)
|
|
17
|
-
.forEach(option => commander_1.program.addOption(option));
|
|
18
|
-
commander_1.program.parse(process.argv);
|
|
19
|
-
const options = commander_1.program.opts();
|
|
20
|
-
if (!(0, Options_1.isOptions)(options)) {
|
|
21
|
-
throw new Error(`Failed to parse command-line options. options=${JSON.stringify(options)}`);
|
|
22
|
-
}
|
|
23
|
-
return options;
|
|
7
|
+
return (0, createOptions_1.createOptions)(cliOptions_1.cliOptions);
|
|
24
8
|
};
|
|
25
9
|
exports.initOptions = initOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-update-package",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "CLI tool for creating pull requests to update npm packages",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"badges": "jest-coverage-badges output docs",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"eslint": "8.11.0",
|
|
47
47
|
"eslint-config-standard-with-typescript": "21.0.1",
|
|
48
48
|
"eslint-plugin-import": "2.25.4",
|
|
49
|
-
"eslint-plugin-jest": "26.1.
|
|
49
|
+
"eslint-plugin-jest": "26.1.2",
|
|
50
50
|
"eslint-plugin-node": "11.1.0",
|
|
51
51
|
"eslint-plugin-promise": "6.0.0",
|
|
52
52
|
"eslint-plugin-tsdoc": "0.2.14",
|