1.0.9 • Published 6 years ago

electron-watch v1.0.9

Weekly downloads
10
License
MIT
Repository
github
Last release
6 years ago

electron-watch

Automatically restart Electron app when the main process file is changed.

npm MIT License

Installation

npm install electron-watch

Usage

For example,

package.json:

{
  //...
  "scripts": {
    "dev:electron-main": "cross-env NODE_ENV='development' electron -r babel-register ./app/renderer/",
  },
  //...
}

Adding code block to the main process file:

index.js:

import electron from 'electron';
import path from 'path';

if (process.env.NODE_ENV === 'development') {
  require('electron-watch')(
    __dirname,
    'dev:electron-main',             // npm scripts, means: npm run dev:electron-main
    path.join(__dirname, './'),      // cwd
    2000,                            // debounce delay
  );
}

OPTIONS

fieldtypedescription
pathstringPaths to files, dirs to be watched recursively, or glob patterns.
commandstringnpm script name, use this to start electron main process
cwdstringCurrent working directory of the child process.
delayNumberDelay (in ms) arguments of debounce, default is 3000ms

LICENSE

MIT @ Alchemy

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.1

9 years ago

0.0.0

9 years ago