npm-update-package 0.28.1 → 0.30.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,10 @@ 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.
52
+ - `trace`: Output fatal/error/warn/info/debug/trace logs.
51
53
  - default: `info`
52
54
 
53
55
  ### `--package-manager`
@@ -240,18 +242,22 @@ endif
240
242
 
241
243
  :Fetch remote branches;
242
244
  :Fetch pull requests;
243
- :Create label;
245
+
246
+ if (Label does not exist) then (yes)
247
+ :Create label;
248
+ else (no)
249
+ endif
244
250
 
245
251
  group OutdatedPackagesProcessor
246
252
  while (Package exists) is (yes)
247
253
  group OutdatedPackageProcessor
248
- if (Remote branch exists) then (yes)
249
- else (no)
254
+ if (Remote branch does not exist) then (yes)
250
255
  :Create branch;
251
256
  :Update package;
252
257
  :Create pull request;
253
258
  :Close old pull requests;
254
259
  :Remove branch;
260
+ else (no)
255
261
  endif
256
262
  end group
257
263
  endwhile (no)
@@ -264,7 +270,7 @@ end
264
270
  ```
265
271
  -->
266
272
 
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_)
273
+ [![](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
274
 
269
275
  ## FAQ
270
276
 
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.1',
6
+ version: '0.30.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,9 @@ exports.LogLevel = {
6
6
  Error: 'error',
7
7
  Fatal: 'fatal',
8
8
  Info: 'info',
9
- Off: 'off'
9
+ Off: 'off',
10
+ Trace: 'trace',
11
+ Warn: 'warn'
10
12
  };
11
13
  const logLevels = Object.values(exports.LogLevel);
12
14
  const isLogLevel = (value) => logLevels.includes(value);
@@ -8,8 +8,19 @@ 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
+ (0, io_ts_1.literal)(logger_1.LogLevel.Trace)
19
+ ]),
20
+ packageManager: (0, io_ts_1.union)([
21
+ (0, io_ts_1.literal)(package_manager_1.PackageManagerName.Npm),
22
+ (0, io_ts_1.literal)(package_manager_1.PackageManagerName.Yarn)
23
+ ]),
13
24
  pullRequestTitle: io_ts_1.string
14
25
  }),
15
26
  (0, io_ts_1.partial)({
@@ -27,8 +27,10 @@ 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
- logger_1.LogLevel.Debug
32
+ logger_1.LogLevel.Debug,
33
+ logger_1.LogLevel.Trace
32
34
  ],
33
35
  default: logger_1.LogLevel.Info
34
36
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-update-package",
3
- "version": "0.28.1",
3
+ "version": "0.30.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",
@@ -38,11 +38,11 @@
38
38
  "@types/node": "12.20.40",
39
39
  "@types/parse-github-url": "1.0.0",
40
40
  "@types/semver": "7.3.9",
41
- "@typescript-eslint/eslint-plugin": "5.10.0",
41
+ "@typescript-eslint/eslint-plugin": "5.10.1",
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",