npm-update-package 0.51.0 → 0.53.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 CHANGED
@@ -7,6 +7,40 @@
7
7
 
8
8
  CLI tool for creating pull requests to update npm packages
9
9
 
10
+ ## Table of Contents
11
+
12
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
13
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
14
+
15
+ - [Usage](#usage)
16
+ - [Options](#options)
17
+ - [assignees](#assignees)
18
+ - [commitMessage](#commitmessage)
19
+ - [fetchReleaseNotes](#fetchreleasenotes)
20
+ - [fetchSleepTime](#fetchsleeptime)
21
+ - [gitUserEmail](#gituseremail)
22
+ - [gitUserName](#gitusername)
23
+ - [githubToken](#githubtoken)
24
+ - [ignorePackages](#ignorepackages)
25
+ - [logLevel](#loglevel)
26
+ - [packageManager](#packagemanager)
27
+ - [prBodyNotes](#prbodynotes)
28
+ - [prTitle](#prtitle)
29
+ - [reviewers](#reviewers)
30
+ - [GitHub token](#github-token)
31
+ - [Examples](#examples)
32
+ - [Use token of GitHub Actions](#use-token-of-github-actions)
33
+ - [Use token of GitHub App](#use-token-of-github-app)
34
+ - [Use Personal access token](#use-personal-access-token)
35
+ - [Use Yarn](#use-yarn)
36
+ - [Flow](#flow)
37
+ - [FAQ](#faq)
38
+ - [What is the purpose of npm-update-package?](#what-is-the-purpose-of-npm-update-package)
39
+ - [What should I do if conflicts occurred in the pull request?](#what-should-i-do-if-conflicts-occurred-in-the-pull-request)
40
+ - [How to development](#how-to-development)
41
+
42
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
43
+
10
44
  ## Usage
11
45
 
12
46
  ```sh
@@ -15,19 +49,20 @@ npx npm-update-package --github-token $GITHUB_TOKEN
15
49
 
16
50
  ## Options
17
51
 
18
- You can customize behavior via command-line options.
52
+ You can customize behavior via CLI options.
19
53
  Some options can embed variables like `{{packageName}}`(HTML-escaped) or `{{{packageName}}}`(not HTML-escaped).
20
54
 
21
- ### `--assignees`
55
+ ### assignees
22
56
 
23
57
  User names to assign to pull request.
24
58
 
25
59
  |Name|Value|
26
60
  |---|---|
61
+ |cli|`--assignees`|
27
62
  |type|string[]|
28
63
  |required|false|
29
64
 
30
- #### Example
65
+ Example:
31
66
 
32
67
  ```sh
33
68
  npx npm-update-package \
@@ -35,17 +70,18 @@ npx npm-update-package \
35
70
  --assignees octocat mona
36
71
  ```
37
72
 
38
- ### `--commit-message`
73
+ ### commitMessage
39
74
 
40
75
  Commit message template.
41
76
 
42
77
  |Name|Value|
43
78
  |---|---|
79
+ |cli|`--commit-message`|
44
80
  |type|string|
45
81
  |required|false|
46
82
  |default|`chore(deps): {{{level}}} update {{{packageName}}} to v{{{newVersion}}}`|
47
83
 
48
- #### Available variables
84
+ Available variables:
49
85
 
50
86
  |Variable|Description|
51
87
  |---|---|
@@ -55,7 +91,7 @@ Commit message template.
55
91
  |`level`|Semver level (`major`/`minor`/`patch`)|
56
92
  |`dependencyType`|Dependency type (`dependencies`/`devDependencies`/`peerDependencies`/`optionalDependencies`)|
57
93
 
58
- #### Example
94
+ Example:
59
95
 
60
96
  ```sh
61
97
  npx npm-update-package \
@@ -63,17 +99,18 @@ npx npm-update-package \
63
99
  --commit-message "chore({{{dependencyType}}}): {{{level}}} update {{{packageName}}} from {{{currentVersion}}} to v{{{newVersion}}}"
64
100
  ```
65
101
 
66
- ### `--fetch-release-notes`
102
+ ### fetchReleaseNotes
67
103
 
68
104
  Whether to fetch release notes.
69
105
 
70
106
  |Name|Value|
71
107
  |---|---|
108
+ |cli|`--fetch-release-notes`|
72
109
  |type|boolean|
73
110
  |required|false|
74
111
  |default|`true`|
75
112
 
76
- #### Example
113
+ Example:
77
114
 
78
115
  ```sh
79
116
  npx npm-update-package \
@@ -81,17 +118,18 @@ npx npm-update-package \
81
118
  --fetch-release-notes false
82
119
  ```
83
120
 
84
- ### `--fetch-sleep-time`
121
+ ### fetchSleepTime
85
122
 
86
123
  Sleep time between fetching (ms).
87
124
 
88
125
  |Name|Value|
89
126
  |---|---|
127
+ |cli|`--fetch-sleep-time`|
90
128
  |type|number|
91
129
  |required|false|
92
130
  |default|`1000`|
93
131
 
94
- #### Example
132
+ Example:
95
133
 
96
134
  ```sh
97
135
  npx npm-update-package \
@@ -99,25 +137,63 @@ npx npm-update-package \
99
137
  --fetch-sleep-time 2000
100
138
  ```
101
139
 
102
- ### `--github-token`
140
+ ### gitUserEmail
141
+
142
+ Git user email.
143
+
144
+ |Name|Value|
145
+ |---|---|
146
+ |cli|`--git-user-email`|
147
+ |type|string|
148
+ |required|false|
149
+
150
+ Example:
151
+
152
+ ```sh
153
+ npx npm-update-package \
154
+ --github-token $GITHUB_TOKEN \
155
+ --git-user-email octocat@example.com
156
+ ```
157
+
158
+ ### gitUserName
159
+
160
+ Git user name.
161
+
162
+ |Name|Value|
163
+ |---|---|
164
+ |cli|`--git-user-name`|
165
+ |type|string|
166
+ |required|false|
167
+
168
+ Example:
169
+
170
+ ```sh
171
+ npx npm-update-package \
172
+ --github-token $GITHUB_TOKEN \
173
+ --git-user-name octocat
174
+ ```
175
+
176
+ ### githubToken
103
177
 
104
178
  [GitHub token](#github-token).
105
179
 
106
180
  |Name|Value|
107
181
  |---|---|
182
+ |cli|`--github-token`|
108
183
  |type|string|
109
184
  |required|true|
110
185
 
111
- ### `--ignore-packages`
186
+ ### ignorePackages
112
187
 
113
188
  Package names to ignore.
114
189
 
115
190
  |Name|Value|
116
191
  |---|---|
192
+ |cli|`--ignore-packages`|
117
193
  |type|string[]|
118
194
  |required|false|
119
195
 
120
- #### Example
196
+ Example:
121
197
 
122
198
  ```sh
123
199
  npx npm-update-package \
@@ -125,17 +201,18 @@ npx npm-update-package \
125
201
  --ignore-packages @types/jest jest
126
202
  ```
127
203
 
128
- ### `--log-level`
204
+ ### logLevel
129
205
 
130
206
  Log level to show.
131
207
 
132
208
  |Name|Value|
133
209
  |---|---|
210
+ |cli|`--log-level`|
134
211
  |type|string|
135
212
  |required|false|
136
213
  |default|`info`|
137
214
 
138
- #### Allowed values
215
+ Allowed values:
139
216
 
140
217
  |Value|Description|
141
218
  |---|---|
@@ -147,7 +224,7 @@ Log level to show.
147
224
  |`debug`|Output fatal/error/warn/info/debug logs.|
148
225
  |`trace`|Output fatal/error/warn/info/debug/trace logs.|
149
226
 
150
- #### Example
227
+ Example:
151
228
 
152
229
  ```sh
153
230
  npx npm-update-package \
@@ -155,24 +232,25 @@ npx npm-update-package \
155
232
  --log-level debug
156
233
  ```
157
234
 
158
- ### `--package-manager`
235
+ ### packageManager
159
236
 
160
237
  Package manager of your project.
161
238
 
162
239
  |Name|Value|
163
240
  |---|---|
241
+ |cli|`--package-manager`|
164
242
  |type|string|
165
243
  |required|false|
166
244
  |default|`npm`|
167
245
 
168
- #### Allowed values
246
+ Allowed values:
169
247
 
170
248
  |Value|Description|
171
249
  |---|---|
172
250
  |`npm`|npm|
173
251
  |`yarn`|Yarn|
174
252
 
175
- #### Example
253
+ Example:
176
254
 
177
255
  ```sh
178
256
  npx npm-update-package \
@@ -180,16 +258,17 @@ npx npm-update-package \
180
258
  --package-manager yarn
181
259
  ```
182
260
 
183
- ### `--pr-body-notes`
261
+ ### prBodyNotes
184
262
 
185
263
  Additional notes for Pull request body.
186
264
 
187
265
  |Name|Value|
188
266
  |---|---|
267
+ |cli|`--pr-body-notes`|
189
268
  |type|string|
190
269
  |required|false|
191
270
 
192
- #### Example
271
+ Example:
193
272
 
194
273
  ```sh
195
274
  npx npm-update-package \
@@ -197,17 +276,18 @@ npx npm-update-package \
197
276
  --pr-body-notes "**:warning: Please see diff and release notes before merging.**"
198
277
  ```
199
278
 
200
- ### `--pr-title`
279
+ ### prTitle
201
280
 
202
281
  Pull request title template.
203
282
 
204
283
  |Name|Value|
205
284
  |---|---|
285
+ |cli|`--pr-title`|
206
286
  |type|string|
207
287
  |required|false|
208
288
  |default|`chore(deps): {{{level}}} update {{{packageName}}} to v{{{newVersion}}}`|
209
289
 
210
- #### Available variables
290
+ Available variables:
211
291
 
212
292
  |Variable|Description|
213
293
  |---|---|
@@ -217,7 +297,7 @@ Pull request title template.
217
297
  |`level`|Semver level (`major`/`minor`/`patch`)|
218
298
  |`dependencyType`|Dependency type (`dependencies`/`devDependencies`/`peerDependencies`/`optionalDependencies`)|
219
299
 
220
- #### Example
300
+ Example:
221
301
 
222
302
  ```sh
223
303
  npx npm-update-package \
@@ -225,16 +305,17 @@ npx npm-update-package \
225
305
  --pr-title "chore({{{dependencyType}}}): {{{level}}} update {{{packageName}}} from {{{currentVersion}}} to v{{{newVersion}}}"
226
306
  ```
227
307
 
228
- ### `--reviewers`
308
+ ### reviewers
229
309
 
230
310
  User names to request reviews.
231
311
 
232
312
  |Name|Value|
233
313
  |---|---|
314
+ |cli|`--reviewers`|
234
315
  |type|string[]|
235
316
  |required|false|
236
317
 
237
- #### Example
318
+ Example:
238
319
 
239
320
  ```sh
240
321
  npx npm-update-package \
@@ -273,7 +354,7 @@ Creating a GitHub App may be tedious, but you only have to do it once the first
273
354
 
274
355
  ## Examples
275
356
 
276
- - [Use token of GitHub Actions](https://github.com/npm-update-package/example-github-actions)
357
+ ### Use token of GitHub Actions
277
358
 
278
359
  ```yaml
279
360
  name: npm-update-package
@@ -296,7 +377,9 @@ jobs:
296
377
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
297
378
  ```
298
379
 
299
- - [Use token of GitHub App](https://github.com/npm-update-package/example-github-app)
380
+ See working example on [example-github-actions](https://github.com/npm-update-package/example-github-actions).
381
+
382
+ ### Use token of GitHub App
300
383
 
301
384
  ```yaml
302
385
  name: npm-update-package
@@ -327,7 +410,9 @@ jobs:
327
410
  GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
328
411
  ```
329
412
 
330
- - [Use Personal access token](https://github.com/npm-update-package/example-pat)
413
+ See working example on [example-github-app](https://github.com/npm-update-package/example-github-app).
414
+
415
+ ### Use Personal access token
331
416
 
332
417
  ```yaml
333
418
  name: npm-update-package
@@ -352,7 +437,9 @@ jobs:
352
437
  GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
353
438
  ```
354
439
 
355
- - [Use Yarn](https://github.com/npm-update-package/example-yarn)
440
+ See working example on [example-pat](https://github.com/npm-update-package/example-pat).
441
+
442
+ ### Use Yarn
356
443
 
357
444
  ```yaml
358
445
  name: npm-update-package
@@ -383,6 +470,8 @@ jobs:
383
470
  GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
384
471
  ```
385
472
 
473
+ See working example on [example-yarn](https://github.com/npm-update-package/example-yarn).
474
+
386
475
  ## Flow
387
476
 
388
477
  The following shows the process flow of npm-update-package.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-update-package",
3
- "version": "0.51.0",
3
+ "version": "0.53.0",
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
  "bin": "dist/src/bin.js",
16
16
  "dependencies": {
17
17
  "@octokit/rest": "18.12.0",
18
- "commander": "8.3.0",
18
+ "commander": "9.1.0",
19
19
  "execa": "5.1.1",
20
20
  "fp-ts": "2.11.9",
21
21
  "http-status-codes": "2.2.0",
@@ -33,14 +33,14 @@
33
33
  "devDependencies": {
34
34
  "@jest/types": "27.4.2",
35
35
  "@tsconfig/node12": "1.0.9",
36
- "@types/jest": "27.4.0",
37
- "@types/lodash": "4.14.180",
36
+ "@types/jest": "27.4.1",
37
+ "@types/lodash": "4.14.181",
38
38
  "@types/mustache": "4.1.2",
39
39
  "@types/node": "12.20.40",
40
40
  "@types/node-fetch": "2.6.1",
41
41
  "@types/parse-github-url": "1.0.0",
42
42
  "@types/semver": "7.3.9",
43
- "@typescript-eslint/eslint-plugin": "5.16.0",
43
+ "@typescript-eslint/eslint-plugin": "5.17.0",
44
44
  "eslint": "8.12.0",
45
45
  "eslint-config-standard-with-typescript": "21.0.1",
46
46
  "eslint-plugin-import": "2.25.4",
@@ -27,6 +27,9 @@ class Git {
27
27
  async restore(...files) {
28
28
  await this.terminal.run('git', 'checkout', ...files);
29
29
  }
30
+ async setConfig(key, value) {
31
+ await this.terminal.run('git', 'config', key, value);
32
+ }
30
33
  async switch(branchName) {
31
34
  await this.terminal.run('git', 'checkout', branchName);
32
35
  }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GitConfigInitializer = void 0;
4
+ class GitConfigInitializer {
5
+ constructor({ options, git }) {
6
+ this.options = options;
7
+ this.git = git;
8
+ }
9
+ async initialize() {
10
+ if (this.options.gitUserName !== undefined) {
11
+ await this.git.setConfig('user.name', this.options.gitUserName);
12
+ }
13
+ if (this.options.gitUserEmail !== undefined) {
14
+ await this.git.setConfig('user.email', this.options.gitUserEmail);
15
+ }
16
+ }
17
+ }
18
+ exports.GitConfigInitializer = GitConfigInitializer;
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./CommitMessageCreator"), exports);
18
18
  __exportStar(require("./createBranchName"), exports);
19
19
  __exportStar(require("./Git"), exports);
20
+ __exportStar(require("./GitConfigInitializer"), exports);
20
21
  __exportStar(require("./GitRepository"), exports);
@@ -13,6 +13,7 @@ const createPackageDiffsSection = ({ outdatedPackage, gitRepo }) => {
13
13
  links.push(`- [GitHub](${optimizedUrl})`);
14
14
  }
15
15
  links.push(`- [npmfs](https://npmfs.com/compare/${packageName}/${currentVersion}/${newVersion})`);
16
+ links.push(`- [Package Diff](https://diff.intrinsic.com/${packageName}/${currentVersion}/${newVersion})`);
16
17
  links.push(`- [Renovate Bot Package Diff](https://renovatebot.com/diffs/npm/${packageName}/${currentVersion}/${newVersion})`);
17
18
  return `## Package diffs
18
19
 
package/dist/src/main.js CHANGED
@@ -108,6 +108,11 @@ const main = async ({ options, logger }) => {
108
108
  pullRequestsCloser,
109
109
  packageUpdater
110
110
  });
111
+ const gitConfigInitializer = new git_1.GitConfigInitializer({
112
+ options,
113
+ git
114
+ });
115
+ await gitConfigInitializer.initialize();
111
116
  const outdatedPackagesProcessor = new core_1.OutdatedPackagesProcessor({
112
117
  outdatedPackageProcessor,
113
118
  logger
@@ -27,6 +27,8 @@ const Options = (0, io_ts_1.intersection)([
27
27
  }),
28
28
  (0, io_ts_1.partial)({
29
29
  assignees: (0, io_ts_1.array)(io_ts_1.string),
30
+ gitUserEmail: io_ts_1.string,
31
+ gitUserName: io_ts_1.string,
30
32
  ignorePackages: (0, io_ts_1.array)(io_ts_1.string),
31
33
  prBodyNotes: io_ts_1.string,
32
34
  reviewers: (0, io_ts_1.array)(io_ts_1.string)
@@ -32,6 +32,18 @@ exports.cliOptions = [
32
32
  required: false,
33
33
  default: 1000
34
34
  },
35
+ {
36
+ name: 'git-user-email',
37
+ description: 'Git user email',
38
+ type: OptionType_1.OptionType.String,
39
+ required: false
40
+ },
41
+ {
42
+ name: 'git-user-name',
43
+ description: 'Git user name',
44
+ type: OptionType_1.OptionType.String,
45
+ required: false
46
+ },
35
47
  {
36
48
  name: 'github-token',
37
49
  description: 'GitHub token',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-update-package",
3
- "version": "0.51.0",
3
+ "version": "0.53.0",
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
  "bin": "dist/src/bin.js",
16
16
  "dependencies": {
17
17
  "@octokit/rest": "18.12.0",
18
- "commander": "8.3.0",
18
+ "commander": "9.1.0",
19
19
  "execa": "5.1.1",
20
20
  "fp-ts": "2.11.9",
21
21
  "http-status-codes": "2.2.0",
@@ -33,14 +33,14 @@
33
33
  "devDependencies": {
34
34
  "@jest/types": "27.4.2",
35
35
  "@tsconfig/node12": "1.0.9",
36
- "@types/jest": "27.4.0",
37
- "@types/lodash": "4.14.180",
36
+ "@types/jest": "27.4.1",
37
+ "@types/lodash": "4.14.181",
38
38
  "@types/mustache": "4.1.2",
39
39
  "@types/node": "12.20.40",
40
40
  "@types/node-fetch": "2.6.1",
41
41
  "@types/parse-github-url": "1.0.0",
42
42
  "@types/semver": "7.3.9",
43
- "@typescript-eslint/eslint-plugin": "5.16.0",
43
+ "@typescript-eslint/eslint-plugin": "5.17.0",
44
44
  "eslint": "8.12.0",
45
45
  "eslint-config-standard-with-typescript": "21.0.1",
46
46
  "eslint-plugin-import": "2.25.4",