cchubber 0.5.7 → 0.5.8
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/package.json +1 -1
- package/src/renderers/html-report.js +8 -0
- package/src/telemetry.js +6 -2
package/package.json
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { join, dirname } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const PKG_VERSION = JSON.parse(readFileSync(join(__dirname, '..', '..', 'package.json'), 'utf-8')).version;
|
|
7
|
+
|
|
1
8
|
function esc(s) {
|
|
2
9
|
if (!s) return '';
|
|
3
10
|
return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,''');
|
|
@@ -209,6 +216,7 @@ export function renderHTML(report) {
|
|
|
209
216
|
<header class="w-full px-6 py-5 max-w-[1200px] mx-auto flex justify-between items-baseline">
|
|
210
217
|
<div class="flex items-baseline gap-4">
|
|
211
218
|
<a href="https://github.com/azkhh/cchubber" target="_blank" class="text-lg font-bold tracking-tight text-[#e3e2e3]" style="text-decoration:none;">CC Hubber</a>
|
|
219
|
+
<span class="text-[10px] font-mono text-[#908fa0]">v${PKG_VERSION}</span>
|
|
212
220
|
<span class="text-[10px] uppercase tracking-[0.05em] text-[#908fa0]">shipped fast with <a href="https://moveros.dev" target="_blank" style="text-decoration:none;color:inherit;">Mover OS</a></span>
|
|
213
221
|
</div>
|
|
214
222
|
<span class="font-mono text-[11px] text-[#908fa0]" id="range-lbl">All time</span>
|
package/src/telemetry.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import https from 'https';
|
|
2
2
|
import { platform, arch, homedir, cpus, totalmem, freemem } from 'os';
|
|
3
3
|
import { existsSync, readFileSync, writeFileSync, readdirSync, statSync } from 'fs';
|
|
4
|
-
import { join } from 'path';
|
|
4
|
+
import { join, dirname } from 'path';
|
|
5
5
|
import { execSync as rawExec } from 'child_process';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const PKG_VERSION = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8')).version;
|
|
6
10
|
|
|
7
11
|
// Suppress stderr output on Windows (prevents "system cannot find path" spam)
|
|
8
12
|
function execSync(cmd, opts = {}) {
|
|
@@ -38,7 +42,7 @@ function markTelemetrySent() {
|
|
|
38
42
|
|
|
39
43
|
export function sendTelemetry(report) {
|
|
40
44
|
const payload = {
|
|
41
|
-
v:
|
|
45
|
+
v: PKG_VERSION,
|
|
42
46
|
uid: getOrCreateUID(),
|
|
43
47
|
ts: new Date().toISOString(),
|
|
44
48
|
os: platform(),
|