Uploaded image for project: 'Realm Studio'
  1. Realm Studio
  2. RSTUDIO-362

Add the React Dev Tools Chrome extension

    • Type: Icon: Task Task
    • Resolution: Gone away
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None

      I had this almost working, but forgot that the master branch does not have the latest Electron version.

      Add this to src/main/WindowManager.ts and confirm it's working as expected.

      Unable to find source-code formatter for language: typescript. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      import fs from 'fs';
      import os from 'os';
      
      function addChromeExtension(id: string) {
        const extensionRootPath = path.resolve(os.homedir(), `Library/Application Support/Google/Chrome/Default/Extensions/${id}`);
        try {
          if (!fs.existsSync(extensionRootPath)) {
            throw new Error(`Missing (path = ${extensionRootPath})`);
          }
          const versionDirectories = fs.readdirSync(extensionRootPath);
          if (versionDirectories.length > 0) {
            const versionDirectory = versionDirectories[versionDirectories.length - 1];
            const extensionPath = path.resolve(extensionRootPath, versionDirectory);
            const manifestPath = path.resolve(extensionPath, "manifest.json");
            if (!fs.existsSync(manifestPath)) {
              throw new Error(`Missing manifest (path = ${manifestPath})`);
            }
            const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
            console.log(`Adding "${manifest.name}" Chrome extension`);
            BrowserWindow.addDevToolsExtension(extensionPath);
          }
        } catch (err) {
          console.warn(`Skipped adding Chrome extension (id = ${id}): ${err.message}`);
        }
      }
      
      if (isDevelopment && os.platform() === "darwin") {
        addChromeExtension("fmkadmapgofadopljbjfkapdkoienihi");
      }
      
      

            Assignee:
            kraen.hansen@mongodb.com Kræn Hansen
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: