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

Feature Request: CLI #126

Open
scottrippey opened this issue Mar 31, 2020 · 7 comments
Open

Feature Request: CLI #126

scottrippey opened this issue Mar 31, 2020 · 7 comments

Comments

@scottrippey
Copy link

I would love to be able to install devtools from a CLI command, instead of by adding this temporary code to my Electron app.
This could be done as an interactive prompt from running:

npx electron-devtools-installer

What do you think of this?

@nklayman
Copy link

nklayman commented Apr 1, 2020

It would be really difficult to make the code changes necessary for an extension to be installed from a cli tool. I don't really think there is a way to get around adding the code.

@scottrippey
Copy link
Author

scottrippey commented Apr 5, 2020

@nklayman I think there's a common misconception that these devtools require app code changes. Once you run the "install" code (eg in the devtools console), the extension stays installed, even after a restart. No code changes are necessary.

At my work, we actually investigated why the installed devtools seemed to persist for some folks, while others needed to reinstall them every time. We discovered that Electron does save the list of installed DevTools extensions -- but it only saves the list on quit. So, some people were accustomed to killing the process in the Terminal (eg. Ctrl+C), which never saved the list, and those people would have to reinstall the extensions every run. But others, who used ⌘Q to quit the app properly, the extensions would persist.

All this to say: in my project, I just finished a custom npm run install-devtools script, which runs Electron with an interactive prompt, lets them choose the extensions they want installed (or uninstalled), then quits the app. And it works perfectly.

So I'd be happy to contribute a script for performing this action from a CLI prompt, so that installing these tools is as easy as npx electron-devtools-installer

@nklayman
Copy link

nklayman commented Apr 5, 2020

If you found a way to do it than that is awesome, I'm glad to be wrong on this. However, the maintainer of this repo seems to be MIA and hasn't been merging PRs. You may have to create a fork or an entirely separate project. Best of luck either way, I might have to start using it instead of the code change.

@MarshallOfSound
Copy link
Owner

However, the maintainer of this repo seems to be MIA

🤔 👀

@MarshallOfSound
Copy link
Owner

@scottrippey I would be on board with this but I know that the way that Electron devtools extensions are persisted across restarts will change and be less modifiable from Electron 9 onwards. If you can find a solution that works with Electron 9 I'd be more than happy to review a PR to add a CLI to this module 🙇

@scottrippey
Copy link
Author

Let me investigate E9 and see what's different. I'm currently on E8 so thanks for letting me know ahead-of-time about this change!

@scottrippey
Copy link
Author

scottrippey commented Apr 7, 2020

Looking at the E9 source code, I can see how they've changed BrowserWindow.addDevToolsExtension to internally use session.loadExtension, but I still see all the same exact "persist the devtools between app runs" code, so it seems like there will be no differences needed for the CLI to work correctly.
https://github.com/electron/electron/blob/9-x-y/lib/browser/chrome-extension.js#L533

I currently have a (private repo) CLI script that is working great. I'll see if I can take some time to create a PR.
image

My only concern with adding a CLI script is: any CLI tools will have to be prod dependencies ... Personally I like using inquirer to present a nice installation prompt, but I wouldn't want to inflate this repo's dependencies for an optional CLI feature. So maybe we could consider making a new electron-devtools-installer-cli repo for this. Thoughts?

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

No branches or pull requests

3 participants