Socket
Socket
Sign inDemoInstall

electron-reloader

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-reloader - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

30

index.js
'use strict';
const {inspect} = require('util');
const path = require('path');

@@ -6,9 +7,11 @@ const electron = require('electron');

const isDev = require('electron-is-dev');
const dateTime = require('date-time');
const chalk = require('chalk');
function getMainProcessPaths(topModuleObj) {
const cwd = path.dirname(topModuleObj.filename);
const paths = new Set([topModuleObj.filename]);
function getMainProcessPaths(topModuleObject) {
const cwd = path.dirname(topModuleObject.filename);
const paths = new Set([topModuleObject.filename]);
const getPaths = moduleObj => {
for (const child of moduleObj.children) {
const getPaths = moduleObject => {
for (const child of moduleObject.children) {
if (path.relative(cwd, child.filename).includes('node_modules')) {

@@ -23,3 +26,3 @@ continue;

getPaths(topModuleObj);
getPaths(topModuleObject);

@@ -40,5 +43,6 @@ return paths;

options = Object.assign({
watchRenderer: true
}, options);
options = {
watchRenderer: true,
...options
};

@@ -61,3 +65,3 @@ const cwd = path.dirname(moduleObj.filename);

watcher.on('ready', () => {
console.log('Watched paths:', watcher.getWatched());
console.log('Watched paths:', inspect(watcher.getWatched(), {compact: false, colors: true}));
});

@@ -68,3 +72,3 @@ }

if (options.debug) {
console.log('File changed:', filePath);
console.log('File changed:', chalk.bold(filePath), chalk.dim(`(${dateTime().split(' ')[1]})`));
}

@@ -76,4 +80,4 @@

} else {
for (const win of electron.BrowserWindow.getAllWindows()) {
win.webContents.reloadIgnoringCache();
for (const window_ of electron.BrowserWindow.getAllWindows()) {
window_.webContents.reloadIgnoringCache();
}

@@ -80,0 +84,0 @@ }

{
"name": "electron-reloader",
"version": "0.2.0",
"version": "0.3.0",
"description": "Simple auto-reloading for Electron apps during development",

@@ -39,8 +39,10 @@ "license": "MIT",

"dependencies": {
"chokidar": "^2.0.0",
"electron-is-dev": "^0.3.0"
"chalk": "^2.4.2",
"chokidar": "^3.0.0",
"date-time": "^3.1.0",
"electron-is-dev": "^1.1.0"
},
"devDependencies": {
"electron": "^1.7.10",
"xo": "*"
"electron": "^5.0.1",
"xo": "^0.24.0"
},

@@ -47,0 +49,0 @@ "xo": {

@@ -16,3 +16,5 @@ # electron-reloader [![Build Status](https://travis-ci.org/sindresorhus/electron-reloader.svg?branch=master)](https://travis-ci.org/sindresorhus/electron-reloader)

*Requires Electron 5 or later.*
## Usage

@@ -25,3 +27,3 @@

require('electron-reloader')(module);
} catch (err) {}
} catch (_) {}
```

@@ -40,3 +42,3 @@

Type: `Object`
Type: `object`

@@ -47,3 +49,3 @@ The global `module` object.

Type: `Object`
Type: `object`

@@ -59,3 +61,3 @@ ##### debug

Type: `Array<string|RegExp>`
Type: `Array<string | RegExp>`

@@ -88,2 +90,3 @@ Ignore patterns passed to [`chokidar`](https://github.com/paulmillr/chokidar#path-filtering). By default, files/directories starting with a `.`, `.map` files, and `node_modules` directories are ignored. This option is additive to those.

- [electron-unhandled](https://github.com/sindresorhus/electron-unhandled) - Catch unhandled errors and promise rejections in your Electron app
- [electron-serve](https://github.com/sindresorhus/electron-serve) - Static file serving for Electron apps

@@ -90,0 +93,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc