Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add watcher on Linux: change fs to node-watch #13448

Merged
merged 5 commits into from
Jan 25, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
5 changes: 5 additions & 0 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"lint-staged": "7.3.0",
"lodash": "4.17.10",
"mkdirp": "0.5.1",
"node-sass": "4.11.0",
"node-sass": "4.11.0",
Naerriel marked this conversation as resolved.
Show resolved Hide resolved
"node-watch": "0.6.0",
"pegjs": "0.10.0",
"phpegjs": "1.0.0-beta7",
"react-dom": "16.6.3",
Expand Down