summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2019-08-21 23:21:53 +0300
committerValentin Popov <info@valentineus.link>2019-08-21 23:23:28 +0300
commit24f924e24eb3e10581e0d9216b0848420c84d59d (patch)
treee48bd829a48b7ce42e113558f2578f5c6687ecae
parent9c57d101f0181aa134190edb0b2e7aabdba1151f (diff)
downloadelectron-hot-reload-24f924e24eb3e10581e0d9216b0848420c84d59d.tar.xz
electron-hot-reload-24f924e24eb3e10581e0d9216b0848420c84d59d.zip
Added 'LICENSE.txt' and 'README.md' files
Signed-off-by: Valentin Popov <info@valentineus.link>
-rw-r--r--LICENSE.txt7
-rw-r--r--README.md78
-rw-r--r--jest.config.js8
3 files changed, 85 insertions, 8 deletions
diff --git a/LICENSE.txt b/LICENSE.txt
index e69de29..3bd698c 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -0,0 +1,7 @@
+Copyright 2019 "Valentin Popov"
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
index 946775a..2ded40d 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,79 @@
# ElectronJS Reloader
+
+It is a simple method to restart your application.
+
+Features:
+
+- Separate watchers in main and renderer processes.
+- No magic, you necessary specify path files.
+- You can use hooks before reload.
+- Will catch error, if you want.
+
+## Example
+
+First, you should install this package:
+
+```bash
+# Yarn
+yarn add electron-reloader
+
+# NPM
+npm install --save electron-reloader
+```
+
+Next, you should create watchers:
+
+```javascript
+import { mainReloader, rendererReloader } from 'electron-reloader';
+import { app } from 'electron';
+import path from 'path';
+
+const mainFile = path.join(app.getAppPath(), 'dist', 'main.js');
+const rendererFile = path.join(app.getAppPath(), 'dist', 'renderer.js');
+
+mainReloader(mainFile, undefined, (error, path) => {
+ console.log("It is a main's process hook!");
+});
+
+rendererReloader(rendererFile, undefined, (error, path) => {
+ console.log("It is a renderer's process hook!");
+});
+```
+
+[Do you want to example application?](example/application)
+
+## Documentation
+
+### mainReloader( paths, ignored, handler, options ) => void
+
+If this is method detects changes, it will restart the application.
+
+| Argument | Type | Requered | Description |
+| --------- | ---------------------- | -------- | --------------------------------------------- |
+| `paths` | `string` or `string[]` | `true` | Paths to files and dirs to recursively watch. |
+| `ignored` | `RegExp` or `RegExp[]` | `false` | RegExp to file or dirs to ignore. |
+| `handler` | `function` | `false` | Callback function to create hooks. |
+| `options` | `object` | `false` | Additional options to [chokidar]. |
+
+[chokidar]: https://github.com/paulmillr/chokidar/tree/a8f250e16cbef6d87d30639f3fce1299c46a40cd#persistence
+
+### rendererReloader( paths, ignored, handler, options ) => void
+
+If this is method detects changes, it will restart the application's windows.
+
+| Argument | Type | Requered | Description |
+| --------- | ---------------------- | -------- | --------------------------------------------- |
+| `paths` | `string` or `string[]` | `true` | Paths to files and dirs to recursively watch. |
+| `ignored` | `RegExp` or `RegExp[]` | `false` | RegExp to file or dirs to ignore. |
+| `handler` | `function` | `false` | Callback function to create hooks. |
+| `options` | `object` | `false` | Additional options to [chokidar]. |
+
+[chokidar]: https://github.com/paulmillr/chokidar/tree/a8f250e16cbef6d87d30639f3fce1299c46a40cd#persistence
+
+## License
+
+<img width="256px" alt="MIT License" src="https://raw.githubusercontent.com/valentineus/valentineus.github.io/master/assets/images/7d05cad0-d553-42c7-be1f-7007926ba720.png" />
+
+[MIT](LICENSE.txt).
+Copyright (c)
+[Valentin Popov](https://valentineus.link/).
diff --git a/jest.config.js b/jest.config.js
deleted file mode 100644
index 6d89c25..0000000
--- a/jest.config.js
+++ /dev/null
@@ -1,8 +0,0 @@
-module.exports = {
- roots: [
- "./test",
- ],
- transform: {
- "^.+\\.tsx?$": "ts-jest",
- },
-};