1- import * as _ from " lodash" ;
2- import * as chokidar from " chokidar" ;
3- import * as touch from " touch" ;
4- import * as invariant from " invariant" ;
1+ import * as _ from ' lodash' ;
2+ import * as chokidar from ' chokidar' ;
3+ import * as touch from ' touch' ;
4+ import * as invariant from ' invariant' ;
55
6- import { Stats , copy , existsSync , remove , statSync , lstatSync } from " fs-extra" ;
7- import { join , relative , resolve } from " path" ;
6+ import { Stats , copy , existsSync , remove , statSync , lstatSync } from ' fs-extra' ;
7+ import { join , relative , resolve } from ' path' ;
88
9- import { Dirs , PieController , PieConfigure , Element } from " ../install" ;
10- import { buildLogger } from " log-factory" ;
9+ import { Dirs , PieController , PieConfigure , Element } from ' ../install' ;
10+ import { buildLogger } from ' log-factory' ;
1111
1212const logger = buildLogger ( ) ;
1313
@@ -63,7 +63,7 @@ export class BaseWatch implements Roots, Watch {
6363 }
6464
6565 public start ( ) : void {
66- logger . debug ( " [BaseWatch] [start] srcRoot: " , this . srcRoot ) ;
66+ logger . debug ( ' [BaseWatch] [start] srcRoot: ' , this . srcRoot ) ;
6767
6868 this . watcher = chokidar . watch ( this . srcRoot , {
6969 followSymlinks : false ,
@@ -111,28 +111,28 @@ export class BaseWatch implements Roots, Watch {
111111 const onError = e => logger . error ( e ) ;
112112 const onReady = ( ) => {
113113 logger . info ( `Watcher for ${ this . srcRoot } - Ready` ) ;
114- logger . silly ( " watched: \n" , this . watcher . getWatched ( ) ) ;
114+ logger . silly ( ' watched: \n' , this . watcher . getWatched ( ) ) ;
115115 this . copyOnceIfNeeded ( this . watcher . getWatched ( ) ) ;
116116 } ;
117117
118118 this . watcher
119- . on ( " add" , onAdd )
120- . on ( " change" , onChange )
121- . on ( " unlink" , onUnlink )
122- . on ( " error" , onError )
123- . on ( " ready" , onReady ) ;
119+ . on ( ' add' , onAdd )
120+ . on ( ' change' , onChange )
121+ . on ( ' unlink' , onUnlink )
122+ . on ( ' error' , onError )
123+ . on ( ' ready' , onReady ) ;
124124 }
125125
126126 protected isTargetSymLink ( ) : boolean {
127- logger . debug ( " [isDestinationSymLink] targetRoot: " , this . targetRoot ) ;
127+ logger . debug ( ' [isDestinationSymLink] targetRoot: ' , this . targetRoot ) ;
128128
129129 try {
130130 const lstat = lstatSync ( this . targetRoot ) ;
131131 const out = lstat . isSymbolicLink ( ) ;
132132 logger . debug (
133- " [isDestinationSymLink] targetRoot: " ,
133+ ' [isDestinationSymLink] targetRoot: ' ,
134134 this . targetRoot ,
135- " isSymLink?" ,
135+ ' isSymLink?' ,
136136 out
137137 ) ;
138138 return out ;
@@ -187,7 +187,7 @@ export class BaseWatch implements Roots, Watch {
187187 [ ]
188188 ) ;
189189
190- logger . debug ( " files that need to be copied over: " , newFiles ) ;
190+ logger . debug ( ' files that need to be copied over: ' , newFiles ) ;
191191
192192 // we have to wait a short while before copying? webpack issue?
193193 setTimeout ( ( ) => {
@@ -211,7 +211,7 @@ export class PackageWatch extends BaseWatch {
211211 }
212212
213213 get targetRoot ( ) {
214- return resolve ( join ( this . targetDir , " node_modules" , this . name ) ) ;
214+ return resolve ( join ( this . targetDir , ' node_modules' , this . name ) ) ;
215215 }
216216}
217217
@@ -220,12 +220,12 @@ class PWatch extends BaseWatch {
220220 private pkgDir : string ,
221221 private dirs : Dirs ,
222222 private model : PieConfigure | PieController ,
223- private mode : " controller" | " configure"
223+ private mode : ' controller' | ' configure'
224224 ) {
225225 super ( [ ] ) ;
226226 invariant (
227227 model . isChild || model . isLocalPkg ,
228- " Must be a child or local pkg"
228+ ' Must be a child or local pkg'
229229 ) ;
230230 }
231231
@@ -240,25 +240,25 @@ class PWatch extends BaseWatch {
240240 get targetRoot ( ) {
241241 if ( this . model . isChild ) {
242242 const dirname =
243- this . mode === " controller"
243+ this . mode === ' controller'
244244 ? this . dirs . controllers
245245 : this . dirs . configure ;
246246 return resolve ( join ( dirname , `node_modules` , this . model . moduleId ) ) ;
247247 } else if ( this . model . isLocalPkg ) {
248- return resolve ( join ( this . dirs . root , " node_modules" , this . model . moduleId ) ) ;
248+ return resolve ( join ( this . dirs . root , ' node_modules' , this . model . moduleId ) ) ;
249249 }
250250 }
251251}
252252
253253export class PieControllerWatch extends PWatch {
254254 constructor ( pkgDir : string , dirs : Dirs , model : PieController ) {
255- super ( pkgDir , dirs , model , " controller" ) ;
255+ super ( pkgDir , dirs , model , ' controller' ) ;
256256 }
257257}
258258
259259export class PieConfigureWatch extends PWatch {
260260 constructor ( pkgDir : string , dirs : Dirs , model : PieConfigure ) {
261- super ( pkgDir , dirs , model , " configure" ) ;
261+ super ( pkgDir , dirs , model , ' configure' ) ;
262262 }
263263}
264264
@@ -276,7 +276,7 @@ export class PieWatch {
276276 configure : PieConfigure
277277 ) {
278278 logger . debug (
279- " [PieWatch] constructor: " ,
279+ ' [PieWatch] constructor: ' ,
280280 name ,
281281 relativePath ,
282282 pieItemDir ,
@@ -330,16 +330,16 @@ export class FileWatch implements Watch {
330330 constructor ( readonly filepath , readonly onChange : ( n : string ) => void ) { }
331331
332332 public start ( ) {
333- logger . silly ( " [FileWatch] filepath: " , this . filepath ) ;
333+ logger . silly ( ' [FileWatch] filepath: ' , this . filepath ) ;
334334
335335 this . watch = chokidar . watch ( this . filepath , { ignoreInitial : true } ) ;
336- this . watch . on ( " change" , ( ) => {
337- logger . silly ( " [FileWatch] on change: " , this . filepath ) ;
336+ this . watch . on ( ' change' , ( ) => {
337+ logger . silly ( ' [FileWatch] on change: ' , this . filepath ) ;
338338 this . onChange ( this . filepath ) ;
339339 } ) ;
340340
341- this . watch . on ( " ready" , ( ) => {
342- logger . silly ( " [FileWatch] ready for path: " , this . filepath ) ;
341+ this . watch . on ( ' ready' , ( ) => {
342+ logger . silly ( ' [FileWatch] ready for path: ' , this . filepath ) ;
343343 } ) ;
344344 }
345345}
0 commit comments