npm-update-package 0.22.1 → 0.22.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.
Files changed (3) hide show
  1. package/README.md +71 -10
  2. package/dist/app.js +1 -1
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # npm-update-package
5
5
 
6
- CLI tool for creating pull request to update npm packages
6
+ CLI tool for creating pull requests to update npm packages
7
7
 
8
8
  ## Usage
9
9
 
@@ -21,17 +21,18 @@ Template strings such as `--commit-message` can embed variables like `{{packageN
21
21
  Commit message template
22
22
 
23
23
  - type: string
24
+ - required: false
24
25
  - variables:
25
26
  - `currentVersion`
26
27
  - `newVersion`
27
28
  - `packageName`
28
29
  - `updateType`
29
- - required: false
30
30
  - default: `chore(deps): {{updateType}} update {{{packageName}}} to v{{newVersion}}`
31
31
 
32
32
  ### `--github-token`
33
33
 
34
- GitHub token
34
+ GitHub token.
35
+ See more in [GitHub token](#github-token) section.
35
36
 
36
37
  - type: string
37
38
  - required: true
@@ -41,12 +42,12 @@ GitHub token
41
42
  Log level to show
42
43
 
43
44
  - type: string
45
+ - required: false
44
46
  - allowed values:
45
47
  - `off`: Do not output any logs.
46
48
  - `error`: Output error logs.
47
49
  - `info`: Output error/info logs.
48
50
  - `debug`: Output error/info/debug logs.
49
- - required: false
50
51
  - default: `info`
51
52
 
52
53
  ### `--package-manager`
@@ -54,10 +55,10 @@ Log level to show
54
55
  Package manager of your project
55
56
 
56
57
  - type: string
58
+ - required: false
57
59
  - allowed values:
58
60
  - `npm`
59
61
  - `yarn`
60
- - required: false
61
62
  - default: `npm`
62
63
 
63
64
  ### `--pull-request-title`
@@ -65,17 +66,42 @@ Package manager of your project
65
66
  Pull request title template
66
67
 
67
68
  - type: string
69
+ - required: false
68
70
  - variables:
69
71
  - `currentVersion`
70
72
  - `newVersion`
71
73
  - `packageName`
72
74
  - `updateType`
73
- - required: false
74
75
  - default: `chore(deps): {{updateType}} update {{{packageName}}} to v{{newVersion}}`
75
76
 
77
+ ## GitHub token
78
+
79
+ To run npm-update-package, GitHub token is required.
80
+ For example, the following tokens can be used.
81
+
82
+ |GitHub token|Pull request author|Trigger other action|
83
+ |---|---|---|
84
+ |[GitHub Actions](https://docs.github.com/en/actions/security-guides/automatic-token-authentication)|`github-actions`||
85
+ |[GitHub App](https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps)|GitHub App which issued the token|✓|
86
+ |[Personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)|user who issued the token|✓|
87
+
88
+ ### Token of GitHub App
89
+
90
+ These permissions are required.
91
+
92
+ - Contents: Read-only
93
+ - Metadata: Read-only
94
+ - Pull requests: Read & write
95
+
96
+ ### Personal access token
97
+
98
+ These permissions are required.
99
+
100
+ - repo
101
+
76
102
  ## Examples
77
103
 
78
- Example of running npm-update-package on GitHub Actions at 0:00 (UTC) every day:
104
+ - Use token of GitHub Actions
79
105
 
80
106
  ```yaml
81
107
  name: npm-update-package
@@ -98,9 +124,44 @@ jobs:
98
124
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99
125
  ```
100
126
 
127
+
128
+ - Use token of GitHub App
129
+
130
+ ```yaml
131
+ name: npm-update-package
132
+ on:
133
+ schedule:
134
+ - cron: '0 0 * * *'
135
+ jobs:
136
+ npm-update-package:
137
+ runs-on: ubuntu-latest
138
+ steps:
139
+ - uses: actions/checkout@v2
140
+ - uses: actions/setup-node@v2
141
+ - name: Generate token
142
+ id: generate_token
143
+ uses: tibdex/github-app-token@v1
144
+ with:
145
+ app_id: ${{ secrets.APP_ID }}
146
+ private_key: ${{ secrets.PRIVATE_KEY }}
147
+ - run: |
148
+ git config user.name $GIT_USER_NAME
149
+ git config user.email $GIT_USER_EMAIL
150
+ npx npm-update-package --github-token $GITHUB_TOKEN
151
+ env:
152
+ # TODO: Replace with your GitHub App's email
153
+ GIT_USER_EMAIL: 97396142+npm-update-package-bot[bot]@users.noreply.github.com
154
+ # TODO: Replace with your GitHub App's user name
155
+ GIT_USER_NAME: npm-update-package-bot[bot]
156
+ GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
157
+ ```
158
+
101
159
  Actual working examples can be seen in these repositories.
102
160
 
103
- - [npm-update-package/example-npm](https://github.com/npm-update-package/example-npm)
161
+ |Repository|Package manager|GitHub token|
162
+ |---|---|---|
163
+ |[example-npm](https://github.com/npm-update-package/example-npm)|npm|GitHub Actions|
164
+ |[example-github-app](https://github.com/npm-update-package/example-github-app)|npm|GitHub App|
104
165
 
105
166
  ## Flow
106
167
 
@@ -151,6 +212,6 @@ end
151
212
 
152
213
  npm-update-package can be used in environments where Renovate cannot be used for some reason.
153
214
 
154
- ### Conflicts have occurred in PR. What should I do?
215
+ ### Conflicts have occurred in pull request. What should I do?
155
216
 
156
- If conflicts have occurred in PR, close it and run npm-update-package again.
217
+ If conflicts have occurred in pull request, close it and run npm-update-package again.
package/dist/app.js CHANGED
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.app = void 0;
4
4
  exports.app = {
5
5
  name: 'npm-update-package',
6
- version: '0.22.1',
6
+ version: '0.22.2',
7
7
  web: 'https://github.com/npm-update-package/npm-update-package'
8
8
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "npm-update-package",
3
- "version": "0.22.1",
4
- "description": "CLI tool for creating pull request to update npm packages",
3
+ "version": "0.22.2",
4
+ "description": "CLI tool for creating pull requests to update npm packages",
5
5
  "scripts": {
6
6
  "build": "tsc --project tsconfig.build.json",
7
7
  "clean": "rimraf dist",
@@ -20,7 +20,7 @@
20
20
  "@octokit/rest": "18.12.0",
21
21
  "commander": "8.3.0",
22
22
  "execa": "5.1.1",
23
- "fp-ts": "2.11.6",
23
+ "fp-ts": "2.11.7",
24
24
  "io-ts": "2.2.16",
25
25
  "log4js": "6.3.0",
26
26
  "mustache": "4.1.0",
@@ -37,7 +37,7 @@
37
37
  "@types/node": "12.20.40",
38
38
  "@types/parse-github-url": "1.0.0",
39
39
  "@types/semver": "7.3.9",
40
- "@typescript-eslint/eslint-plugin": "5.9.0",
40
+ "@typescript-eslint/eslint-plugin": "5.9.1",
41
41
  "eslint": "8.6.0",
42
42
  "eslint-config-standard-with-typescript": "21.0.1",
43
43
  "eslint-plugin-import": "2.25.4",