extended versions() (added yarn, gulp, grunt, tsc, git)
This commit is contained in:
parent
f52ffd9556
commit
67ee300626
@ -98,6 +98,7 @@ Other changes
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| -------------- | -------------- | -------- |
|
| -------------- | -------------- | -------- |
|
||||||
|
| 3.30.0 | 2017-09-21 | extended `versions()` (added `yarn`, `gulp`, `grunt`, `tsc`, `git`) |
|
||||||
| 3.29.0 | 2017-09-15 | extended windows support `services()`, optimized `diskLayout()` (OSX), bugfixes |
|
| 3.29.0 | 2017-09-15 | extended windows support `services()`, optimized `diskLayout()` (OSX), bugfixes |
|
||||||
| 3.28.0 | 2017-09-14 | extended windows support `processes()` |
|
| 3.28.0 | 2017-09-14 | extended windows support `processes()` |
|
||||||
| 3.27.1 | 2017-09-13 | updated Raspberry version detection `system()` (Pi 3, Zero) |
|
| 3.27.1 | 2017-09-13 | updated Raspberry version detection `system()` (Pi 3, Zero) |
|
||||||
|
|||||||
@ -50,6 +50,7 @@ async function cpu() {
|
|||||||
## News and Changes
|
## News and Changes
|
||||||
|
|
||||||
### Latest Activity
|
### Latest Activity
|
||||||
|
- Version 3.30.0: extended `versions()` (added `yarn`, `gulp`, `grunt`, `tsc`, `git`)
|
||||||
- Version 3.29.0: extended windows support `services()`
|
- Version 3.29.0: extended windows support `services()`
|
||||||
- Version 3.28.0: extended windows support `processes()`
|
- Version 3.28.0: extended windows support `processes()`
|
||||||
- Version 3.27.0: added raw data to `currentLoad()`, fixed `networkInterfaces()` MAC problem node 8.x
|
- Version 3.27.0: added raw data to `currentLoad()`, fixed `networkInterfaces()` MAC problem node 8.x
|
||||||
|
|||||||
@ -221,28 +221,63 @@ function versions(callback) {
|
|||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
let result = {
|
let result = {
|
||||||
kernel: os.release(),
|
kernel: os.release(),
|
||||||
|
openssl: process.versions.openssl,
|
||||||
node: process.versions.node,
|
node: process.versions.node,
|
||||||
v8: process.versions.v8,
|
v8: process.versions.v8,
|
||||||
npm: '',
|
npm: '',
|
||||||
|
yarn: '',
|
||||||
pm2: '',
|
pm2: '',
|
||||||
openssl: process.versions.openssl
|
gulp: '',
|
||||||
|
grunt: '',
|
||||||
|
git: '',
|
||||||
|
tsc: '',
|
||||||
};
|
};
|
||||||
let lines = [];
|
let parts = [];
|
||||||
exec("npm -v", function (error, stdout) {
|
exec("npm -v", function (error, stdout) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
result.npm = stdout.toString().split('\n')[0];
|
result.npm = stdout.toString().split('\n')[0];
|
||||||
}
|
}
|
||||||
exec("pm2 -v", function (error, stdout) {
|
exec("pm2 -v", function (error, stdout) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
lines = stdout.toString().split('\n');
|
parts = stdout.toString().split('\n');
|
||||||
if (lines.length >= 2) {
|
if (parts.length >= 2) {
|
||||||
result.pm2 = lines[lines.length - 2];
|
result.pm2 = parts[parts.length - 2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (callback) {
|
exec("yarn --version", function (error, stdout) {
|
||||||
callback(result)
|
if (!error) {
|
||||||
}
|
result.yarn = stdout.toString().split('\n')[0];
|
||||||
resolve(result);
|
}
|
||||||
|
exec("gulp --version", function (error, stdout) {
|
||||||
|
if (!error) {
|
||||||
|
result.gulp = stdout.toString().split('\n')[0] || '';
|
||||||
|
result.gulp = (result.gulp.toLowerCase().split('version')[1] || '').trim();
|
||||||
|
}
|
||||||
|
exec("tsc --version", function (error, stdout) {
|
||||||
|
if (!error) {
|
||||||
|
result.tsc = stdout.toString().split('\n')[0] || '';
|
||||||
|
result.tsc = (result.tsc.toLowerCase().split('version')[1] || '').trim();
|
||||||
|
}
|
||||||
|
exec("grunt --version", function (error, stdout) {
|
||||||
|
if (!error) {
|
||||||
|
result.grunt = stdout.toString().split('\n')[0] || '';
|
||||||
|
result.grunt = (result.grunt.toLowerCase().split('cli v')[1] || '').trim();
|
||||||
|
}
|
||||||
|
exec("git --version", function (error, stdout) {
|
||||||
|
if (!error) {
|
||||||
|
result.git = stdout.toString().split('\n')[0] || '';
|
||||||
|
result.git = (result.git.toLowerCase().split('version')[1] || '').trim();
|
||||||
|
result.git = (result.git.split(' ')[0] || '').trim();
|
||||||
|
}
|
||||||
|
if (callback) {
|
||||||
|
callback(result)
|
||||||
|
}
|
||||||
|
resolve(result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user