npm-update-package 0.28.0 → 0.29.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
@@ -46,8 +46,9 @@ Log level to show
46
46
  - `off`: Do not output any logs.
47
47
  - `fatal`: Output fatal logs.
48
48
  - `error`: Output fatal/error logs.
49
- - `info`: Output fatal/error/info logs.
50
- - `debug`: Output fatal/error/info/debug logs.
49
+ - `warn`: Output fatal/error/warn logs.
50
+ - `info`: Output fatal/error/warn/info logs.
51
+ - `debug`: Output fatal/error/warn/info/debug logs.
51
52
  - default: `info`
52
53
 
53
54
  ### `--package-manager`
@@ -240,18 +241,22 @@ endif
240
241
 
241
242
  :Fetch remote branches;
242
243
  :Fetch pull requests;
243
- :Create label;
244
+
245
+ if (Label does not exist) then (yes)
246
+ :Create label;
247
+ else (no)
248
+ endif
244
249
 
245
250
  group OutdatedPackagesProcessor
246
251
  while (Package exists) is (yes)
247
252
  group OutdatedPackageProcessor
248
- if (Remote branch exists) then (yes)
249
- else (no)
253
+ if (Remote branch does not exist) then (yes)
250
254
  :Create branch;
251
255
  :Update package;
252
256
  :Create pull request;
253
257
  :Close old pull requests;
254
258
  :Remove branch;
259
+ else (no)
255
260
  endif
256
261
  end group
257
262
  endwhile (no)
@@ -264,7 +269,7 @@ end
264
269
  ```
265
270
  -->
266
271
 
267
- [![](http://www.plantuml.com/plantuml/svg/RP3DReCm48Jl-nHpX4DU85nILMgFZIhr0HpO1AiBTkrrVzw-E3W4f5pusLcFlvb3L1Cq3KBN3xe4bpm6OqVQlxB29UsCSWTlsazpuTWGsJEg9v5b11COoU_KxV9k3UrvHFN7iIQ0nuvO8gCQNKtJdpqJxLzOsnw11wUCKp1ZssVlClT9P1A_4aVDq-V0HXbYJYmD5SYtWdOi6CVWMexH1VhfhJ2g8e1_xMHJmyO5wg73tG386T_NT8lBDjmI300APpdHpBCFd--ubTLi5jSvRuguo73IRKieQaRwNbymztbzpw5omoL_ngAxG9iTEaoFDCW_)](http://www.plantuml.com/plantuml/uml/RP3DReCm48Jl-nHpX4DU85nILMgFZIhr0HpO1AiBTkrrVzw-E3W4f5pusLcFlvb3L1Cq3KBN3xe4bpm6OqVQlxB29UsCSWTlsazpuTWGsJEg9v5b11COoU_KxV9k3UrvHFN7iIQ0nuvO8gCQNKtJdpqJxLzOsnw11wUCKp1ZssVlClT9P1A_4aVDq-V0HXbYJYmD5SYtWdOi6CVWMexH1VhfhJ2g8e1_xMHJmyO5wg73tG386T_NT8lBDjmI300APpdHpBCFd--ubTLi5jSvRuguo73IRKieQaRwNbymztbzpw5omoL_ngAxG9iTEaoFDCW_)
272
+ [![](http://www.plantuml.com/plantuml/svg/VL1BJiCm4DtFATuoMVG2pQO82JP8L4WSm4scJSGa3fundzjJrqsJ5iJ6dtbFypuRDHSizaAd1ns2ZoDwrmsqVcI3ZzOuumQZgz_SWRKYwlOexaGk8xZ0YEFA_2fnIrZB0uflrf807XfYKKOn-9AElsvFj7vWgri4xhqnTi4DTSjQJVCnYY3mUsIrIV79xLZGU5OCti1VdTgDrFe-i3E696hrMpM7Upv7sfxjRuElMTK7-cmxOHHd84jeYKul2dzkc1S0oUdBCjN_ZcVFcLtbsUkOzay5LrV4PJSJ8buPNfgRuZAQx7mi1UPUW5Cp-SxXKbUd7ZA3Pe2kEBGv7h6N7m00)](http://www.plantuml.com/plantuml/uml/VL1BJiCm4DtFATuoMVG2pQO82JP8L4WSm4scJSGa3fundzjJrqsJ5iJ6dtbFypuRDHSizaAd1ns2ZoDwrmsqVcI3ZzOuumQZgz_SWRKYwlOexaGk8xZ0YEFA_2fnIrZB0uflrf807XfYKKOn-9AElsvFj7vWgri4xhqnTi4DTSjQJVCnYY3mUsIrIV79xLZGU5OCti1VdTgDrFe-i3E696hrMpM7Upv7sfxjRuElMTK7-cmxOHHd84jeYKul2dzkc1S0oUdBCjN_ZcVFcLtbsUkOzay5LrV4PJSJ8buPNfgRuZAQx7mi1UPUW5Cp-SxXKbUd7ZA3Pe2kEBGv7h6N7m00)
268
273
 
269
274
  ## FAQ
270
275
 
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.28.0',
6
+ version: '0.29.0',
7
7
  web: 'https://github.com/npm-update-package/npm-update-package'
8
8
  };
@@ -10,8 +10,23 @@ class LabelCreator {
10
10
  this.logger = logger;
11
11
  }
12
12
  async create({ name, description, color }) {
13
+ const label = await this.fetchLabel(name);
14
+ if (label !== undefined) {
15
+ this.logger.info(`Skip creating ${name} label because it already exists.`);
16
+ return;
17
+ }
18
+ await this.github.createLabel({
19
+ owner: this.gitRepo.owner,
20
+ repo: this.gitRepo.name,
21
+ name,
22
+ description,
23
+ color
24
+ });
25
+ this.logger.info(`${name} label has created.`);
26
+ }
27
+ async fetchLabel(name) {
13
28
  try {
14
- await this.github.fetchLabel({
29
+ return await this.github.fetchLabel({
15
30
  owner: this.gitRepo.owner,
16
31
  repo: this.gitRepo.name,
17
32
  name
@@ -19,14 +34,8 @@ class LabelCreator {
19
34
  }
20
35
  catch (e) {
21
36
  if ((0, errors_1.isNotFoundError)(e)) {
22
- await this.github.createLabel({
23
- owner: this.gitRepo.owner,
24
- repo: this.gitRepo.name,
25
- name,
26
- description,
27
- color
28
- });
29
- this.logger.info(`${name} label has created.`);
37
+ this.logger.warn(e);
38
+ return undefined;
30
39
  }
31
40
  else {
32
41
  throw e;
@@ -6,7 +6,8 @@ exports.LogLevel = {
6
6
  Error: 'error',
7
7
  Fatal: 'fatal',
8
8
  Info: 'info',
9
- Off: 'off'
9
+ Off: 'off',
10
+ Warn: 'warn'
10
11
  };
11
12
  const logLevels = Object.values(exports.LogLevel);
12
13
  const isLogLevel = (value) => logLevels.includes(value);
@@ -8,8 +8,18 @@ const Options = (0, io_ts_1.intersection)([
8
8
  (0, io_ts_1.type)({
9
9
  commitMessage: io_ts_1.string,
10
10
  githubToken: io_ts_1.string,
11
- logLevel: (0, io_ts_1.union)([(0, io_ts_1.literal)(logger_1.LogLevel.Off), (0, io_ts_1.literal)(logger_1.LogLevel.Fatal), (0, io_ts_1.literal)(logger_1.LogLevel.Error), (0, io_ts_1.literal)(logger_1.LogLevel.Info), (0, io_ts_1.literal)(logger_1.LogLevel.Debug)]),
12
- packageManager: (0, io_ts_1.union)([(0, io_ts_1.literal)(package_manager_1.PackageManagerName.Npm), (0, io_ts_1.literal)(package_manager_1.PackageManagerName.Yarn)]),
11
+ logLevel: (0, io_ts_1.union)([
12
+ (0, io_ts_1.literal)(logger_1.LogLevel.Off),
13
+ (0, io_ts_1.literal)(logger_1.LogLevel.Fatal),
14
+ (0, io_ts_1.literal)(logger_1.LogLevel.Error),
15
+ (0, io_ts_1.literal)(logger_1.LogLevel.Warn),
16
+ (0, io_ts_1.literal)(logger_1.LogLevel.Info),
17
+ (0, io_ts_1.literal)(logger_1.LogLevel.Debug)
18
+ ]),
19
+ packageManager: (0, io_ts_1.union)([
20
+ (0, io_ts_1.literal)(package_manager_1.PackageManagerName.Npm),
21
+ (0, io_ts_1.literal)(package_manager_1.PackageManagerName.Yarn)
22
+ ]),
13
23
  pullRequestTitle: io_ts_1.string
14
24
  }),
15
25
  (0, io_ts_1.partial)({
@@ -27,6 +27,7 @@ exports.cliOptions = [
27
27
  logger_1.LogLevel.Off,
28
28
  logger_1.LogLevel.Fatal,
29
29
  logger_1.LogLevel.Error,
30
+ logger_1.LogLevel.Warn,
30
31
  logger_1.LogLevel.Info,
31
32
  logger_1.LogLevel.Debug
32
33
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-update-package",
3
- "version": "0.28.0",
3
+ "version": "0.29.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",
@@ -23,9 +23,9 @@
23
23
  "fp-ts": "2.11.8",
24
24
  "http-status-codes": "2.2.0",
25
25
  "io-ts": "2.2.16",
26
- "log4js": "6.4.0",
26
+ "log4js": "6.4.1",
27
27
  "mustache": "4.1.0",
28
- "npm-check-updates": "12.2.0",
28
+ "npm-check-updates": "12.2.1",
29
29
  "parse-github-url": "1.0.2",
30
30
  "semver": "7.3.5",
31
31
  "type-guards": "0.15.0"
@@ -42,13 +42,13 @@
42
42
  "eslint": "8.7.0",
43
43
  "eslint-config-standard-with-typescript": "21.0.1",
44
44
  "eslint-plugin-import": "2.25.4",
45
- "eslint-plugin-jest": "25.7.0",
45
+ "eslint-plugin-jest": "26.0.0",
46
46
  "eslint-plugin-node": "11.1.0",
47
47
  "eslint-plugin-promise": "6.0.0",
48
48
  "eslint-plugin-tsdoc": "0.2.14",
49
49
  "husky": "7.0.4",
50
50
  "jest": "27.4.7",
51
- "lint-staged": "12.2.2",
51
+ "lint-staged": "12.3.1",
52
52
  "npm-run-all": "4.1.5",
53
53
  "rimraf": "3.0.2",
54
54
  "ts-jest": "27.1.3",