npm-update-package 0.52.0 → 0.53.1

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,27 +7,75 @@
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
+ - [Requirements](#requirements)
17
+ - [Supported platforms](#supported-platforms)
18
+ - [Options](#options)
19
+ - [assignees](#assignees)
20
+ - [commitMessage](#commitmessage)
21
+ - [fetchReleaseNotes](#fetchreleasenotes)
22
+ - [fetchSleepTime](#fetchsleeptime)
23
+ - [gitUserEmail](#gituseremail)
24
+ - [gitUserName](#gitusername)
25
+ - [githubToken](#githubtoken)
26
+ - [ignorePackages](#ignorepackages)
27
+ - [logLevel](#loglevel)
28
+ - [packageManager](#packagemanager)
29
+ - [prBodyNotes](#prbodynotes)
30
+ - [prTitle](#prtitle)
31
+ - [reviewers](#reviewers)
32
+ - [GitHub token](#github-token)
33
+ - [Examples](#examples)
34
+ - [Use token of GitHub Actions](#use-token-of-github-actions)
35
+ - [Use token of GitHub App](#use-token-of-github-app)
36
+ - [Use Personal access token](#use-personal-access-token)
37
+ - [Use Yarn](#use-yarn)
38
+ - [Flow](#flow)
39
+ - [FAQ](#faq)
40
+ - [What is the purpose of npm-update-package?](#what-is-the-purpose-of-npm-update-package)
41
+ - [What should I do if conflicts occurred in the pull request?](#what-should-i-do-if-conflicts-occurred-in-the-pull-request)
42
+ - [How to development](#how-to-development)
43
+
44
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
45
+
10
46
  ## Usage
11
47
 
12
48
  ```sh
13
49
  npx npm-update-package --github-token $GITHUB_TOKEN
14
50
  ```
15
51
 
52
+ ## Requirements
53
+
54
+ - Git
55
+ - Node.js
56
+ - npm or Yarn
57
+
58
+ ## Supported platforms
59
+
60
+ - GitHub
61
+ - GitHub Enterprise
62
+
16
63
  ## Options
17
64
 
18
- You can customize behavior via command-line options.
65
+ You can customize behavior via CLI options.
19
66
  Some options can embed variables like `{{packageName}}`(HTML-escaped) or `{{{packageName}}}`(not HTML-escaped).
20
67
 
21
- ### `--assignees`
68
+ ### assignees
22
69
 
23
70
  User names to assign to pull request.
24
71
 
25
72
  |Name|Value|
26
73
  |---|---|
74
+ |cli|`--assignees`|
27
75
  |type|string[]|
28
76
  |required|false|
29
77
 
30
- #### Example
78
+ Example:
31
79
 
32
80
  ```sh
33
81
  npx npm-update-package \
@@ -35,17 +83,18 @@ npx npm-update-package \
35
83
  --assignees octocat mona
36
84
  ```
37
85
 
38
- ### `--commit-message`
86
+ ### commitMessage
39
87
 
40
88
  Commit message template.
41
89
 
42
90
  |Name|Value|
43
91
  |---|---|
92
+ |cli|`--commit-message`|
44
93
  |type|string|
45
94
  |required|false|
46
95
  |default|`chore(deps): {{{level}}} update {{{packageName}}} to v{{{newVersion}}}`|
47
96
 
48
- #### Available variables
97
+ Available variables:
49
98
 
50
99
  |Variable|Description|
51
100
  |---|---|
@@ -55,7 +104,7 @@ Commit message template.
55
104
  |`level`|Semver level (`major`/`minor`/`patch`)|
56
105
  |`dependencyType`|Dependency type (`dependencies`/`devDependencies`/`peerDependencies`/`optionalDependencies`)|
57
106
 
58
- #### Example
107
+ Example:
59
108
 
60
109
  ```sh
61
110
  npx npm-update-package \
@@ -63,17 +112,18 @@ npx npm-update-package \
63
112
  --commit-message "chore({{{dependencyType}}}): {{{level}}} update {{{packageName}}} from {{{currentVersion}}} to v{{{newVersion}}}"
64
113
  ```
65
114
 
66
- ### `--fetch-release-notes`
115
+ ### fetchReleaseNotes
67
116
 
68
117
  Whether to fetch release notes.
69
118
 
70
119
  |Name|Value|
71
120
  |---|---|
121
+ |cli|`--fetch-release-notes`|
72
122
  |type|boolean|
73
123
  |required|false|
74
124
  |default|`true`|
75
125
 
76
- #### Example
126
+ Example:
77
127
 
78
128
  ```sh
79
129
  npx npm-update-package \
@@ -81,17 +131,18 @@ npx npm-update-package \
81
131
  --fetch-release-notes false
82
132
  ```
83
133
 
84
- ### `--fetch-sleep-time`
134
+ ### fetchSleepTime
85
135
 
86
136
  Sleep time between fetching (ms).
87
137
 
88
138
  |Name|Value|
89
139
  |---|---|
140
+ |cli|`--fetch-sleep-time`|
90
141
  |type|number|
91
142
  |required|false|
92
143
  |default|`1000`|
93
144
 
94
- #### Example
145
+ Example:
95
146
 
96
147
  ```sh
97
148
  npx npm-update-package \
@@ -99,25 +150,63 @@ npx npm-update-package \
99
150
  --fetch-sleep-time 2000
100
151
  ```
101
152
 
102
- ### `--github-token`
153
+ ### gitUserEmail
154
+
155
+ Git user email.
156
+
157
+ |Name|Value|
158
+ |---|---|
159
+ |cli|`--git-user-email`|
160
+ |type|string|
161
+ |required|false|
162
+
163
+ Example:
164
+
165
+ ```sh
166
+ npx npm-update-package \
167
+ --github-token $GITHUB_TOKEN \
168
+ --git-user-email octocat@example.com
169
+ ```
170
+
171
+ ### gitUserName
172
+
173
+ Git user name.
174
+
175
+ |Name|Value|
176
+ |---|---|
177
+ |cli|`--git-user-name`|
178
+ |type|string|
179
+ |required|false|
180
+
181
+ Example:
182
+
183
+ ```sh
184
+ npx npm-update-package \
185
+ --github-token $GITHUB_TOKEN \
186
+ --git-user-name octocat
187
+ ```
188
+
189
+ ### githubToken
103
190
 
104
191
  [GitHub token](#github-token).
105
192
 
106
193
  |Name|Value|
107
194
  |---|---|
195
+ |cli|`--github-token`|
108
196
  |type|string|
109
197
  |required|true|
110
198
 
111
- ### `--ignore-packages`
199
+ ### ignorePackages
112
200
 
113
201
  Package names to ignore.
114
202
 
115
203
  |Name|Value|
116
204
  |---|---|
205
+ |cli|`--ignore-packages`|
117
206
  |type|string[]|
118
207
  |required|false|
119
208
 
120
- #### Example
209
+ Example:
121
210
 
122
211
  ```sh
123
212
  npx npm-update-package \
@@ -125,17 +214,18 @@ npx npm-update-package \
125
214
  --ignore-packages @types/jest jest
126
215
  ```
127
216
 
128
- ### `--log-level`
217
+ ### logLevel
129
218
 
130
219
  Log level to show.
131
220
 
132
221
  |Name|Value|
133
222
  |---|---|
223
+ |cli|`--log-level`|
134
224
  |type|string|
135
225
  |required|false|
136
226
  |default|`info`|
137
227
 
138
- #### Allowed values
228
+ Allowed values:
139
229
 
140
230
  |Value|Description|
141
231
  |---|---|
@@ -147,7 +237,7 @@ Log level to show.
147
237
  |`debug`|Output fatal/error/warn/info/debug logs.|
148
238
  |`trace`|Output fatal/error/warn/info/debug/trace logs.|
149
239
 
150
- #### Example
240
+ Example:
151
241
 
152
242
  ```sh
153
243
  npx npm-update-package \
@@ -155,24 +245,25 @@ npx npm-update-package \
155
245
  --log-level debug
156
246
  ```
157
247
 
158
- ### `--package-manager`
248
+ ### packageManager
159
249
 
160
250
  Package manager of your project.
161
251
 
162
252
  |Name|Value|
163
253
  |---|---|
254
+ |cli|`--package-manager`|
164
255
  |type|string|
165
256
  |required|false|
166
257
  |default|`npm`|
167
258
 
168
- #### Allowed values
259
+ Allowed values:
169
260
 
170
261
  |Value|Description|
171
262
  |---|---|
172
263
  |`npm`|npm|
173
264
  |`yarn`|Yarn|
174
265
 
175
- #### Example
266
+ Example:
176
267
 
177
268
  ```sh
178
269
  npx npm-update-package \
@@ -180,16 +271,17 @@ npx npm-update-package \
180
271
  --package-manager yarn
181
272
  ```
182
273
 
183
- ### `--pr-body-notes`
274
+ ### prBodyNotes
184
275
 
185
276
  Additional notes for Pull request body.
186
277
 
187
278
  |Name|Value|
188
279
  |---|---|
280
+ |cli|`--pr-body-notes`|
189
281
  |type|string|
190
282
  |required|false|
191
283
 
192
- #### Example
284
+ Example:
193
285
 
194
286
  ```sh
195
287
  npx npm-update-package \
@@ -197,17 +289,18 @@ npx npm-update-package \
197
289
  --pr-body-notes "**:warning: Please see diff and release notes before merging.**"
198
290
  ```
199
291
 
200
- ### `--pr-title`
292
+ ### prTitle
201
293
 
202
294
  Pull request title template.
203
295
 
204
296
  |Name|Value|
205
297
  |---|---|
298
+ |cli|`--pr-title`|
206
299
  |type|string|
207
300
  |required|false|
208
301
  |default|`chore(deps): {{{level}}} update {{{packageName}}} to v{{{newVersion}}}`|
209
302
 
210
- #### Available variables
303
+ Available variables:
211
304
 
212
305
  |Variable|Description|
213
306
  |---|---|
@@ -217,7 +310,7 @@ Pull request title template.
217
310
  |`level`|Semver level (`major`/`minor`/`patch`)|
218
311
  |`dependencyType`|Dependency type (`dependencies`/`devDependencies`/`peerDependencies`/`optionalDependencies`)|
219
312
 
220
- #### Example
313
+ Example:
221
314
 
222
315
  ```sh
223
316
  npx npm-update-package \
@@ -225,16 +318,17 @@ npx npm-update-package \
225
318
  --pr-title "chore({{{dependencyType}}}): {{{level}}} update {{{packageName}}} from {{{currentVersion}}} to v{{{newVersion}}}"
226
319
  ```
227
320
 
228
- ### `--reviewers`
321
+ ### reviewers
229
322
 
230
323
  User names to request reviews.
231
324
 
232
325
  |Name|Value|
233
326
  |---|---|
327
+ |cli|`--reviewers`|
234
328
  |type|string[]|
235
329
  |required|false|
236
330
 
237
- #### Example
331
+ Example:
238
332
 
239
333
  ```sh
240
334
  npx npm-update-package \
@@ -273,7 +367,7 @@ Creating a GitHub App may be tedious, but you only have to do it once the first
273
367
 
274
368
  ## Examples
275
369
 
276
- - [Use token of GitHub Actions](https://github.com/npm-update-package/example-github-actions)
370
+ ### Use token of GitHub Actions
277
371
 
278
372
  ```yaml
279
373
  name: npm-update-package
@@ -287,16 +381,19 @@ jobs:
287
381
  - uses: actions/checkout@v2
288
382
  - uses: actions/setup-node@v2
289
383
  - run: |
290
- git config user.name $GIT_USER_NAME
291
- git config user.email $GIT_USER_EMAIL
292
- npx npm-update-package --github-token $GITHUB_TOKEN
384
+ npx npm-update-package \
385
+ --github-token $GITHUB_TOKEN \
386
+ --git-user-name $GIT_USER_NAME \
387
+ --git-user-email $GIT_USER_EMAIL
293
388
  env:
294
389
  GIT_USER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
295
390
  GIT_USER_NAME: github-actions[bot]
296
391
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
297
392
  ```
298
393
 
299
- - [Use token of GitHub App](https://github.com/npm-update-package/example-github-app)
394
+ See working example on [example-github-actions](https://github.com/npm-update-package/example-github-actions).
395
+
396
+ ### Use token of GitHub App
300
397
 
301
398
  ```yaml
302
399
  name: npm-update-package
@@ -316,9 +413,10 @@ jobs:
316
413
  app_id: ${{ secrets.APP_ID }}
317
414
  private_key: ${{ secrets.PRIVATE_KEY }}
318
415
  - run: |
319
- git config user.name $GIT_USER_NAME
320
- git config user.email $GIT_USER_EMAIL
321
- npx npm-update-package --github-token $GITHUB_TOKEN
416
+ npx npm-update-package \
417
+ --github-token $GITHUB_TOKEN \
418
+ --git-user-name $GIT_USER_NAME \
419
+ --git-user-email $GIT_USER_EMAIL
322
420
  env:
323
421
  # TODO: Replace with your GitHub App's email
324
422
  GIT_USER_EMAIL: 97396142+npm-update-package[bot]@users.noreply.github.com
@@ -327,7 +425,9 @@ jobs:
327
425
  GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
328
426
  ```
329
427
 
330
- - [Use Personal access token](https://github.com/npm-update-package/example-pat)
428
+ See working example on [example-github-app](https://github.com/npm-update-package/example-github-app).
429
+
430
+ ### Use Personal access token
331
431
 
332
432
  ```yaml
333
433
  name: npm-update-package
@@ -341,9 +441,10 @@ jobs:
341
441
  - uses: actions/checkout@v2
342
442
  - uses: actions/setup-node@v2
343
443
  - run: |
344
- git config user.name $GIT_USER_NAME
345
- git config user.email $GIT_USER_EMAIL
346
- npx npm-update-package --github-token $GITHUB_TOKEN
444
+ npx npm-update-package \
445
+ --github-token $GITHUB_TOKEN \
446
+ --git-user-name $GIT_USER_NAME \
447
+ --git-user-email $GIT_USER_EMAIL
347
448
  env:
348
449
  # TODO: Replace with your email
349
450
  GIT_USER_EMAIL: 97961304+npm-update-package-bot@users.noreply.github.com
@@ -352,7 +453,9 @@ jobs:
352
453
  GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
353
454
  ```
354
455
 
355
- - [Use Yarn](https://github.com/npm-update-package/example-yarn)
456
+ See working example on [example-pat](https://github.com/npm-update-package/example-pat).
457
+
458
+ ### Use Yarn
356
459
 
357
460
  ```yaml
358
461
  name: npm-update-package
@@ -372,9 +475,11 @@ jobs:
372
475
  app_id: ${{ secrets.APP_ID }}
373
476
  private_key: ${{ secrets.PRIVATE_KEY }}
374
477
  - run: |
375
- git config user.name $GIT_USER_NAME
376
- git config user.email $GIT_USER_EMAIL
377
- npx npm-update-package --github-token $GITHUB_TOKEN --package-manager yarn
478
+ npx npm-update-package \
479
+ --github-token $GITHUB_TOKEN \
480
+ --git-user-name $GIT_USER_NAME \
481
+ --git-user-email $GIT_USER_EMAIL \
482
+ --package-manager yarn
378
483
  env:
379
484
  # TODO: Replace with your GitHub App's email
380
485
  GIT_USER_EMAIL: 97396142+npm-update-package[bot]@users.noreply.github.com
@@ -383,6 +488,8 @@ jobs:
383
488
  GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
384
489
  ```
385
490
 
491
+ See working example on [example-yarn](https://github.com/npm-update-package/example-yarn).
492
+
386
493
  ## Flow
387
494
 
388
495
  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.52.0",
3
+ "version": "0.53.1",
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",
@@ -24,7 +24,7 @@
24
24
  "log4js": "6.4.4",
25
25
  "mustache": "4.1.0",
26
26
  "node-fetch": "2.6.7",
27
- "npm-check-updates": "12.5.4",
27
+ "npm-check-updates": "12.5.5",
28
28
  "parse-github-url": "1.0.2",
29
29
  "semver": "7.3.5",
30
30
  "sleep-promise": "9.1.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
- "@types/node": "12.20.40",
39
+ "@types/node": "12.20.47",
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);
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.52.0",
3
+ "version": "0.53.1",
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",
@@ -24,7 +24,7 @@
24
24
  "log4js": "6.4.4",
25
25
  "mustache": "4.1.0",
26
26
  "node-fetch": "2.6.7",
27
- "npm-check-updates": "12.5.4",
27
+ "npm-check-updates": "12.5.5",
28
28
  "parse-github-url": "1.0.2",
29
29
  "semver": "7.3.5",
30
30
  "sleep-promise": "9.1.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
- "@types/node": "12.20.40",
39
+ "@types/node": "12.20.47",
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",