@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 +15 -6
- package/app/cli.js +9 -3
- package/app/tools/aria.js +1 -1
- package/app/tools/chrome.js +1 -1
- package/app/tools/curl.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# Get tool actual version string
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## CLI
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm i @k03mad/
|
|
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/
|
|
20
|
+
npm i @k03mad/actual-versions
|
|
19
21
|
```
|
|
20
22
|
|
|
21
23
|
```js
|
|
22
|
-
import {
|
|
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
|
|
33
|
+
const chromeVersion = await getChromeVersion();
|
|
25
34
|
// '126.0.6478.182'
|
|
26
35
|
|
|
27
|
-
const
|
|
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.
|
|
15
|
-
|
|
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
package/app/tools/chrome.js
CHANGED
package/app/tools/curl.js
CHANGED