[utils] dependencyInfo: use child_process instead of shelljs
drop shelljs from dependencies.
This commit is contained in:
parent
5daec781e9
commit
f462c00090
@ -58,7 +58,6 @@
|
|||||||
"@types/request": "0.0.39",
|
"@types/request": "0.0.39",
|
||||||
"@types/rimraf": "0.0.28",
|
"@types/rimraf": "0.0.28",
|
||||||
"@types/serve-favicon": "2.2.28",
|
"@types/serve-favicon": "2.2.28",
|
||||||
"@types/shelljs": "0.3.33",
|
|
||||||
"@types/twitter": "0.0.28",
|
"@types/twitter": "0.0.28",
|
||||||
"@types/uuid": "2.0.29",
|
"@types/uuid": "2.0.29",
|
||||||
"@types/vinyl-buffer": "0.0.28",
|
"@types/vinyl-buffer": "0.0.28",
|
||||||
@ -139,7 +138,6 @@
|
|||||||
"rndstr": "1.0.0",
|
"rndstr": "1.0.0",
|
||||||
"s-age": "1.1.0",
|
"s-age": "1.1.0",
|
||||||
"serve-favicon": "2.3.2",
|
"serve-favicon": "2.3.2",
|
||||||
"shelljs": "0.7.6",
|
|
||||||
"subdomain": "1.2.0",
|
"subdomain": "1.2.0",
|
||||||
"summaly": "1.3.0",
|
"summaly": "1.3.0",
|
||||||
"swagger-jsdoc": "1.9.0",
|
"swagger-jsdoc": "1.9.0",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Logger from './logger';
|
import Logger from './logger';
|
||||||
import { exec } from 'shelljs';
|
import { execSync } from 'child_process';
|
||||||
|
|
||||||
export default class {
|
export default class {
|
||||||
logger: Logger;
|
logger: Logger;
|
||||||
@ -15,20 +15,16 @@ export default class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show(serviceName: string, command: string, transform: (x: string) => RegExpMatchArray): void {
|
show(serviceName: string, command: string, transform: (x: string) => RegExpMatchArray): void {
|
||||||
const code = {
|
try {
|
||||||
success: 0,
|
const x = execSync(command, { stdio: ['pipe', 'pipe', 'ignore'] });
|
||||||
notFound: 127
|
const ver = transform(x.toString());
|
||||||
};
|
|
||||||
const x = exec(command, { silent: true }) as any;
|
|
||||||
if (x.code === code.success) {
|
|
||||||
let ver = transform(x.stdout);
|
|
||||||
if (ver != null) {
|
if (ver != null) {
|
||||||
this.logger.info(`${serviceName} ${ver[1]} found`);
|
this.logger.info(`${serviceName} ${ver[1]} found`);
|
||||||
} else {
|
} else {
|
||||||
this.logger.warn(`${serviceName} not found`);
|
this.logger.warn(`${serviceName} not found`);
|
||||||
this.logger.warn(`Regexp used for version check of ${serviceName} is probably messed up`);
|
this.logger.warn(`Regexp used for version check of ${serviceName} is probably messed up`);
|
||||||
}
|
}
|
||||||
} else if (x.code === code.notFound) {
|
} catch (e) {
|
||||||
this.logger.warn(`${serviceName} not found`);
|
this.logger.warn(`${serviceName} not found`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user