diff --git a/aio/tools/transforms/authors-package/watchr.js b/aio/tools/transforms/authors-package/watchr.js index 296dba3270..7713a330e9 100644 --- a/aio/tools/transforms/authors-package/watchr.js +++ b/aio/tools/transforms/authors-package/watchr.js @@ -22,10 +22,28 @@ function next(error) { } } -console.log('Started watching files in:'); -console.log(' - ', contentsPath); -console.log(' - ', apiPath); -console.log('Doc gen will run when you change a file in either of these folders.'); +let p = Promise.resolve(); -watchr.open(contentsPath, listener, next); -watchr.open(apiPath, listener, next); +if (process.argv.indexOf('--watch-only') === -1) { + console.log('==================================================================='); + console.log('Running initial doc generation'); + console.log('-------------------------------------------------------------------'); + console.log('Skip the full doc-gen by running: `yarn docs-watch -- --watch-only`'); + console.log('==================================================================='); + const {Dgeni} = require('dgeni'); + var dgeni = new Dgeni([require('../angular.io-package')]); + p = dgeni.generate(); +} + +p.then(() => { + console.log('==================================================================='); + console.log('Started watching files in:'); + console.log(' - ', contentsPath); + console.log(' - ', apiPath); + console.log('Doc gen will run when you change a file in either of these folders.'); + console.log('==================================================================='); + + watchr.open(contentsPath, listener, next); + watchr.open(apiPath, listener, next); + +}); \ No newline at end of file