build(docs-infra): fail gently if a changed file is unknown (#40479)

When using `docs-watch` we try to match the changed file
to a dgeni package in order to trigger a minimal set of processors.

Previously, if the changed file could not be matched we emitted an
ugly error. Now we provide a helpeful message.

PR Close #40479
This commit is contained in:
Pete Bacon Darwin 2021-01-20 10:11:00 +00:00 committed by Jessica Janiuk
parent 4a9f7daf37
commit ead9ccd566
1 changed files with 4 additions and 0 deletions

View File

@ -51,6 +51,10 @@ module.exports = {
generateDocs: function(changedFile, options = {}) {
const {Dgeni} = require('dgeni');
const package = createPackage(changedFile);
if (package === undefined) {
console.log('The changed file was not matched to a dgeni package - skipping doc-gen');
return Promise.resolve();
}
if (options.silent) {
package.config(function(log) { log.level = 'error'; });
}