diff --git a/lib/osinfo.js b/lib/osinfo.js index 3f016e7..443344d 100644 --- a/lib/osinfo.js +++ b/lib/osinfo.js @@ -452,47 +452,49 @@ function isUefiWindows() { function versions(apps, callback) { let versionObject = { kernel: os.release(), - openssl: '', - systemOpenssl: '', - systemOpensslLib: '', - node: process.versions.node, - v8: process.versions.v8, - npm: '', - yarn: '', - pm2: '', - gulp: '', - grunt: '', - git: '', - tsc: '', - mysql: '', - redis: '', - mongodb: '', apache: '', - nginx: '', - php: '', + bash: '', + bun: '', + deno: '', docker: '', + dotnet: '', + fish: '', + gcc: '', + git: '', + grunt: '', + gulp: '', + java: '', + mongodb: '', + mysql: '', + nginx: '', + node: process.versions.node, + npm: '', + openssl: '', + perl: '', + php: '', + pip3: '', + pip: '', + pm2: '', postfix: '', postgresql: '', - perl: '', - python: '', - python3: '', - pip: '', - pip3: '', - java: '', - gcc: '', - virtualbox: '', - bash: '', - zsh: '', - fish: '', powershell: '', - dotnet: '' + python3: '', + python: '', + redis: '', + systemOpenssl: '', + systemOpensslLib: '', + tsc: '', + v8: process.versions.v8, + virtualbox: '', + yarn: '', + zsh: '' }; function checkVersionParam(apps) { if (apps === '*') { return { versions: versionObject, - counter: 30 + counter: 32 }; } if (!Array.isArray(apps)) { @@ -1027,6 +1029,27 @@ function versions(apps, callback) { functionProcessed(); }); } + if ({}.hasOwnProperty.call(appsObj.versions, 'bun')) { + exec('bun -v', function (error, stdout) { + if (!error) { + const line = stdout.toString().split('\n')[0].trim(); + appsObj.versions.fish = line; + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'deno')) { + exec('deno -v', function (error, stdout) { + if (!error) { + const line = stdout.toString().split('\n')[0].trim(); + const parts = line.split(' '); + if (parts.length > 1) { + appsObj.versions.fish = parts[1]; + } + } + functionProcessed(); + }); + } if ({}.hasOwnProperty.call(appsObj.versions, 'powershell')) { if (_windows) { util.powerShell('$PSVersionTable').then(stdout => { diff --git a/lib/system.js b/lib/system.js index 4c8b000..9777d53 100644 --- a/lib/system.js +++ b/lib/system.js @@ -50,10 +50,10 @@ function system(callback) { let lines = stdout.toString().split('\n'); result.manufacturer = util.getValue(lines, 'manufacturer'); result.model = util.getValue(lines, 'product name'); - result.version = util.getValue(lines, 'version'); - result.serial = util.getValue(lines, 'serial number'); - result.uuid = util.getValue(lines, 'uuid').toLowerCase(); - result.sku = util.getValue(lines, 'sku number'); + result.version = cleanDefaults(util.getValue(lines, 'version')); + result.serial = cleanDefaults(util.getValue(lines, 'serial number')); + result.uuid = cleanDefaults((util.getValue(lines, 'uuid').toLowerCase())); + result.sku = cleanDefaults(util.getValue(lines, 'sku number')); // Non-Root values const cmd = `echo -n "product_name: "; cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null; echo; echo -n "product_serial: "; cat /sys/devices/virtual/dmi/id/product_serial 2>/dev/null; echo; @@ -64,17 +64,17 @@ function system(callback) { lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); result.manufacturer = result.manufacturer === '' ? util.getValue(lines, 'sys_vendor') : result.manufacturer; result.model = result.model === '' ? util.getValue(lines, 'product_name') : result.model; - result.version = result.version === '' ? util.getValue(lines, 'product_version') : result.version; - result.serial = result.serial === '' ? util.getValue(lines, 'product_serial') : result.serial; - result.uuid = result.uuid === '' ? util.getValue(lines, 'product_uuid').toLowerCase() : result.uuid; + result.version = cleanDefaults(result.version === '' ? util.getValue(lines, 'product_version') : result.version); + result.serial = cleanDefaults(result.serial === '' ? util.getValue(lines, 'product_serial') : result.serial); + result.uuid = cleanDefaults(result.uuid === '' ? util.getValue(lines, 'product_uuid').toLowerCase() : result.uuid); } catch (e) { util.noop(); } - if (!result.serial || result.serial.toLowerCase().indexOf('o.e.m.') !== -1) { result.serial = '-'; } - if (!result.manufacturer || result.manufacturer.toLowerCase().indexOf('o.e.m.') !== -1) { result.manufacturer = ''; } - if (!result.model || result.model.toLowerCase().indexOf('o.e.m.') !== -1) { result.model = 'Computer'; } - if (!result.version || result.version.toLowerCase().indexOf('o.e.m.') !== -1) { result.version = ''; } - if (!result.sku || result.sku.toLowerCase().indexOf('o.e.m.') !== -1) { result.sku = '-'; } + if (!result.serial) { result.serial = '-'; } + if (!result.manufacturer) { result.manufacturer = ''; } + if (!result.model) { result.model = 'Computer'; } + if (!result.version) { result.version = ''; } + if (!result.sku) { result.sku = '-'; } // detect virtual (1) if (result.model.toLowerCase() === 'virtualbox' || result.model.toLowerCase() === 'kvm' || result.model.toLowerCase() === 'virtual machine' || result.model.toLowerCase() === 'bochs' || result.model.toLowerCase().startsWith('vmware') || result.model.toLowerCase().startsWith('droplet')) {