/**
 * @license
 * Copyright Google Inc. All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 */
const Package = require('dgeni').Package;
const { basePackage, CONTENTS_PATH, getBoilerPlateExcludes } = require('./base-package');

function createPackage(exampleName) {
  return new Package('author-guide', [basePackage])
    .config(function(readFilesProcessor) {
      readFilesProcessor.sourceFiles = [
        {
          basePath: CONTENTS_PATH,
          include: `${CONTENTS_PATH}/guide/${exampleName}.md`,
          fileReader: 'contentFileReader'
        },
        {
          basePath: CONTENTS_PATH,
          include: `${CONTENTS_PATH}/examples/*${exampleName}/**/*`,
          exclude: getBoilerPlateExcludes(),
          fileReader: 'exampleFileReader'
        }
      ];
    });
}


module.exports = { createPackage };
@@ -196,16 +196,49 @@
 nse%0A */%0A
+%0A/* eslint no-console: %22off%22 */%0A%0A
 const Pa
@@ -309,102 +309,605 @@
 PATH
-, getBoilerPlateExcludes %7D = require('./base-package');%0A%0Afunction createPackage(exampleName) %7B
+ %7D = require('./base-package');%0Aconst %7B readFileSync %7D = require('fs');%0Aconst %7B resolve %7D = require('canonical-path');%0A%0Afunction createPackage(guideName) %7B%0A%0A  const guideFilePath = %60$%7BCONTENTS_PATH%7D/guide/$%7BguideName%7D.md%60;%0A  const guideFile = readFileSync(guideFilePath, 'utf8');%0A  const examples = %5B%5D;%0A  guideFile.replace(/%3Ccode-(?:pane%7Cexample) %5B%5E%3E%5D*path=%22(%5B%5E%22%5D+)%22/g, (_, path) =%3E examples.push('examples/' + path));%0A%0A  if (examples.length) %7B%0A    console.log('The following example files are referenced in this guide:');%0A    console.log(examples.map(example =%3E ' - ' + example).join('%5Cn'));%0A  %7D%0A
 %0A  r
@@ -1107,50 +1107,21 @@
 de: 
-%60$%7BCONTENTS_PATH%7D/guide/$%7BexampleName%7D.md%60
+guideFilePath
 ,%0A  
@@ -1239,34 +1239,16 @@
 de: 
-%60$%7BCONTENTS_PATH%7D/
 examples
 /*$%7B
@@ -1247,74 +1247,55 @@
 ples
-/*$%7B
+.map(
 example
-Name%7D/**/*%60,%0A          exclude: getBoilerPlateExcludes(
+ =%3E resolve(CONTENTS_PATH, example)
 ),%0A 

compute which examples to include when watching guide docs (#16213)