Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Commit a2ba50b

Browse files
committed
[add] add usage collect version
1 parent 2723aef commit a2ba50b

6 files changed

Lines changed: 12 additions & 6 deletions

File tree

bin/cloudbase.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const { handleCompletion } = require('../lib/completion')
1717

1818
let processArgv = process.argv
1919
const isBeta = pkg.version.indexOf('-') > -1
20+
process.CLI_VERSION = pkg.version
2021

2122
const [major, minor] = process.versions.node.split('.').slice(0, 2)
2223

cloudbase/functions/usage/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class DataSchema {
1111
this.macMd5 = data.macMd5 || ''
1212
this.uin = data.uin || ''
1313
this.os = data.os || ''
14+
this.version = data.version || ''
1415
this.date = new Date()
1516
}
1617
}

lib/utils/reporter/usage.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ function collectUsage(command) {
1919
const macMd5 = yield platform_1.getMacAddressMd5();
2020
const os = yield platform_1.getOSInfo();
2121
const data = {
22-
command,
23-
macMd5,
22+
os,
2423
uin,
25-
os
24+
macMd5,
25+
command,
26+
version: process.CLI_VERSION
2627
};
2728
return http_request_1.postFetch(url, data);
2829
});

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ declare global {
55
namespace NodeJS {
66
interface Process {
77
IS_DEBUG: boolean
8+
CLI_VERSION: string
89
}
910
}
1011
}

src/utils/reporter/usage.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ export async function collectUsage(command: string) {
99
const macMd5 = await getMacAddressMd5()
1010
const os = await getOSInfo()
1111
const data = {
12-
command,
13-
macMd5,
12+
os,
1413
uin,
15-
os
14+
macMd5,
15+
command,
16+
version: process.CLI_VERSION
1617
}
1718

1819
return postFetch(url, data)

types/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ declare global {
33
namespace NodeJS {
44
interface Process {
55
IS_DEBUG: boolean;
6+
CLI_VERSION: string;
67
}
78
}
89
}

0 commit comments

Comments
 (0)