electron-devtools-installer icon indicating copy to clipboard operation
electron-devtools-installer copied to clipboard

When passing an array of extensions, only the name of the final extension installed is returned

Open timsgardner opened this issue 3 years ago • 1 comments

For example,

  const installed = await installExtensions([REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS]);
  console.log('installed:', installed);

will print

installed: Redux DevTools

whereas the jsdocs suggest it should return the names of all the extensions: https://github.com/MarshallOfSound/electron-devtools-installer/blob/19fd4dde8a8e3eb8a50ba4ca242bf3b52e878436/src/index.ts#L44

It looks like this is because the reduce in install throws away previous string values:

https://github.com/MarshallOfSound/electron-devtools-installer/blob/19fd4dde8a8e3eb8a50ba4ca242bf3b52e878436/src/index.ts#L64

timsgardner avatar Apr 01 '21 19:04 timsgardner

as a workaround for anyone else encountering this, over on insomnia, we did:

  if (isDevelopment()) {
    try {
      const extensions = [REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS];
      const extensionsPlural = extensions.length > 0 ? 's' : '';
      const names = await Promise.all(extensions.map(extension => installExtension(extension)));
      console.log(`[electron-extensions] Added DevTools Extension${extensionsPlural}: ${names.join(', ')}`);
    } catch (err) {
      console.log('[electron-extensions] An error occurred: ', err);
    }
  }

dimitropoulos avatar Jun 09 '21 20:06 dimitropoulos