@mu1147-legend/cf-speed-test 1.0.2 → 1.0.4
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/.github/workflows/npm-publish.yml +43 -0
- package/README.md +2 -2
- package/index.js +4 -1
- package/package.json +4 -2
- package/utils.js +2 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: npm auto publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- master
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
publish:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Setup Node.js
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: "20"
|
|
23
|
+
registry-url: "https://registry.npmjs.org"
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: npm ci
|
|
27
|
+
|
|
28
|
+
- name: Check commit message
|
|
29
|
+
id: check_commit
|
|
30
|
+
run: |
|
|
31
|
+
commit_msg="${{ github.event.head_commit.message }}"
|
|
32
|
+
echo "Commit message: $commit_msg"
|
|
33
|
+
if [[ "$commit_msg" == *"release"* ]]; then
|
|
34
|
+
echo "has_release=true" >> $GITHUB_OUTPUT
|
|
35
|
+
else
|
|
36
|
+
echo "has_release=false" >> $GITHUB_OUTPUT
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
- name: Publish to npm
|
|
40
|
+
if: steps.check_commit.outputs.has_release == 'true'
|
|
41
|
+
run: npm publish
|
|
42
|
+
env:
|
|
43
|
+
npm_config_provenance: true
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Includes:
|
|
|
18
18
|
### Run instantly (no install)
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
npx cf-speed-test
|
|
21
|
+
npx @mu1147-legend/cf-speed-test
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
---
|
|
@@ -26,7 +26,7 @@ npx cf-speed-test
|
|
|
26
26
|
### Install globally
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
npm install -g cf-speed-test
|
|
29
|
+
npm install -g @mu1147-legend/cf-speed-test
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Then run:
|
package/index.js
CHANGED
|
@@ -49,7 +49,9 @@ async function run() {
|
|
|
49
49
|
controller.signal,
|
|
50
50
|
);
|
|
51
51
|
|
|
52
|
+
console.log("");
|
|
52
53
|
console.log(chalk.blue(`✔ Download: ${dl.toFixed(2)} Mbps`));
|
|
54
|
+
console.log("");
|
|
53
55
|
|
|
54
56
|
// 🔥 upload with glowing animation
|
|
55
57
|
const ul = await uploadTest(
|
|
@@ -58,8 +60,9 @@ async function run() {
|
|
|
58
60
|
CONNECTIONS,
|
|
59
61
|
controller.signal,
|
|
60
62
|
);
|
|
61
|
-
|
|
63
|
+
console.log("");
|
|
62
64
|
console.log(chalk.magenta(`✔ Upload: ${ul.toFixed(2)} Mbps`));
|
|
65
|
+
console.log("");
|
|
63
66
|
|
|
64
67
|
dlArr.push(dl);
|
|
65
68
|
ulArr.push(ul);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@mu1147-legend/cf-speed-test",
|
|
3
3
|
"author": "Muhammad Ullah",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.4",
|
|
6
6
|
"description": "CLI Speed Test Tool (Download, Upload, Ping, Jitter)",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"speedtest",
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
"upload",
|
|
14
14
|
"ping",
|
|
15
15
|
"jitter",
|
|
16
|
-
"netspeed"
|
|
16
|
+
"netspeed",
|
|
17
|
+
"cf-speed-test",
|
|
18
|
+
"cloudflare"
|
|
17
19
|
],
|
|
18
20
|
"type": "module",
|
|
19
21
|
"bin": {
|
package/utils.js
CHANGED
|
@@ -94,7 +94,7 @@ export async function downloadTest(url, connections, signal) {
|
|
|
94
94
|
{ color: "#ffffff", pos: clamp(shift + 0.1) },
|
|
95
95
|
{ color: "#aaaaaa", pos: clamp(shift + 0.2) },
|
|
96
96
|
{ color: "#555555", pos: 1 },
|
|
97
|
-
])(`⬇ Testing download
|
|
97
|
+
])(`⬇ Testing download... ${safePercent.toFixed(0)}%`);
|
|
98
98
|
|
|
99
99
|
process.stdout.write(
|
|
100
100
|
`\r${animatedText} [${bar}] ${speed.toFixed(2)} Mbps`,
|
|
@@ -191,7 +191,7 @@ export async function uploadTest(url, sizeMB, connections, signal) {
|
|
|
191
191
|
{ color: "#ffffff", pos: clamp(shift + 0.1) },
|
|
192
192
|
{ color: "#aaaaaa", pos: clamp(shift + 0.2) },
|
|
193
193
|
{ color: "#555555", pos: 1 },
|
|
194
|
-
])(`⬆ Testing upload
|
|
194
|
+
])(`⬆ Testing upload... ${percent.toFixed(0)}%`);
|
|
195
195
|
|
|
196
196
|
process.stdout.write(
|
|
197
197
|
`\r${animatedText} [${bar}] ${speed.toFixed(2)} Mbps`,
|