@k03mad/actual-versions 1.0.0 → 1.1.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
@@ -1,11 +1,13 @@
1
1
  # Get tool actual version string
2
2
 
3
- ## Global
3
+ ## CLI
4
4
 
5
5
  ```bash
6
- npm i @k03mad/acver -g
6
+ npm i @k03mad/actual-versions -g
7
7
  acver
8
8
  # ╔════════╤════════════════╗
9
+ # ║ aria │ 1.37.0 ║
10
+ # ╟────────┼────────────────╢
9
11
  # ║ chrome │ 126.0.6478.182 ║
10
12
  # ╟────────┼────────────────╢
11
13
  # ║ curl │ 8.8.0 ║
@@ -15,15 +17,22 @@ acver
15
17
  ## API
16
18
 
17
19
  ```bash
18
- npm i @k03mad/acver
20
+ npm i @k03mad/actual-versions
19
21
  ```
20
22
 
21
23
  ```js
22
- import {getChromeVersion, getCurlVersion} from '@k03mad/acver';
24
+ import {
25
+ getAriaVersion
26
+ getChromeVersion,
27
+ getCurlVersion
28
+ } from '@k03mad/actual-versions';
29
+
30
+ const ariaVersion = await getAriaVersion();
31
+ // '1.37.0'
23
32
 
24
- const chrome = await getChromeVersion();
33
+ const chromeVersion = await getChromeVersion();
25
34
  // '126.0.6478.182'
26
35
 
27
- const curl = await getCurlVersion();
36
+ const curlVersion = await getCurlVersion();
28
37
  // '8.8.0'
29
38
  ```
package/app/cli.js CHANGED
@@ -6,13 +6,19 @@ import {table} from 'table';
6
6
 
7
7
  import * as api from './api.js';
8
8
 
9
- const {blue, bold, green} = chalk;
9
+ const {blue, bold, green, red} = chalk;
10
+
11
+ const TOOL_NAME_RE = /get(.+)Version/;
10
12
 
11
13
  const output = await Promise.all(
12
14
  Object.entries(api).map(async ([key, value]) => {
13
15
  const version = await value();
14
- const tool = key.replaceAll(/Version|get/g, '').toLowerCase();
15
- return [blue(bold(tool)), green(version)];
16
+ const tool = key.match(TOOL_NAME_RE)[1].toLowerCase();
17
+
18
+ return [
19
+ blue(bold(tool)),
20
+ version ? green(version) : red('———'),
21
+ ];
16
22
  }),
17
23
  );
18
24
 
package/app/tools/aria.js CHANGED
@@ -8,5 +8,5 @@ const ARIA_VERSION_RE = /href=".+\/releases\/tag\/release-([\d.]+)"/;
8
8
  */
9
9
  export default async () => {
10
10
  const {body} = await requestCache(ARIA_VERSIONS_URL);
11
- return body.match(ARIA_VERSION_RE)[1];
11
+ return body.match(ARIA_VERSION_RE)?.[1];
12
12
  };
@@ -7,5 +7,5 @@ const CHROME_VERSIONS_URL = 'https://googlechromelabs.github.io/chrome-for-testi
7
7
  */
8
8
  export default async () => {
9
9
  const {body} = await requestCache(CHROME_VERSIONS_URL);
10
- return body.channels.Stable.version;
10
+ return body?.channels?.Stable?.version;
11
11
  };
package/app/tools/curl.js CHANGED
@@ -8,5 +8,5 @@ const CURL_VERSION_RE = /href="\/download\/curl-([\d.]+).tar.gz"/;
8
8
  */
9
9
  export default async () => {
10
10
  const {body} = await requestCache(CURL_VERSIONS_URL);
11
- return body.match(CURL_VERSION_RE)[1];
11
+ return body.match(CURL_VERSION_RE)?.[1];
12
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k03mad/actual-versions",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Get tool actual version string",
5
5
  "maintainers": [
6
6
  "Kirill Molchanov <k03.mad@gmail.com"