npm-update-package 1.3.6 → 1.4.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/README.md +18 -0
- package/dist/package.json +1 -1
- package/dist/src/github/pull-request/creator/LabelsAdder.js +21 -0
- package/dist/src/github/pull-request/creator/PullRequestCreator.js +3 -7
- package/dist/src/github/pull-request/creator/index.js +1 -0
- package/dist/src/main.js +6 -0
- package/dist/src/options/Options.js +1 -0
- package/dist/src/options/cliOptions.js +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ CLI tool for creating pull requests to update npm packages
|
|
|
13
13
|
- [Supported platforms](#supported-platforms)
|
|
14
14
|
- [Usage](#usage)
|
|
15
15
|
- [Options](#options)
|
|
16
|
+
- [`--additional-labels`](#--additional-labels)
|
|
16
17
|
- [`--assignees`](#--assignees)
|
|
17
18
|
- [`--assignees-sample-size`](#--assignees-sample-size)
|
|
18
19
|
- [`--commit-message`](#--commit-message)
|
|
@@ -66,6 +67,23 @@ npx npm-update-package --github-token <github-token>
|
|
|
66
67
|
You can customize behavior via CLI options.
|
|
67
68
|
Some options can embed variables like `{{packageName}}`(HTML-escaped) or `{{{packageName}}}`(not HTML-escaped).
|
|
68
69
|
|
|
70
|
+
### `--additional-labels`
|
|
71
|
+
|
|
72
|
+
Labels other than `npm-update-package` to add to pull request.
|
|
73
|
+
|
|
74
|
+
|Name|Value|
|
|
75
|
+
|---|---|
|
|
76
|
+
|type|string[]|
|
|
77
|
+
|required|-|
|
|
78
|
+
|
|
79
|
+
Example:
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
npx npm-update-package \
|
|
83
|
+
--github-token <github-token> \
|
|
84
|
+
--additional-labels bot dependencies
|
|
85
|
+
```
|
|
86
|
+
|
|
69
87
|
### `--assignees`
|
|
70
88
|
|
|
71
89
|
User names to assign to pull request.
|
package/dist/package.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LabelsAdder = void 0;
|
|
4
|
+
const DEFAULT_LABELS = ['npm-update-package'];
|
|
5
|
+
class LabelsAdder {
|
|
6
|
+
constructor({ options, github, gitRepo }) {
|
|
7
|
+
this.options = options;
|
|
8
|
+
this.github = github;
|
|
9
|
+
this.gitRepo = gitRepo;
|
|
10
|
+
}
|
|
11
|
+
async add(issueNumber) {
|
|
12
|
+
const labels = this.options.additionalLabels !== undefined ? [...DEFAULT_LABELS, ...this.options.additionalLabels] : DEFAULT_LABELS;
|
|
13
|
+
await this.github.addLabels({
|
|
14
|
+
owner: this.gitRepo.owner,
|
|
15
|
+
repo: this.gitRepo.name,
|
|
16
|
+
issueNumber,
|
|
17
|
+
labels
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.LabelsAdder = LabelsAdder;
|
|
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PullRequestCreator = void 0;
|
|
4
4
|
const logger_1 = require("../../../logger");
|
|
5
5
|
class PullRequestCreator {
|
|
6
|
-
constructor({ options, github, gitRepo, githubRepo, pullRequestTitleCreator, pullRequestBodyCreator, assigneesAdder, reviewersAdder }) {
|
|
6
|
+
constructor({ options, github, gitRepo, githubRepo, pullRequestTitleCreator, pullRequestBodyCreator, labelsAdder, assigneesAdder, reviewersAdder }) {
|
|
7
7
|
this.options = options;
|
|
8
8
|
this.github = github;
|
|
9
9
|
this.gitRepo = gitRepo;
|
|
10
10
|
this.githubRepo = githubRepo;
|
|
11
11
|
this.pullRequestTitleCreator = pullRequestTitleCreator;
|
|
12
12
|
this.pullRequestBodyCreator = pullRequestBodyCreator;
|
|
13
|
+
this.labelsAdder = labelsAdder;
|
|
13
14
|
this.assigneesAdder = assigneesAdder;
|
|
14
15
|
this.reviewersAdder = reviewersAdder;
|
|
15
16
|
}
|
|
@@ -27,12 +28,7 @@ class PullRequestCreator {
|
|
|
27
28
|
body
|
|
28
29
|
});
|
|
29
30
|
logger_1.logger.debug(`pullRequest=${JSON.stringify(pullRequest)}`);
|
|
30
|
-
await this.
|
|
31
|
-
owner: this.gitRepo.owner,
|
|
32
|
-
repo: this.gitRepo.name,
|
|
33
|
-
issueNumber: pullRequest.number,
|
|
34
|
-
labels: ['npm-update-package']
|
|
35
|
-
});
|
|
31
|
+
await this.labelsAdder.add(pullRequest.number);
|
|
36
32
|
if (this.options.assignees !== undefined) {
|
|
37
33
|
await this.assigneesAdder.add({
|
|
38
34
|
issueNumber: pullRequest.number,
|
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./AssigneesAdder"), exports);
|
|
18
18
|
__exportStar(require("./GitHubUrlOptimizer"), exports);
|
|
19
|
+
__exportStar(require("./LabelsAdder"), exports);
|
|
19
20
|
__exportStar(require("./PackageDiffsSectionCreator"), exports);
|
|
20
21
|
__exportStar(require("./PullRequestBodyCreator"), exports);
|
|
21
22
|
__exportStar(require("./PullRequestCreator"), exports);
|
package/dist/src/main.js
CHANGED
|
@@ -77,6 +77,11 @@ const main = async (options) => {
|
|
|
77
77
|
packageDiffsSectionCreator,
|
|
78
78
|
releaseNotesSectionCreator
|
|
79
79
|
});
|
|
80
|
+
const labelsAdder = new github_1.LabelsAdder({
|
|
81
|
+
options,
|
|
82
|
+
github,
|
|
83
|
+
gitRepo
|
|
84
|
+
});
|
|
80
85
|
const assigneesAdder = new github_1.AssigneesAdder({
|
|
81
86
|
github,
|
|
82
87
|
gitRepo
|
|
@@ -92,6 +97,7 @@ const main = async (options) => {
|
|
|
92
97
|
githubRepo,
|
|
93
98
|
pullRequestTitleCreator,
|
|
94
99
|
pullRequestBodyCreator,
|
|
100
|
+
labelsAdder,
|
|
95
101
|
assigneesAdder,
|
|
96
102
|
reviewersAdder
|
|
97
103
|
});
|
|
@@ -37,6 +37,7 @@ const Options = (0, io_ts_1.intersection)([
|
|
|
37
37
|
prTitle: io_ts_1.string
|
|
38
38
|
}),
|
|
39
39
|
(0, io_ts_1.partial)({
|
|
40
|
+
additionalLabels: (0, io_ts_1.array)(io_ts_1.string),
|
|
40
41
|
assignees: (0, io_ts_1.array)(io_ts_1.string),
|
|
41
42
|
assigneesSampleSize: io_ts_1.number,
|
|
42
43
|
gitUserEmail: io_ts_1.string,
|
|
@@ -7,6 +7,12 @@ const package_json_1 = require("../package-json");
|
|
|
7
7
|
const package_manager_1 = require("../package-manager");
|
|
8
8
|
const OptionType_1 = require("./OptionType");
|
|
9
9
|
exports.cliOptions = [
|
|
10
|
+
{
|
|
11
|
+
name: 'additional-labels',
|
|
12
|
+
description: 'Labels other than `npm-update-package` to add to pull request',
|
|
13
|
+
type: OptionType_1.OptionType.StringArray,
|
|
14
|
+
required: false
|
|
15
|
+
},
|
|
10
16
|
{
|
|
11
17
|
name: 'assignees',
|
|
12
18
|
description: 'User names to assign to pull request',
|