From ce687550aeaaa4d1c62c903c2675601c02677e8e Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Thu, 20 Apr 2017 20:42:42 +0100 Subject: [PATCH] build(aio): run `docs` before `docs-watch` (#16213) This helps to ensure that the full docs have been generated before we begin watching. You can disable this by providing the `--watch-only` flag. E.g. `yarn docs-watch -- --watch-only`. --- .../transforms/authors-package/watchr.js | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) 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