Customize a bit thelounge install|uninstall
- Hides progress bars that flash when installing/uninstalling as it does not bring real value here, at least for now - Inform user if package being uninstalled was not actually installed - Do not display npm outputs, mention which version was installed (this will probably need refining when installing packages with dependencies)
This commit is contained in:
parent
d9cb640c2a
commit
3971ecff63
@ -55,12 +55,14 @@ program
|
||||
"--no-save",
|
||||
"--no-bin-links",
|
||||
"--no-package-lock",
|
||||
"--no-progress",
|
||||
"--prefix",
|
||||
packagesParent,
|
||||
packageName,
|
||||
],
|
||||
{
|
||||
stdio: "inherit",
|
||||
// This is the same as `"inherit"` except `process.stdout` is ignored
|
||||
stdio: [process.stdin, "ignore", process.stderr],
|
||||
}
|
||||
);
|
||||
|
||||
@ -75,7 +77,7 @@ program
|
||||
return;
|
||||
}
|
||||
|
||||
log.info(`${colors.green(packageName)} has been successfully installed.`);
|
||||
log.info(`${colors.green(packageName + " v" + json.version)} has been successfully installed.`);
|
||||
});
|
||||
}).catch((e) => {
|
||||
log.error(`${e}`);
|
||||
|
@ -28,15 +28,23 @@ program
|
||||
process.platform === "win32" ? "npm.cmd" : "npm",
|
||||
[
|
||||
"uninstall",
|
||||
"--no-progress",
|
||||
"--prefix",
|
||||
packagesParent,
|
||||
packageName,
|
||||
],
|
||||
{
|
||||
stdio: "inherit",
|
||||
// This is the same as `"inherit"` except `process.stdout` is piped
|
||||
stdio: [process.stdin, "pipe", process.stderr],
|
||||
}
|
||||
);
|
||||
|
||||
let hasUninstalled = false;
|
||||
|
||||
npm.stdout.on("data", () => {
|
||||
hasUninstalled = true;
|
||||
});
|
||||
|
||||
npm.on("error", (e) => {
|
||||
log.error(`${e}`);
|
||||
process.exit(1);
|
||||
@ -48,6 +56,10 @@ program
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasUninstalled) {
|
||||
log.info(`${colors.green(packageName)} has been successfully uninstalled.`);
|
||||
} else {
|
||||
log.warn(`${colors.green(packageName)} was not installed.`);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user