mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Pass npm args to preUninstall hook to be consistent with preInstall
This commit is contained in:
parent
a0c09fc617
commit
9f2a2b9869
@ -446,17 +446,22 @@ function uninstallModule(module) {
|
||||
var list = registry.removeModule(module);
|
||||
log.info(log._("server.install.uninstalling",{name:module}));
|
||||
|
||||
var args = ['remove','--no-audit','--no-update-notifier','--no-fund','--save',module];
|
||||
|
||||
let triggerPayload = {
|
||||
"module": module,
|
||||
"dir": installDir,
|
||||
"args": ['--no-audit','--no-update-notifier','--no-fund','--save']
|
||||
}
|
||||
return hooks.trigger("preUninstall", triggerPayload).then(() => {
|
||||
return hooks.trigger("preUninstall", triggerPayload).then((result) => {
|
||||
// preUninstall passed
|
||||
// - run uninstall
|
||||
log.trace(npmCommand + JSON.stringify(args));
|
||||
return exec.run(npmCommand,args,{ cwd: installDir}, true)
|
||||
if (result !== false) {
|
||||
let extraArgs = triggerPayload.args || [];
|
||||
let args = ['remove', ...extraArgs, module]
|
||||
log.trace(npmCommand + JSON.stringify(args));
|
||||
return exec.run(npmCommand,args,{ cwd: installDir}, true)
|
||||
} else {
|
||||
log.trace("skipping npm uninstall");
|
||||
}
|
||||
}).then(() => {
|
||||
log.info(log._("server.install.uninstalled",{name:module}));
|
||||
reportRemovedModules(list);
|
||||
|
Loading…
Reference in New Issue
Block a user