Every line of 'npm run watch' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
61 runWatch(...args) { return lazy.Run.runWatch(this, ...args); }
35 watch(listener) { 36 this.events.on('data', listener) 37 return () => { 38 this.events.removeListener('data', listener) 39 } 40 }
106 watch(): Promise { 107 this.createDirs(); 108 this.copyAssets(); 109 110 return new Promise((resolve, reject) => { 111 this.ngcConfig.angularCompilerOptions.generateCodeForLibraries = false; 112 113 writeFileSync(this.tmpdir+'/tsconfig.json',JSON.stringify(this.ngcConfig)); 114 writeFileSync(this.tmpdir + '/build/package.json', 115 JSON.stringify(this.packageJSONConfig, null, 1 116 ) 117 ); 118 119 const watcher = watch(this.liborigsrcdir+'/**', this.tmpdir + '/src/'); 120 watcher.on('watch-error', (err) => console.log(err)); 121 122 // watcher.on('remove', (evt) => console.log('remove', evt)); 123 watcher.on('watch-ready', () => { 124 inlineResourcesForDirectory(this.tmpdir + '/src'); 125 watcher.on('copy', (evt) => { 126 const path = evt.srcPath.substring(this.liborigsrcdir.length + 1); 127 128 if(path.indexOf('.ts')>0) { 129 inlineResourcesAsync(this.tmpdir + '/src/' + path).subscribe(); 130 } else if(['.css','.scss','.html'].find(ext => path.indexOf(ext)>-1)) { 131 getAffectedTypeScriptSourceFilesForResource(this.tmpdir + '/src/' + path) 132 .forEach(tsfile => { 133 // console.log(tsfile); 134 copyFile( 135 this.liborigsrcdir + '/' + tsfile.substring((this.tmpdir + '/src/').length), 136 tsfile, 137 () => inlineResourcesAsync(tsfile).subscribe() 138 ); 139 }); 140 } 141 }); 142 const ngcproc = spawn( 143 /^win/.test(process.platform) ? 144 'node_modules\\.bin\\ngc.cmd' : 'node_modules/.bin/ngc', 145 [ 146 '-w', 147 '-p', 148 this.tmpdir+'/tsconfig.json' 149 ]); 150 ngcproc.stdout.pipe(process.stdout); 151 ngcproc.stderr.pipe(process.stderr); 152 resolve(ngcproc); 153 }); 154 }); 155 }
404 function startWatch(environment, parameters) { 405 var id = parameters[0]; 406 timers[id] = { 407 start: Date.now(), 408 end: undefined, 409 }; 410 }
62 export function watch() { 63 gulp.watch(settings.sources.scripts, gulp.series(gulp.parallel(lint, reload))).on('change', informOnChange); 64 gulp.watch(settings.sources.styles, gulp.series(styles, gulp.parallel(lintStyles, reload))).on('change', informOnChange); 65 66 if (useHandlebars) { 67 gulp.watch([ 68 ...settings.sources.handlebars, 69 './src/handlebars/layouts/*.hbs', 70 './src/handlebars/partials/**/*.hbs', 71 './src/handlebars/helpers/*.js' 72 ], gulp.series(handlebars, gulp.parallel(lintBootstrap, validateHtml, gulp.series(processHtml, reload)))).on('change', informOnChange); 73 gulp.watch(['./src/handlebars/helpers/*.js'], gulp.parallel(lint)).on('change', informOnChange); 74 } else { 75 gulp.watch(settings.sources.html, gulp.parallel(lintBootstrap, validateHtml, gulp.series(processHtml, reload))).on('change', informOnChange); 76 } 77 78 gulp.watch(settings.sources.images, gulp.series(images, reload)).on('change', informOnChange); 79 gulp.watch(settings.sources.fonts, gulp.series(fonts, reload)).on('change', informOnChange); 80 gulp.watch(settings.sources.appTemplates, gulp.series(appTemplates, reload)).on('change', informOnChange); 81 82 function informOnChange(path) { 83 gutil.log(`File ${chalk.yellow(path)} has changed`); 84 } 85 }
8 module.exports = function watch(done) { 9 10 var minimist = require('minimist'); 11 var options = minimist(process.argv.slice(2), { 12 boolean: ['debug'] 13 }); 14 15 var args = { 16 debug: options.debug, 17 dev: true, 18 watch: true 19 }; 20 21 var build = require('./lib/build'); 22 23 return build(args)(done); 24 25 };
16 function Watch (dir) { 17 if (!(this instanceof Watch)) return new Watch(dir) 18 EventEmitter.call(this) 19 20 this._dir = dir 21 this.state = { 22 started: new Date(), 23 commit: { 24 sha: getCommit(dir), 25 found: false 26 }, 27 link: null, 28 repo: null, 29 build: null, 30 results: {}, 31 success: null 32 } 33 }
215 function watch (options) { 216 var gaze = require('gaze') 217 var source = path.resolve(options.source) 218 var layout = options.layout ? path.resolve(process.cwd(), options.layout) : defaultLayout 219 220 sitedown(options, function (err) { 221 if (err) return console.error(err.message) 222 223 gaze(['**/*.md', layout], { cwd: source }, function (err, watcher) { 224 if (err) console.error(err.message) 225 226 console.log('\nWatching ' + source + ' for changes...') 227 228 watcher.on('all', function (event, filepath) { 229 console.log('\n' + filepath + ' was ' + event + '\n') 230 231 sitedown(options, function (err) { 232 if (err) return console.error(err.message) 233 }) 234 }) 235 }) 236 }) 237 }
57 function watch(onUpdate) { 58 var bundler = watchify(createBundler(watchify.args)); 59 60 bundler.on('update', function () { 61 var bundle = rebundle.call(this, true); 62 63 if (onUpdate) { 64 bundle.on('end', onUpdate); 65 } 66 }); 67 68 return rebundle.call(bundler); 69 }
89 function watch() { 90 return gulp.watch(['src/**/*.ts', 'src/ui/*.html', 'test/**/*.ts'], 91 gulp.series(copyHtmlTemplates, lint, testNoFail, compile)); 92 }