Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix checking for packaged/dev modes #1698

Merged

Conversation

jagthedrummer
Copy link
Contributor

In the process of removing electron-is-dev (#1640) the way that we determine if we're in development environments changed, and as a result we need to invert the conditional.

Fixes: #1697

In the process of removing `electron-is-dev` the way that we determine
if we're in development environments changed, and as a result we need to
invert the conditional.

Fixes: adopted-ember-addons#1697
@RobbieTheWagner
Copy link
Member

@jagthedrummer have you confirmed that this does indeed work?

@jagthedrummer
Copy link
Contributor Author

@RobbieTheWagner in my pre-existing app making this change to electron-app/src/index.js 100% gets the inspector back and working like I'd expect.

In a new ember-electron app it makes the inspector available in the dev tools, where it had previously been missing, but the inspector doesn't recognize that there's an ember app to be inspected.

CleanShot 2024-04-17 at 13 29 09

The output in the console looks like this:

$ yarn ember electron
yarn run v1.22.22
warning ../package.json: No license field
$ /Users/jgreen/projects/ember-electron-test/node_modules/.bin/ember electron
Checking dependencies in electron-app...
Environment: development

Build successful (3276ms)

Slowest Nodes (totalTime >= 5%)                                                | Total (avg)
-------------------------------------------------------------------------------+--------------------
@embroider/webpack (1)                                                         | 2228ms
@embroider/compat/app (1)                                                      | 227ms
Babel: @ember/test-helpers (1)                                                 | 167ms

Starting Electron...
Installing Devtron from /Users/jgreen/projects/ember-electron-test/electron-app/node_modules/devtron
Failed to install Devtron:  TypeError: electron.BrowserWindow.addDevToolsExtension is not a function
    at exports.install (/Users/jgreen/projects/ember-electron-test/electron-app/node_modules/devtron/api.js:13:35)
    at App.<anonymous> (/Users/jgreen/projects/ember-electron-test/electron-app/src/index.js:36:26)
    at App.emit (node:events:514:28)
(node:52630) ExtensionLoadWarning: Warnings loading extension at /Users/jgreen/Library/Application Support/ember-electron-test/extensions/bmdblncegkenkacieihfhpjfppoconhi:
  Permission 'contextMenus' is unknown or URL pattern is malformed.

(Use `Electron --trace-warnings ...` to show where the warning was created)
[52630:0417/134146.515477:ERROR:extensions_browser_client.cc(68)] Extension Error:
  OTR:     false
  Level:   2
  Source:  chrome-extension://fokcjoodnnohdcddplobelifobibdjij/background.js
  Message: Uncaught TypeError: Cannot read properties of undefined (reading 'onClicked')
  ID:      fokcjoodnnohdcddplobelifobibdjij
  Type:    RuntimeError
  Context: chrome-extension://fokcjoodnnohdcddplobelifobibdjij/background.js
  Stack Trace:
    {
      Line:     93
      Column:   1
      URL:      chrome-extension://fokcjoodnnohdcddplobelifobibdjij/background.js
      Function: (anonymous function)
    }
[52630:0417/134146.515597:ERROR:extensions_browser_client.cc(68)] Extension Error:
  OTR:     false
  Level:   1
  Source:  manifest.json
  Message: Service worker registration failed. Status code: 15
  ID:      fokcjoodnnohdcddplobelifobibdjij
  Type:    ManifestError
[52630:0417/134148.293734:ERROR:CONSOLE(1)] "Request Autofill.enable failed. {"code":-32601,"message":"'Autofill.enable' wasn't found"}", source: devtools://devtools/bundled/core/protocol_client/protocol_client.js (1)
[52630:0417/134148.296592:ERROR:CONSOLE(2)] "Electron sandboxed_renderer.bundle.js script failed to run", source: node:electron/js2c/sandbox_bundle (2)
[52630:0417/134148.296609:ERROR:CONSOLE(2)] "TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))", source: node:electron/js2c/sandbox_bundle (2)
[52630:0417/134156.012450:ERROR:CONSOLE(2)] "Electron sandboxed_renderer.bundle.js script failed to run", source: node:electron/js2c/sandbox_bundle (2)
[52630:0417/134156.012475:ERROR:CONSOLE(2)] "TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))", source: node:electron/js2c/sandbox_bundle (2)

Kinda seems like two different, but closely related issues. But I don't really know.

Copy link
Member

@bendemboski bendemboski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- thank you!

@RobbieTheWagner RobbieTheWagner changed the title Bug fix: Install devtron & Ember Inspector in dev Fix checking for packaged/dev modes Apr 17, 2024
@RobbieTheWagner RobbieTheWagner merged commit e2e1c29 into adopted-ember-addons:main Apr 17, 2024
5 of 8 checks passed
@bendemboski
Copy link
Member

Ugh, the build failure...I'll open a PR in a sec updating our Node version in CI which should address that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No Ember Inspector in new app
3 participants