npm-update-package 1.3.6 → 1.4.2

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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-update-package",
3
- "version": "1.3.6",
3
+ "version": "1.4.2",
4
4
  "description": "CLI tool for creating pull requests to update npm packages",
5
5
  "scripts": {
6
6
  "build": "tsc --project tsconfig.build.json",
@@ -15,7 +15,7 @@
15
15
  "node": ">=14"
16
16
  },
17
17
  "dependencies": {
18
- "@octokit/rest": "19.0.3",
18
+ "@octokit/rest": "19.0.4",
19
19
  "commander": "9.4.0",
20
20
  "execa": "5.1.1",
21
21
  "fp-ts": "2.12.2",
@@ -34,20 +34,20 @@
34
34
  "devDependencies": {
35
35
  "@jest/types": "28.1.3",
36
36
  "@tsconfig/node14": "1.0.3",
37
- "@types/jest": "28.1.6",
37
+ "@types/jest": "28.1.7",
38
38
  "@types/lodash": "4.14.182",
39
39
  "@types/mustache": "4.2.1",
40
- "@types/node": "14.18.23",
40
+ "@types/node": "14.18.24",
41
41
  "@types/node-fetch": "2.6.2",
42
42
  "@types/parse-github-url": "1.0.0",
43
- "@types/semver": "7.3.10",
44
- "@typescript-eslint/eslint-plugin": "5.32.0",
45
- "eslint": "8.21.0",
43
+ "@types/semver": "7.3.12",
44
+ "@typescript-eslint/eslint-plugin": "5.33.1",
45
+ "eslint": "8.22.0",
46
46
  "eslint-config-lodash": "1.1.0",
47
47
  "eslint-config-standard-with-typescript": "22.0.0",
48
48
  "eslint-plugin-eslint-comments": "3.2.0",
49
49
  "eslint-plugin-import": "2.26.0",
50
- "eslint-plugin-jest": "26.7.0",
50
+ "eslint-plugin-jest": "26.8.3",
51
51
  "eslint-plugin-lodash": "7.4.0",
52
52
  "eslint-plugin-n": "15.2.4",
53
53
  "eslint-plugin-promise": "6.0.0",
@@ -57,7 +57,7 @@
57
57
  "jest": "28.1.3",
58
58
  "npm-run-all": "4.1.5",
59
59
  "rimraf": "3.0.2",
60
- "ts-jest": "28.0.7",
60
+ "ts-jest": "28.0.8",
61
61
  "ts-node": "10.9.1",
62
62
  "typescript": "4.7.4",
63
63
  "utility-types": "3.10.0"
@@ -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.github.addLabels({
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',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-update-package",
3
- "version": "1.3.6",
3
+ "version": "1.4.2",
4
4
  "description": "CLI tool for creating pull requests to update npm packages",
5
5
  "scripts": {
6
6
  "build": "tsc --project tsconfig.build.json",
@@ -15,7 +15,7 @@
15
15
  "node": ">=14"
16
16
  },
17
17
  "dependencies": {
18
- "@octokit/rest": "19.0.3",
18
+ "@octokit/rest": "19.0.4",
19
19
  "commander": "9.4.0",
20
20
  "execa": "5.1.1",
21
21
  "fp-ts": "2.12.2",
@@ -34,20 +34,20 @@
34
34
  "devDependencies": {
35
35
  "@jest/types": "28.1.3",
36
36
  "@tsconfig/node14": "1.0.3",
37
- "@types/jest": "28.1.6",
37
+ "@types/jest": "28.1.7",
38
38
  "@types/lodash": "4.14.182",
39
39
  "@types/mustache": "4.2.1",
40
- "@types/node": "14.18.23",
40
+ "@types/node": "14.18.24",
41
41
  "@types/node-fetch": "2.6.2",
42
42
  "@types/parse-github-url": "1.0.0",
43
- "@types/semver": "7.3.10",
44
- "@typescript-eslint/eslint-plugin": "5.32.0",
45
- "eslint": "8.21.0",
43
+ "@types/semver": "7.3.12",
44
+ "@typescript-eslint/eslint-plugin": "5.33.1",
45
+ "eslint": "8.22.0",
46
46
  "eslint-config-lodash": "1.1.0",
47
47
  "eslint-config-standard-with-typescript": "22.0.0",
48
48
  "eslint-plugin-eslint-comments": "3.2.0",
49
49
  "eslint-plugin-import": "2.26.0",
50
- "eslint-plugin-jest": "26.7.0",
50
+ "eslint-plugin-jest": "26.8.3",
51
51
  "eslint-plugin-lodash": "7.4.0",
52
52
  "eslint-plugin-n": "15.2.4",
53
53
  "eslint-plugin-promise": "6.0.0",
@@ -57,7 +57,7 @@
57
57
  "jest": "28.1.3",
58
58
  "npm-run-all": "4.1.5",
59
59
  "rimraf": "3.0.2",
60
- "ts-jest": "28.0.7",
60
+ "ts-jest": "28.0.8",
61
61
  "ts-node": "10.9.1",
62
62
  "typescript": "4.7.4",
63
63
  "utility-types": "3.10.0"