Skip to content

Commit

Permalink
(core) removed systeminformation dep
Browse files Browse the repository at this point in the history
  • Loading branch information
inlife committed Mar 15, 2024
1 parent 320dd05 commit 0617a16
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 29 deletions.
3 changes: 1 addition & 2 deletions packages/nexrender-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"nanoid": "^3.2.0",
"requireg": "^0.2.1",
"rimraf": "^3.0.2",
"strip-comments": "^2.0.1",
"systeminformation": "^5.18.3"
"strip-comments": "^2.0.1"
},
"peerDependencies": {
"@nexrender/action-copy": "^1.0.0",
Expand Down
53 changes: 26 additions & 27 deletions packages/nexrender-core/src/helpers/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const os = require('os')
const path = require('path')
const crypto = require('crypto')

const si = require('systeminformation')
const { nanoid } = require('nanoid')
const childProcess = require('child_process')

Expand Down Expand Up @@ -96,32 +95,32 @@ const track = async (settings, event, properties = {}) => {
return;
}

// collect system info
if (!settings.systemInfo) {
// if (isRemote) console.log('collecting systeminfo')

settings.systemInfo = await si.get({
cpu: 'manufacturer,brand,cores',
mem: 'total',
graphics: '*',
osInfo: 'platform,arch,distro,release',
dockerInfo: 'id',
})

properties.$set_once = {
sys_cpu_manufacturer: settings.systemInfo.cpu.manufacturer,
sys_cpu_brand: settings.systemInfo.cpu.brand,
sys_cpu_cores: settings.systemInfo.cpu.cores,
sys_mem_total: settings.systemInfo.mem.total,
sys_graphics_vendor: (settings.systemInfo.graphics.controllers[0] || []).vendor,
sys_graphics_model: (settings.systemInfo.graphics.controllers[0] || []).model,
sys_os_platform: settings.systemInfo.osInfo.platform,
sys_os_arch: settings.systemInfo.osInfo.arch,
sys_os_distro: settings.systemInfo.osInfo.distro,
sys_os_release: settings.systemInfo.osInfo.release,
sys_docker: !!settings.systemInfo.dockerInfo.id,
}
}
// // collect system info
// if (!settings.systemInfo) {
// // if (isRemote) console.log('collecting systeminfo')

// settings.systemInfo = await si.get({
// cpu: 'manufacturer,brand,cores',
// mem: 'total',
// graphics: '*',
// osInfo: 'platform,arch,distro,release',
// dockerInfo: 'id',
// })

// properties.$set_once = {
// sys_cpu_manufacturer: settings.systemInfo.cpu.manufacturer,
// sys_cpu_brand: settings.systemInfo.cpu.brand,
// sys_cpu_cores: settings.systemInfo.cpu.cores,
// sys_mem_total: settings.systemInfo.mem.total,
// sys_graphics_vendor: (settings.systemInfo.graphics.controllers[0] || []).vendor,
// sys_graphics_model: (settings.systemInfo.graphics.controllers[0] || []).model,
// sys_os_platform: settings.systemInfo.osInfo.platform,
// sys_os_arch: settings.systemInfo.osInfo.arch,
// sys_os_distro: settings.systemInfo.osInfo.distro,
// sys_os_release: settings.systemInfo.osInfo.release,
// sys_docker: !!settings.systemInfo.dockerInfo.id,
// }
// }

if (event == 'Job Cleanup') {
const events = Object.keys(cache.data)
Expand Down

0 comments on commit 0617a16

Please sign in to comment.