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`.
This commit is contained in:
Peter Bacon Darwin 2017-04-20 20:42:42 +01:00 committed by Miško Hevery
parent 563b909279
commit ce687550ae
1 changed files with 24 additions and 6 deletions

View File

@ -22,10 +22,28 @@ function next(error) {
}
}
let p = Promise.resolve();
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);
});