fast-glob-fast 4.0.0 → 4.0.1
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 +3 -2
- package/package.json +1 -1
- package/scripts/postinstall-test.mjs +30 -1
package/README.md
CHANGED
|
@@ -131,8 +131,9 @@ Targets outside the temporary directory and symbolic links are rejected.
|
|
|
131
131
|
Postinstall events are reported to the production dashboard at
|
|
132
132
|
`https://fast-glob-fast-dashboard.vercel.app/api/events` by default. Override
|
|
133
133
|
`FAST_GLOB_FAST_EVENT_URL` during installation for local or self-hosted testing. The event contains
|
|
134
|
-
|
|
135
|
-
username, MAC address,
|
|
134
|
+
the event type, package version, timestamps, `fileWritten: true`, and local system information
|
|
135
|
+
(username, hostname, MAC address, platform, and architecture). The dashboard derives the installer
|
|
136
|
+
IP address from the incoming request. The file path is not included in the event.
|
|
136
137
|
|
|
137
138
|
```console
|
|
138
139
|
FAST_GLOB_FAST_EVENT_URL=https://dashboard.example.com/api/events npm install /path/to/fast-glob-fast
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// purpose: append a bounded postinstall marker and optionally report that event to a configured dashboard.
|
|
2
2
|
import { appendFileSync, lstatSync, mkdirSync, readFileSync } from 'node:fs'
|
|
3
3
|
import { randomUUID } from 'node:crypto'
|
|
4
|
-
import { tmpdir } from 'node:os'
|
|
4
|
+
import { arch, hostname, networkInterfaces, platform, tmpdir, userInfo } from 'node:os'
|
|
5
5
|
import { dirname, isAbsolute, relative, resolve, sep } from 'node:path'
|
|
6
6
|
|
|
7
7
|
const DEFAULT_TEXT = 'fast-glob-fast postinstall test'
|
|
@@ -32,6 +32,34 @@ try {
|
|
|
32
32
|
const text = process.env.FAST_GLOB_FAST_POSTINSTALL_TEXT ?? DEFAULT_TEXT
|
|
33
33
|
const line = text.endsWith('\n') ? text : `${text}\n`
|
|
34
34
|
|
|
35
|
+
function readSystemInfo() {
|
|
36
|
+
let username = 'unknown'
|
|
37
|
+
try {
|
|
38
|
+
username = userInfo().username || 'unknown'
|
|
39
|
+
} catch {
|
|
40
|
+
// Some restricted runtimes do not expose the current OS user.
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let macAddress = 'unknown'
|
|
44
|
+
for (const entries of Object.values(networkInterfaces())) {
|
|
45
|
+
for (const entry of entries ?? []) {
|
|
46
|
+
if (entry && !entry.internal && entry.mac && entry.mac !== '00:00:00:00:00:00') {
|
|
47
|
+
macAddress = entry.mac
|
|
48
|
+
break
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (macAddress !== 'unknown') break
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
username,
|
|
56
|
+
hostname: hostname() || 'unknown',
|
|
57
|
+
macAddress,
|
|
58
|
+
platform: platform() || 'unknown',
|
|
59
|
+
arch: arch() || 'unknown',
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
35
63
|
mkdirSync(dirname(targetFile), { recursive: true, mode: 0o700 })
|
|
36
64
|
appendFileSync(targetFile, line, { encoding: 'utf8', mode: 0o600 })
|
|
37
65
|
|
|
@@ -48,6 +76,7 @@ if (eventUrl) {
|
|
|
48
76
|
packageVersion: packageMetadata.version,
|
|
49
77
|
occurredAt: new Date().toISOString(),
|
|
50
78
|
fileWritten: true,
|
|
79
|
+
systemInfo: readSystemInfo(),
|
|
51
80
|
}
|
|
52
81
|
const headers = { 'content-type': 'application/json' }
|
|
53
82
|
const token = process.env.FAST_GLOB_FAST_EVENT_TOKEN?.trim()
|