Skip to content

Commit

Permalink
Add watcher on Linux: change fs to node-watch (#13448)
Browse files Browse the repository at this point in the history
* Add watcher on Linux: change fs to node-watch

* Add watcher on Linux: Change fs to node-watch (pt.2.)

* Add watcher on Linux: Change fs to node-watch (pt.3.)

* Framework: Regenerate package-lock.json
  • Loading branch information
Naerriel authored and aduth committed Jan 25, 2019
1 parent 43a2069 commit 1748145
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/packages/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* External dependencies
*/
const fs = require( 'fs' );
const watch = require( 'node-watch' );
const { execSync } = require( 'child_process' );
const path = require( 'path' );
const chalk = require( 'chalk' );
Expand Down Expand Up @@ -33,13 +34,13 @@ getPackages().forEach( ( p ) => {
const srcDir = path.resolve( p, 'src' );
try {
fs.accessSync( srcDir, fs.F_OK );
fs.watch( path.resolve( p, 'src' ), { recursive: true }, ( event, filename ) => {
watch( path.resolve( p, 'src' ), { recursive: true }, ( event, filename ) => {
if ( ! isSourceFile( filename ) ) {
return;
}

const filePath = path.resolve( srcDir, filename );
if ( ( event === 'change' || event === 'rename' ) && exists( filePath ) ) {
if ( ( event === 'update' ) && exists( filePath ) ) {
// eslint-disable-next-line no-console
console.log( chalk.green( '->' ), `${ event }: ${ filename }` );
rebuild( filePath );
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"lodash": "4.17.10",
"mkdirp": "0.5.1",
"node-sass": "4.11.0",
"node-watch": "0.6.0",
"pegjs": "0.10.0",
"phpegjs": "1.0.0-beta7",
"react-dom": "16.6.3",
Expand Down

0 comments on commit 1748145

Please sign in to comment.