electron-reloader
Advanced tools
Comparing version 0.3.0 to 1.0.0
16
index.js
@@ -9,5 +9,5 @@ 'use strict'; | ||
const chalk = require('chalk'); | ||
const findUp = require('find-up'); | ||
function getMainProcessPaths(topModuleObject) { | ||
const cwd = path.dirname(topModuleObject.filename); | ||
function getMainProcessPaths(topModuleObject, cwd) { | ||
const paths = new Set([topModuleObject.filename]); | ||
@@ -31,5 +31,5 @@ | ||
module.exports = (moduleObj, options) => { | ||
module.exports = (moduleObject, options) => { | ||
// This module should be a dev dependency, but guard | ||
// this in case the user included it as a dependency | ||
// this in case the user included it as a dependency. | ||
if (!isDev) { | ||
@@ -39,3 +39,3 @@ return; | ||
if (!moduleObj) { | ||
if (!moduleObject) { | ||
throw new Error('You have to pass the `module` object'); | ||
@@ -49,4 +49,6 @@ } | ||
const cwd = path.dirname(moduleObj.filename); | ||
const mainProcessPaths = getMainProcessPaths(moduleObj); | ||
const mainProcessDirectory = path.dirname(moduleObject.filename); | ||
const packageDirectory = findUp.sync('package.json', {cwd: mainProcessDirectory}); | ||
const cwd = packageDirectory ? path.dirname(packageDirectory) : mainProcessDirectory; | ||
const mainProcessPaths = getMainProcessPaths(moduleObject, cwd); | ||
const watchPaths = options.watchRenderer ? cwd : [...mainProcessPaths]; | ||
@@ -53,0 +55,0 @@ |
{ | ||
"name": "electron-reloader", | ||
"version": "0.3.0", | ||
"version": "1.0.0", | ||
"description": "Simple auto-reloading for Electron apps during development", | ||
"license": "MIT", | ||
"repository": "sindresorhus/electron-reloader", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
@@ -14,3 +15,3 @@ "name": "Sindre Sorhus", | ||
"test": "xo", | ||
"start": "electron test" | ||
"start": "electron test/main" | ||
}, | ||
@@ -40,10 +41,11 @@ "files": [ | ||
"dependencies": { | ||
"chalk": "^2.4.2", | ||
"chokidar": "^3.0.0", | ||
"chalk": "^3.0.0", | ||
"chokidar": "^3.3.1", | ||
"date-time": "^3.1.0", | ||
"electron-is-dev": "^1.1.0" | ||
"electron-is-dev": "^1.1.0", | ||
"find-up": "^4.1.0" | ||
}, | ||
"devDependencies": { | ||
"electron": "^5.0.1", | ||
"xo": "^0.24.0" | ||
"electron": "^8.0.0", | ||
"xo": "^0.25.3" | ||
}, | ||
@@ -50,0 +52,0 @@ "xo": { |
@@ -9,3 +9,2 @@ # electron-reloader [![Build Status](https://travis-ci.org/sindresorhus/electron-reloader.svg?branch=master)](https://travis-ci.org/sindresorhus/electron-reloader) | ||
## Install | ||
@@ -19,3 +18,2 @@ | ||
## Usage | ||
@@ -35,6 +33,5 @@ | ||
## API | ||
### reloader(module, [options]) | ||
### reloader(module, options?) | ||
@@ -53,3 +50,3 @@ #### module | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `false` | ||
@@ -67,3 +64,3 @@ | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `true` | ||
@@ -75,10 +72,8 @@ | ||
## Tip | ||
### Using it with webpack watch mode | ||
### Using it with Webpack watch mode | ||
Just add the source directory to the `ignore` option. The dist directory is already watched, so when a source file changes, webpack will build it and output it to the dist directory, which this module will detect. | ||
## Related | ||
@@ -92,6 +87,1 @@ | ||
- [electron-serve](https://github.com/sindresorhus/electron-serve) - Static file serving for Electron apps | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
7110
69
0
5
81
+ Addedfind-up@^4.1.0
+ Addedansi-styles@4.3.0(transitive)
+ Addedchalk@3.0.0(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedfind-up@4.1.0(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedlocate-path@5.0.0(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@4.1.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedsupports-color@7.2.0(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedsupports-color@5.5.0(transitive)
Updatedchalk@^3.0.0
Updatedchokidar@^3.3.1