Skip to content

Commit

Permalink
npx command extended
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhildebrandt committed Aug 10, 2023
1 parent a762990 commit 8ee81fe
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!

## New Version 5.0
## 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!

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)
## New Version 5.0

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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions docs/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ <h3>Full version history</h3>
</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>
Expand Down
6 changes: 3 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -204,15 +204,15 @@
</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">
<div id="downloads" class="numbers">...</div>
<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>
Expand Down
72 changes: 66 additions & 6 deletions lib/cli.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
));
}

})();

0 comments on commit 8ee81fe

Please sign in to comment.