Skip to content

Proposal: publish shell-chrome sub-package to npm. #2035

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

Open
Tanimodori opened this issue Mar 17, 2023 · 0 comments
Open

Proposal: publish shell-chrome sub-package to npm. #2035

Tanimodori opened this issue Mar 17, 2023 · 0 comments

Comments

@Tanimodori
Copy link

Tanimodori commented Mar 17, 2023

What problem does this feature solve?

I suggest to publish shell-chrome sub-package as a separate package to npm like shell-electron and api to help simplify the debugging of electron applications.

Normal web apps can easily access vue devtools by simply downloading it from browser extension market, but it is not the case for electron apps.

If you want to add vue devtools to the integrated devtools of electon, as the electron docs said, you need to get the unzipped form of crx extension, which is located in VUE_DEVTOOLS_PATH, and load by session.defaultSession.loadExtension

if (import.meta.env.DEV) {
  app.whenReady().then(() => {
    session.defaultSession.loadExtension(VUE_DEVTOOLS_PATH, {
      allowFileAccess: true,
    });
  });
}

Currently the only available distribution of latest compiled shell-chrome is at Chrome/Edge store:

There are problems of downloading from such a store:

  • Such a link schema may change over time causing tools broken.
  • You need to wait until the new version of devtools passing vendor's check, like Latest version not available for firefox. #2023 .
  • Google's Extension store is having difficulty connecting from some locations, due to well-known reasons. There's no mirror server for it.
  • You need to unzip crx for the downloaded form.

That's what the good old electron-devtools-installer does which is unmaintained 2 years ago. Download from chrome store, put into %APPDATA%/extensions and load into electron devtools. You can loaded from locally installed extension from Chrome with:

if (import.meta.env.DEV) {
  app.whenReady().then(() => {
    if (!process.env['APPDATA']) {
      throw new Error('Could not load extensions from local');
    }
    const extPath = join(
      process.env['APPDATA'],
      '../Local/Google/Chrome/User Data/Default/Extensions/nhdogjmejiglipccpnnnanhbledajbpd',
    );
    const extVersions = readdirSync(extPath);
    const VUE_DEVTOOLS_PATH = join(extPath, extVersions[0])
    session.defaultSession.loadExtension(VUE_DEVTOOLS_PATH, {
      allowFileAccess: true,
    });
  });
}

But you need to update using Chrome and still having update delays.

Publishing should be easy as to add pub:chrome command to package.json.

Currently @vue/devtools is not loadable by electron Chromium as it lacks manifest. I tried to load the artifact of building shell-chrome which works perfectly. As the package is published we can add it to devDependency and point VUE_DEVTOOLS_PATH to node_modules, which will get rid of tree-shaking problem.

Why not using @vue/devtools directly?

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

No branches or pull requests

1 participant