npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ojshua/electronmon

v1.1.3

Published

watch and reload your electron app the easy way

Downloads

9

Readme

electronmon

electronmon logo

Watch and reload your electron app the easy way!

travis appveyor npm-downloads npm-version dm-david

This is the simplest way to watch and restart/reload electron applications. It requires no quessing, no configuration, and no changing your application or conditionally requiring dependencies. And best of all, it keeps everything in-process, and will not exit on the first application relaunch.

It was inspired by nodemon and largely works the same way (by magic 🧙).

To use it, you don't have to change your application at all. Just use electronmon instead of electron to launch your application, using all the same arguments you would pass to the electron cli:

npx electronmon .

That's it! Now, all your files are watched. Changes to main process files will cause the application to restart entirely, while changes to any of the renderer process files will simply reload the application browser windows.

All you have to do now is write your application code.

Configuration

Okay, okay... so it's not exactly magic. While electronmon will usually work exactly the way you want it to, you might find a need to contigure it. You can do so by providing extra values in your package.json in the an electronmon object. The following options are available:

  • patterns {Array<String>} - Additional patterns to watch, in glob form. The default patterns are ['**/*', '!node_modules', '!node_modules/**/*', '!.*', '!**/*.map'], and this property will add to that. If you want to ignore some files, start the glob with !.

Example:

{
  "electronmon": {
    "patterns": ["!test/**"]
  }
}

Supported environments

This module is tested and supported on Windows, MacOS, and Linux, using node versions 8, 10, 12, and 14 and electron versions 3, 4, 5, 6, 7, 8, 9.

API Usage

You will likely never need to use this, but in case you do, this module can be required and exposes and API for interacting with the monitor process.

const electronmon = require('electronmon');

(async () => {
  const options = {...};
  const app = await electronmon(options);
})();

All options are optional with reasonable defaults (again, magic 🧙), but the following options are available:

  • cwd {String} - The root directory of your application.
  • args {Array<String>} - The arguments that you want to pass to electron.
  • env {Object} - Any additional environment variables you would like to specically provide to your electron process.
  • patterns {Array<String>} - Additional patterns to watch, in glob form. The default patterns are ['**/*', '!node_modules', '!node_modules/**/*', '!.*', '!**/*.map'], and this property will add to that. If you want to ignore some files, start the glob with !.
  • logLevel {String} - The level of logging you would like. Possible values are verbose, info, error, and quiet.
  • electronPath {String} - The path to the electron binary.

When the monitor is started, it will start your application and the monitoring process. It exposes the following methods for interacting with the monitoring process (all methods are asynchronous and return a Promise):

  • app.reload()Promise - reloads all open web views of your application
  • app.restart()Promise - restarts the entire electron process of your application
  • app.close()Promise - closes the entire electron process of your application and waits for file changes in order to restart it
  • app.destroy()Promise - closes the entire electron process and stops monitoring