create-nexora-next 0.4.10 → 0.5.10
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/index.js +3 -0
- package/src/utils/telemetry.js +39 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import { stepSetupHusky } from './steps/09-husky.js'
|
|
|
21
21
|
import { stepSetupAxios } from './steps/10-axios.js'
|
|
22
22
|
import { stepPatchPackageJson } from './steps/11-patch-pkg.js'
|
|
23
23
|
import { stepSetupGithub } from './steps/12-github.js'
|
|
24
|
+
import { trackUsage } from './utils/telemetry.js'
|
|
24
25
|
|
|
25
26
|
function bail(msg) {
|
|
26
27
|
p.cancel(pc.red(msg))
|
|
@@ -241,6 +242,8 @@ async function main() {
|
|
|
241
242
|
await stepSetupGithub(targetDir, name)
|
|
242
243
|
}
|
|
243
244
|
|
|
245
|
+
trackUsage({ pm, opts })
|
|
246
|
+
|
|
244
247
|
printSummary(opts, name, pm)
|
|
245
248
|
p.outro(pc.bgGreen(pc.black(' Done! ')))
|
|
246
249
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import os from 'os'
|
|
2
|
+
import { createRequire } from 'module'
|
|
3
|
+
|
|
4
|
+
const require = createRequire(import.meta.url)
|
|
5
|
+
const { version } = require('../../package.json')
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const WEBHOOK_URL = process.env.NEXORA_TELEMETRY_URL || 'https://eopfu4tds8lckfg.m.pipedream.net'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Fire-and-forget anonymous ping to Pipedream.
|
|
12
|
+
* Never throws — failure is silently swallowed.
|
|
13
|
+
* Never blocks — does not await.
|
|
14
|
+
*
|
|
15
|
+
* @param {{ pm: string, opts: Record<string, boolean> }} data
|
|
16
|
+
*/
|
|
17
|
+
export function trackUsage({ pm, opts }) {
|
|
18
|
+
if (!WEBHOOK_URL || WEBHOOK_URL === 'https://eopfu4tds8lckfg.m.pipedream.net') return
|
|
19
|
+
|
|
20
|
+
const payload = {
|
|
21
|
+
version,
|
|
22
|
+
pm,
|
|
23
|
+
os: os.platform(), // win32 | darwin | linux
|
|
24
|
+
node: process.version, // e.g. v22.0.0
|
|
25
|
+
features: Object.entries(opts)
|
|
26
|
+
.filter(([, v]) => v === true)
|
|
27
|
+
.map(([k]) => k),
|
|
28
|
+
ts: new Date().toISOString(),
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Fire without awaiting — CLI flow continues immediately
|
|
32
|
+
fetch(WEBHOOK_URL, {
|
|
33
|
+
method: 'POST',
|
|
34
|
+
headers: { 'Content-Type': 'application/json' },
|
|
35
|
+
body: JSON.stringify(payload),
|
|
36
|
+
}).catch(() => {
|
|
37
|
+
// Swallow all errors — telemetry must never affect the user
|
|
38
|
+
})
|
|
39
|
+
}
|