cli-engine
cli-engine copied to clipboard
Problems with preinstall
@jdxcode was trying out this the preinstall change.
I'm running into erratic async behavior with it.
In the most simple case I have this: async function preinstall(config: any, {plugin, tag}: {plugin: any, tag: string}): Promise { return new Promise((resolve, reject) => { console.log("1"); console.log("2"); reject(new Error("Fail install")); }); } export = preinstall;
And this results in
$ bin/run plugins:install cli-engine-example-plugin Installing plugin cli-engine-example-plugin... 1 Installing plugin cli-engine-example-plugin... ! ▸ Fail install $
Note that "2" in never printed and "Installing plugin cli-engine-example-plugin..." is printed twice.
Ideas? I'm using node 8.5.0
Same issue if I remove all notion of async...
function preinstall(config: any, {plugin, tag}: {plugin: any, tag: string}) { console.log("1"); console.log("2"); throw new Error("Fail install"); } export = preinstall;