npx command extended

This commit is contained in:
Sebastian Hildebrandt 2023-08-10 06:31:50 +02:00
parent a7629903b3
commit 8ee81fee96
5 changed files with 96 additions and 13 deletions

View File

@ -82,6 +82,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.18.15 | 2023-08-10 | `npm` command extended |
| 5.18.14 | 2023-08-09 | `fsSIze()` fixed syntax error |
| 5.18.13 | 2023-08-08 | `mem()` fixed error handling |
| 5.18.12 | 2023-08-05 | `fsSize()` rw /snap/ issue fixed (linux) |

View File

@ -31,11 +31,15 @@
## The Systeminformation Project
This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 600 versions published, up to 6 mio downloads per month, > 150 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project!
## Please support this project ... ☕️
Over the past few years I spent **over 2.000 hours** working on this project and invested in hardware to be able to test on different platforms. Currently I am working very hard on the next **new version 6.0** completely rewritten in TypeScript and with a lot of new features. Any support is highly appreciated - [Buy me a coffee](https://www.buymeacoffee.com/systeminfo).
**Your contribution** make it possible for me to keep working on this project, add new features and support more platforms. Thank you in advance!
## New Version 5.0
The new Version 5 is here - I spent several weeks finalizing this new version. Any support is highly appreciated - [Buy me a coffee](https://www.buymeacoffee.com/systeminfo)
This next major version release 5.0 comes with new functionality and several improvements and changes (some of them are breaking changes!):
The new Version 5 is here - this next major version release 5.0 comes with new functionality and several improvements and changes (some of them are breaking changes!):
- added audio: get detailed audio device information
- added bluetooth: get detailed bluetooth device information
@ -75,9 +79,22 @@ npm install systeminformation --save
or simpler
```bash
npm install systeminformation
npm i systeminformation
```
### Give it a try with `npx`?
You just want to give it a try - right from your command line without installing it? Here is how you can call it with `npx`:
```
# get basic system info (System, OS, CPU)
npx systeminformation info
# obtain all static data - may take up to 30 seconds
npx systeminformation
```
#### Still need Version 4?
If you need version 4 (for compatibility reasons), you can install version 4 (latest release) like this

View File

@ -57,6 +57,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.18.15</th>
<td>2023-08-10</td>
<td><span class="code">npx()</span> command extended</td>
</tr>
<tr>
<th scope="row">5.18.14</th>
<td>2023-08-09</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.18.14</span></div>
<div class="version">New Version: <span id="version">5.18.15</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">
@ -204,7 +204,7 @@
</div>
<div class="row number-section">
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">15,481</div>
<div class="numbers">15,577</div>
<div class="title">Lines of code</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
@ -212,7 +212,7 @@
<div class="title">Downloads last month</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">636</div>
<div class="numbers">637</div>
<div class="title">Dependents</div>
</div>
</div>

72
lib/cli.js Normal file → Executable file
View File

@ -17,15 +17,75 @@
// Dependencies
// ----------------------------------------------------------------------------------
const si = require('./index');
const lib_version = require('../package.json').version;
function capFirst(string) {
return string[0].toUpperCase() + string.slice(1);
}
function printLines(obj) {
for (const property in obj) {
console.log(capFirst(property) + ' '.substring(0, 17 - property.length) + ': ' + (obj[property] || ''));
}
console.log();
}
function info() {
console.log('┌─────────────────────────────────────────────────────────────────────────────────────────┐');
console.log('│ SYSTEMINFORMATION '.substring(0, 80 - lib_version.length) + 'Version: ' + lib_version + ' │');
console.log('└─────────────────────────────────────────────────────────────────────────────────────────┘');
si.osInfo().then(res => {
console.log();
console.log('Operating System:');
console.log('──────────────────────────────────────────────────────────────────────────────────────────');
delete res.serial;
delete res.servicepack;
delete res.logofile;
delete res.fqdn;
delete res.uefi;
printLines(res);
si.system().then(res => {
console.log('System:');
console.log('──────────────────────────────────────────────────────────────────────────────────────────');
delete res.serial;
delete res.uuid;
delete res.sku;
delete res.uuid;
printLines(res);
si.cpu().then(res => {
console.log('CPU:');
console.log('──────────────────────────────────────────────────────────────────────────────────────────');
delete res.cache;
delete res.governor;
delete res.flags;
delete res.virtualization;
delete res.revision;
delete res.voltage;
delete res.vendor;
delete res.speedMin;
delete res.speedMax;
printLines(res);
});
});
});
}
// ----------------------------------------------------------------------------------
// Main
// ----------------------------------------------------------------------------------
(function () {
si.getStaticData().then(
((data) => {
data.time = si.time();
console.log(JSON.stringify(data, null, 2));
}
));
const args = process.argv.slice(2);
if (args[0] === 'info') {
info();
} else {
si.getStaticData().then(
((data) => {
data.time = si.time();
console.log(JSON.stringify(data, null, 2));
}
));
}
})();