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

electron-nice-auto-reload

v1.3.0

Published

A nice way for realtime-reloading your electron while developing.

Downloads

32

Readme

:rocket: Electron Nice Auto Reload

npm npm NPM

Reload your electron app nicely while developing !!!

Relaunch,Reload,Run-Script

If you want to relauch the app while we make some change in main.js

relaunch

Or you just happen to change a css file, and it just need to reload the window:

reload

Somehow you want more, you want to run a npm command while you change your .less file and it need to run command to generate a new css file:

runscript

Install

npm i electron-nice-auto-reload

How To Use

require in your main process

require('electron-nice-auto-reload')({
    rootPath: ...,
    rules: [],
    ignored: ...(pass to chokidar),
    log: true,
    devToolsReopen: true
})

e.g.

require('electron-nice-auto-reload')({
    rootPath: path.join(process.cwd(), 'src'),
    rules: [
        {
            // run lessc while style.less file is changed
            // and this script will change the style.css
            // hence reload all windows
            action: 'script',
            target: 'style\\.less',
            // lessc src/css/style.less src/css/style.css
            script: 'npm run less'
        },
        {
            // relaunch the app while main process related js files
            // were changed
            action: 'app.relaunch',
            target: 'preload\\.js|main\\.js'
        }
    ],
    ignored: /node_modules/,
    log: true,
    devToolsReopen: true
})

then start your electron app and develop it

Options

  • rootPath: the root path which chokidar is watching

  • rules:

    // Structure:
    //    options.rules = [rule1, rule2, ...]
    //    rule = {
    //       action: 'app.relaunch' | 'win.reload' | 'script',
    //       target: regex,
    //       script: string
    //    }
    • action means we can relaunch the app, reload all the BrowserWindow or even run script with node child_process.exec(). By default it is 'win.reload'
    • target means a regex string for matching a bunch of files for specific action
    • script means the script you use to run
  • ignored: same as chokidar. By default it is /node_modules|[/\\]\./

  • log: means to show the log or not. By default it is false

  • devToolsReopen: means to reopen the devTools when the win.reload action is perform(to avoid some css style might misplace) By default it is false

Changelog

  • 2020-09-04: mac OS support
  • 2020-09-05: do nothing when no rules on other files