@k03mad/ip2geo 12.16.0 → 12.16.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 (2) hide show
  1. package/app/cli.js +13 -13
  2. package/package.json +1 -2
package/app/cli.js CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import {log, logErrorExit} from '@k03mad/simple-log';
4
3
  import chalk from 'chalk';
5
4
 
6
5
  import {DEFAULT_CACHE_FILE_DIR, DEFAULT_CACHE_FILE_NEWLINE, DEFAULT_CACHE_FILE_SEPARATOR, ip2geo} from './api.js';
@@ -18,7 +17,7 @@ const isPrune = args.includes('-p') || args.includes('--prune');
18
17
  if (isHelp) {
19
18
  const cmd = `${codeText('$')} ${nameText('ip2geo')}`;
20
19
 
21
- log([
20
+ console.log([
22
21
  '',
23
22
  codeText('# current external ip'),
24
23
  cmd,
@@ -36,14 +35,14 @@ if (isHelp) {
36
35
  codeText('# remove duplicate cache entries'),
37
36
  `${cmd} -p`,
38
37
  `${cmd} --prune`,
39
- ]);
38
+ ].join('\n'));
40
39
 
41
40
  process.exit(0);
42
41
  }
43
42
 
44
43
  if (isPrune) {
45
44
  const cacheFolder = argsExtra[0] || DEFAULT_CACHE_FILE_DIR;
46
- log(blue(cacheFolder));
45
+ console.log(blue(cacheFolder));
47
46
 
48
47
  try {
49
48
  const {
@@ -58,7 +57,7 @@ if (isPrune) {
58
57
  DEFAULT_CACHE_FILE_NEWLINE,
59
58
  );
60
59
 
61
- log([
60
+ console.log([
62
61
  '',
63
62
  green(`Removed duplicate cache entries: ${bold(duplicates.length)}`),
64
63
  ...duplicates.map(elem => dim(`— ${elem}`)),
@@ -66,21 +65,22 @@ if (isPrune) {
66
65
  ...different.map(elem => dim(`— ${elem}`)),
67
66
  green(`Removed empty cache entries: ${bold(empty.length)}`),
68
67
  ...empty.map(elem => dim(`— ${elem}`)),
69
- ]);
68
+ ].join('\n'));
70
69
 
71
70
  if (longLinesFiles.length > 0) {
72
- log([
71
+ console.log([
73
72
  red(`Required manual check, some cache files has too long lines: ${bold(longLinesFiles.length)}`),
74
73
  ...longLinesFiles.map(({file, elem}) => dim(`— ${file}\n|— ${elem}`)),
75
- ]);
74
+ ].join('\n'));
76
75
  }
77
76
 
78
- log([
77
+ console.log([
79
78
  '',
80
79
  green(`Current cache entries: ${bold(entries)}`),
81
- ]);
80
+ ].join('\n'));
82
81
  } catch (err) {
83
- logErrorExit(red(err));
82
+ console.error(red(err));
83
+ process.exit(1);
84
84
  }
85
85
  } else {
86
86
  const output = argsExtra.length === 0
@@ -90,8 +90,8 @@ if (isPrune) {
90
90
  const flatten = output.flat();
91
91
 
92
92
  if (args.includes('--json') || args.includes('-j')) {
93
- log(JSON.stringify(flatten.length > 1 ? flatten : flatten[0]));
93
+ console.log(JSON.stringify(flatten.length > 1 ? flatten : flatten[0]));
94
94
  } else {
95
- log(flatten);
95
+ flatten.forEach(elem => console.log(elem));
96
96
  }
97
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k03mad/ip2geo",
3
- "version": "12.16.0",
3
+ "version": "12.16.2",
4
4
  "description": "GeoIP library",
5
5
  "maintainers": [
6
6
  "Kirill Molchanov <k03.mad@gmail.com"
@@ -20,7 +20,6 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@k03mad/request": "7.23.0",
23
- "@k03mad/simple-log": "5.3.0",
24
23
  "chalk": "5.6.2",
25
24
  "debug": "4.4.3",
26
25
  "is-ip": "5.0.1"